zhourui 5 лет назад
Родитель
Сommit
e85defa807
100 измененных файлов с 1582 добавлено и 1030 удалено
  1. 13 2
      o2server/pom.xml
  2. 5 1
      o2server/x_base_core_project/src/main/java/com/x/base/core/project/bean/PropertyObject.java
  3. 92 0
      o2server/x_base_core_project/src/main/java/com/x/base/core/project/cache/Cache.java
  4. 98 0
      o2server/x_base_core_project/src/main/java/com/x/base/core/project/cache/CacheEhcacheImpl.java
  5. 32 0
      o2server/x_base_core_project/src/main/java/com/x/base/core/project/cache/CacheEhcacheNotifyThread.java
  6. 67 0
      o2server/x_base_core_project/src/main/java/com/x/base/core/project/cache/CacheEhcacheReceiveThread.java
  7. 110 0
      o2server/x_base_core_project/src/main/java/com/x/base/core/project/cache/CacheManager.java
  8. 99 0
      o2server/x_base_core_project/src/main/java/com/x/base/core/project/cache/CacheRedisImpl.java
  9. 47 0
      o2server/x_base_core_project/src/main/java/com/x/base/core/project/cache/CacheRedisNotifyThread.java
  10. 12 0
      o2server/x_base_core_project/src/main/java/com/x/base/core/project/cache/TestClient.java
  11. 152 0
      o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Cache.java
  12. 14 0
      o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Config.java
  13. 2 1
      o2server/x_base_core_project/src/main/java/com/x/base/core/project/jaxrs/WrapClearCacheRequest.java
  14. 3 0
      o2server/x_base_core_project/src/main/java/com/x/base/core/project/jaxrs/cache/ActionReceive.java
  15. 0 70
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/CacheFactory.java
  16. 3 0
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/ThisApplication.java
  17. 17 18
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/factory/GroupFactory.java
  18. 29 28
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/factory/IdentityFactory.java
  19. 17 18
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/factory/PersonAttributeFactory.java
  20. 17 18
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/factory/PersonFactory.java
  21. 17 18
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/factory/RoleFactory.java
  22. 0 6
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/factory/TrustFactory.java
  23. 17 18
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/factory/UnitAttributeFactory.java
  24. 17 18
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/factory/UnitDutyFactory.java
  25. 28 25
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/factory/UnitFactory.java
  26. 2 7
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/empower/ActionListWithIdentityObject.java
  27. 0 3
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/empower/BaseAction.java
  28. 0 4
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/empowerlog/ActionCreate.java
  29. 0 5
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/empowerlog/BaseAction.java
  30. 8 9
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/ActionHasRole.java
  31. 8 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/ActionList.java
  32. 9 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/ActionListObject.java
  33. 8 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/ActionListWithGroupSubDirect.java
  34. 9 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/ActionListWithGroupSubDirectObject.java
  35. 8 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/ActionListWithGroupSubNested.java
  36. 9 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/ActionListWithGroupSubNestedObject.java
  37. 8 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/ActionListWithGroupSupDirect.java
  38. 9 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/ActionListWithGroupSupDirectObject.java
  39. 8 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/ActionListWithGroupSupNested.java
  40. 9 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/ActionListWithGroupSupNestedObject.java
  41. 15 17
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/ActionListWithPerson.java
  42. 16 17
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/ActionListWithPersonObject.java
  43. 8 4
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/BaseAction.java
  44. 9 12
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionList.java
  45. 8 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListMajorWithPerson.java
  46. 9 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListMajorWithPersonObject.java
  47. 9 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListObject.java
  48. 8 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithGroup.java
  49. 9 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithGroupObject.java
  50. 12 12
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithPerson.java
  51. 59 58
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithPersonObject.java
  52. 9 12
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithPersonWithUnit.java
  53. 10 13
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithPersonWithUnitObject.java
  54. 8 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithUnitSubDirect.java
  55. 9 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithUnitSubDirectObject.java
  56. 8 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithUnitSubNested.java
  57. 9 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithUnitSubNestedObject.java
  58. 10 5
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/BaseAction.java
  59. 8 9
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionHasRole.java
  60. 8 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionList.java
  61. 8 8
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListAll.java
  62. 9 8
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListAllObject.java
  63. 8 9
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListLoginAfter.java
  64. 9 9
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListLoginAfterObject.java
  65. 8 8
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListLoginRecent.java
  66. 9 8
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListLoginRecentObject.java
  67. 9 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListObject.java
  68. 9 12
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithGroup.java
  69. 9 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithGroupObject.java
  70. 8 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithIdentity.java
  71. 9 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithIdentityObject.java
  72. 8 9
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithPersonAttribute.java
  73. 9 9
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithPersonAttributeObject.java
  74. 9 12
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithPersonSubDirect.java
  75. 9 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithPersonSubDirectObject.java
  76. 8 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithPersonSubNested.java
  77. 9 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithPersonSubNestedObject.java
  78. 8 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithPersonSupDirect.java
  79. 9 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithPersonSupDirectObject.java
  80. 8 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithPersonSupNested.java
  81. 9 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithPersonSupNestedObject.java
  82. 8 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithRole.java
  83. 9 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithRoleObject.java
  84. 8 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithUnitSubDirect.java
  85. 8 9
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithUnitSubDirectLike.java
  86. 11 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithUnitSubDirectLikeObject.java
  87. 9 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithUnitSubDirectObject.java
  88. 8 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithUnitSubNested.java
  89. 9 9
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithUnitSubNestedLike.java
  90. 9 10
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithUnitSubNestedLikeObject.java
  91. 9 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithUnitSubNestedObject.java
  92. 11 4
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/BaseAction.java
  93. 3 2
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/personattribute/ActionAppendWithPersonWithName.java
  94. 8 8
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/personattribute/ActionListAttributeWithPersonWithName.java
  95. 8 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/personattribute/ActionListNameWithPerson.java
  96. 9 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/personattribute/ActionListWithPersonObject.java
  97. 3 2
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/personattribute/ActionSetWithPersonWithName.java
  98. 10 4
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/personattribute/BaseAction.java
  99. 8 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/role/ActionList.java
  100. 9 11
      o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/role/ActionListObject.java

+ 13 - 2
o2server/pom.xml

@@ -1,4 +1,6 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 	<modelVersion>4.0.0</modelVersion>
 	<groupId>o2oa</groupId>
 	<artifactId>o2server</artifactId>
@@ -314,6 +316,10 @@
 			<groupId>com.itextpdf</groupId>
 			<artifactId>font-asian</artifactId>
 		</dependency>
+		<dependency>
+			<groupId>redis.clients</groupId>
+			<artifactId>jedis</artifactId>
+		</dependency>
 	</dependencies>
 
 	<build>
@@ -567,7 +573,7 @@
 				<groupId>org.apache.cxf</groupId>
 				<artifactId>cxf-rt-bindings-soap</artifactId>
 				<version>3.3.7</version>
-		   </dependency>
+			</dependency>
 			<dependency>
 				<groupId>org.apache.cxf</groupId>
 				<artifactId>cxf-rt-bindings-xml</artifactId>
@@ -786,6 +792,11 @@
 				<artifactId>font-asian</artifactId>
 				<version>7.1.9</version>
 			</dependency>
+			<dependency>
+				<groupId>redis.clients</groupId>
+				<artifactId>jedis</artifactId>
+				<version>3.3.0</version>
+			</dependency>
 			<dependency>
 				<groupId>o2oa</groupId>
 				<artifactId>x_base_core_project</artifactId>

+ 5 - 1
o2server/x_base_core_project/src/main/java/com/x/base/core/project/bean/PropertyObject.java

@@ -1,5 +1,6 @@
 package com.x.base.core.project.bean;
 
+import java.io.Serializable;
 import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -8,7 +9,10 @@ import java.util.List;
 import org.apache.commons.beanutils.PropertyUtils;
 import org.apache.commons.lang3.reflect.FieldUtils;
 
-public abstract class PropertyObject {
+public abstract class PropertyObject implements Serializable {
+
+	private static final long serialVersionUID = 4777469768430179083L;
+
 	public void copyTo(Object o) throws Exception {
 		copyTo(o, false, new String[] {});
 	}

+ 92 - 0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/cache/Cache.java

@@ -0,0 +1,92 @@
+package com.x.base.core.project.cache;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import org.apache.commons.lang3.StringUtils;
+
+import com.x.base.core.project.jaxrs.WrapClearCacheRequest;
+
+public interface Cache {
+
+	public static final String TYPE_EHCACHE = "ehcache";
+	public static final String TYPE_REDIS = "redis";
+
+	public abstract void put(CacheCategory category, CacheKey key, Object o) throws Exception;
+
+	public abstract Optional<?> get(CacheCategory category, CacheKey key) throws Exception;
+
+	public abstract void shutdown();
+
+	public abstract void receive(WrapClearCacheRequest wi) throws Exception;
+
+	public abstract void notify(Class<?> clz, List<Object> keys) throws Exception;
+
+	public static CacheCategory cacheCategory(Object... parts) {
+		return new CacheCategory(parts);
+	}
+
+	public static CacheKey cacheKey(Object... parts) {
+		return new CacheKey(parts);
+	}
+
+	public static class CacheCategory {
+
+		public static final String SPLIT = "#";
+
+		private String value = "";
+
+		public CacheCategory(Object... parts) {
+			if ((null != parts) && (parts.length > 0)) {
+				value = Stream.of(parts).map(Cache::stringify).filter(StringUtils::isNotEmpty)
+						.collect(Collectors.joining(SPLIT));
+				if (StringUtils.isNotEmpty(value)) {
+					value = value + SPLIT;
+				}
+			}
+		}
+
+		public String toString() {
+			return value;
+		}
+	}
+
+	public static class CacheKey {
+
+		public static final String SPLIT = "#";
+
+		private String value = "";
+
+		public CacheKey(Object... parts) {
+			if ((null != parts) && (parts.length > 0)) {
+				value = Stream.of(parts).map(Cache::stringify).filter(StringUtils::isNotEmpty)
+						.collect(Collectors.joining(SPLIT));
+				if (StringUtils.isNotEmpty(value)) {
+					value = value + SPLIT;
+				}
+			}
+		}
+
+		public String toString() {
+			return value;
+		}
+	}
+
+	static String stringify(Object o) {
+		if (null == o) {
+			return "";
+		}
+		if (o instanceof Class<?>) {
+			return ((Class<?>) o).getName();
+		} else if (o instanceof Collection<?>) {
+			return StringUtils.join((Collection<?>) o, ",");
+		} else {
+			return Objects.toString(o);
+		}
+	}
+
+}

+ 98 - 0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/cache/CacheEhcacheImpl.java

@@ -0,0 +1,98 @@
+package com.x.base.core.project.cache;
+
+import java.lang.management.ManagementFactory;
+import java.util.List;
+import java.util.Optional;
+import java.util.concurrent.LinkedBlockingQueue;
+
+import org.apache.commons.lang3.BooleanUtils;
+
+import com.x.base.core.project.cache.ApplicationCache.ClearCacheRequest;
+import com.x.base.core.project.config.Config;
+import com.x.base.core.project.jaxrs.WrapClearCacheRequest;
+
+import net.sf.ehcache.CacheException;
+import net.sf.ehcache.CacheManager;
+import net.sf.ehcache.Ehcache;
+import net.sf.ehcache.Element;
+import net.sf.ehcache.config.CacheConfiguration;
+import net.sf.ehcache.config.Configuration;
+import net.sf.ehcache.config.PersistenceConfiguration;
+import net.sf.ehcache.management.ManagementService;
+import net.sf.ehcache.store.MemoryStoreEvictionPolicy;
+
+public class CacheEhcacheImpl implements Cache {
+
+	private CacheManager cacheManager;
+
+	private LinkedBlockingQueue<WrapClearCacheRequest> notifyQueue;
+
+	private LinkedBlockingQueue<WrapClearCacheRequest> receiveQueue;
+
+	private CacheEhcacheReceiveThread receiveThread;
+
+	private CacheEhcacheNotifyThread notifyThread;
+
+	public CacheEhcacheImpl(String application) throws Exception {
+		CacheConfiguration cacheConfiguration = new CacheConfiguration();
+		cacheConfiguration.maxEntriesLocalHeap(1000);
+		cacheConfiguration.persistence(new PersistenceConfiguration().strategy(PersistenceConfiguration.Strategy.NONE));
+		cacheConfiguration.timeToIdleSeconds(1800);
+		cacheConfiguration.timeToLiveSeconds(3600);
+		cacheConfiguration.memoryStoreEvictionPolicy(MemoryStoreEvictionPolicy.LFU);
+		Configuration configuration = new Configuration();
+		configuration.setDefaultCacheConfiguration(cacheConfiguration);
+		configuration.setName(application);
+		this.cacheManager = new CacheManager(configuration);
+		if (BooleanUtils.isTrue(Config.cache().getEhcache().getJmxEnable())) {
+			ManagementService.registerMBeans(cacheManager, ManagementFactory.getPlatformMBeanServer(), true, true, true,
+					true);
+		}
+		this.receiveQueue = new LinkedBlockingQueue<>();
+		this.receiveThread = new CacheEhcacheReceiveThread(cacheManager, receiveQueue);
+		this.receiveThread.start();
+		this.notifyQueue = new LinkedBlockingQueue<>();
+		this.notifyThread = new CacheEhcacheNotifyThread(notifyQueue);
+		this.notifyThread.start();
+	}
+
+	@Override
+	public Optional<Object> get(CacheCategory category, CacheKey key) throws Exception {
+		Element element = this.getCache(category.toString()).get(key.toString());
+		if (element != null) {
+			return Optional.ofNullable(element.getObjectValue());
+		} else {
+			return Optional.empty();
+		}
+	}
+
+	@Override
+	public void put(CacheCategory category, CacheKey key, Object o) throws Exception {
+		this.getCache(category.toString()).put(new Element(key.toString(), o));
+	}
+
+	@Override
+	public void receive(WrapClearCacheRequest wi) throws Exception {
+		receiveQueue.put(wi);
+	}
+
+	@Override
+	public void notify(Class<?> clz, List<Object> keys) throws Exception {
+		ClearCacheRequest req = new ClearCacheRequest();
+		req.setClassName(clz.getName());
+		req.setKeys(keys);
+		this.notifyQueue.put(req);
+	}
+
+	@Override
+	public void shutdown() {
+		this.receiveThread.interrupt();
+		this.notifyThread.interrupt();
+		this.cacheManager.shutdown();
+	}
+
+	private synchronized Ehcache getCache(String name) {
+		return cacheManager.addCacheIfAbsent(name);
+	}
+
+}

+ 32 - 0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/cache/CacheEhcacheNotifyThread.java

@@ -0,0 +1,32 @@
+package com.x.base.core.project.cache;
+
+import java.util.concurrent.LinkedBlockingQueue;
+
+import com.x.base.core.project.config.Config;
+import com.x.base.core.project.connection.CipherConnectionAction;
+import com.x.base.core.project.jaxrs.WrapClearCacheRequest;
+
+public class CacheEhcacheNotifyThread extends Thread {
+
+	public CacheEhcacheNotifyThread(LinkedBlockingQueue<WrapClearCacheRequest> queue) {
+		this.queue = queue;
+	}
+
+	private LinkedBlockingQueue<WrapClearCacheRequest> queue;
+
+	@Override
+	public void run() {
+		while (!isInterrupted()) {
+			try {
+				WrapClearCacheRequest wi = queue.take();
+				String url = Config.url_x_program_center_jaxrs("cachedispatch");
+				CipherConnectionAction.put(false, url, wi);
+			} catch (InterruptedException e) {
+				break;
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		}
+	}
+
+}

+ 67 - 0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/cache/CacheEhcacheReceiveThread.java

@@ -0,0 +1,67 @@
+package com.x.base.core.project.cache;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.stream.Stream;
+
+import org.apache.commons.lang3.StringUtils;
+
+import com.x.base.core.project.cache.Cache.CacheCategory;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.jaxrs.WrapClearCacheRequest;
+
+import net.sf.ehcache.CacheManager;
+import net.sf.ehcache.Ehcache;
+
+public class CacheEhcacheReceiveThread extends Thread {
+
+	public CacheEhcacheReceiveThread(CacheManager cacheManager, LinkedBlockingQueue<WrapClearCacheRequest> queue) {
+		this.cacheManager = cacheManager;
+		this.queue = queue;
+	}
+
+	private CacheManager cacheManager;
+	private LinkedBlockingQueue<WrapClearCacheRequest> queue;
+
+	@Override
+	public void run() {
+		while (!isInterrupted()) {
+			try {
+				WrapClearCacheRequest wi = queue.take();
+				String keyValue = new CacheKey(wi.getKeys().toArray()).toString();
+				Stream.of(cacheManager.getCacheNames()).forEach(cacheName -> {
+					if (StringUtils.contains(cacheName, new CacheCategory(wi.getClassName()).toString())) {
+						checkCache(cacheName, keyValue);
+					}
+				});
+			} catch (InterruptedException e) {
+				break;
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		}
+	}
+
+	@SuppressWarnings("unchecked")
+	private void checkCache(String cacheName, String prefix) {
+		Ehcache cache = cacheManager.getCache(cacheName);
+		if (null != cache) {
+			if (StringUtils.isNotEmpty(prefix)) {
+				// 根据给定的关键字进行删除
+				List<Object> removes = new ArrayList<>();
+				cache.getKeys().forEach(o -> {
+					if (StringUtils.startsWith(Objects.toString(o, ""), prefix)) {
+						removes.add(o);
+					}
+				});
+				if (!removes.isEmpty()) {
+					cache.removeAll(removes);
+				}
+			} else {
+				cache.removeAll();
+			}
+		}
+	}
+}

+ 110 - 0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/cache/CacheManager.java

@@ -0,0 +1,110 @@
+package com.x.base.core.project.cache;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+import org.apache.commons.lang3.StringUtils;
+
+import com.x.base.core.project.cache.Cache.CacheCategory;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.config.Config;
+import com.x.base.core.project.jaxrs.WrapClearCacheRequest;
+import com.x.base.core.project.logger.Logger;
+import com.x.base.core.project.logger.LoggerFactory;
+import com.x.base.core.project.tools.ListTools;
+import com.x.base.core.project.tools.StringTools;
+
+public abstract class CacheManager {
+
+	private static Logger logger = LoggerFactory.getLogger(CacheManager.class);
+
+	private CacheManager() {
+	}
+
+	private static Cache cache;
+
+	private static String name = StringTools.uniqueToken();
+
+	public static void setName(String name) {
+		CacheManager.name = name;
+	}
+
+	private static synchronized Cache cache() throws Exception {
+		if (null == cache) {
+			if (StringUtils.equals(Config.cache().getType(), Cache.TYPE_REDIS)) {
+				cache = new CacheRedisImpl(name);
+			} else {
+				cache = new CacheEhcacheImpl(name);
+			}
+		}
+		return cache;
+	}
+
+	public static void put(CacheCategory category, CacheKey key, Object o) {
+		try {
+			cache().put(category, key, o);
+		} catch (Exception e) {
+			logger.error(e);
+		}
+	}
+
+	public static Optional<?> get(CacheCategory category, CacheKey key) {
+		try {
+			return cache().get(category, key);
+		} catch (Exception e) {
+			logger.error(e);
+		}
+		return Optional.empty();
+	}
+
+	public static void shutdown() {
+		try {
+			if (null != cache) {
+				cache.shutdown();
+			}
+		} catch (Exception e) {
+			logger.error(e);
+		}
+	}
+
+	public static void receive(WrapClearCacheRequest wi) {
+		try {
+			if (null != cache) {
+				cache.receive(wi);
+			}
+		} catch (Exception e) {
+			logger.error(e);
+		}
+	}
+
+	public static void notify(Class<?> clz, List<Object> keys) {
+		try {
+			if (null != cache) {
+				cache.notify(clz, keys);
+			}
+		} catch (Exception e) {
+			logger.error(e);
+		}
+	}
+
+	public static void notify(Class<?> clz) throws Exception {
+		try {
+			if (null != cache) {
+				cache.notify(clz, new ArrayList<Object>());
+			}
+		} catch (Exception e) {
+			logger.error(e);
+		}
+	}
+
+	public static void notify(Class<?> clz, Object... objects) throws Exception {
+		try {
+			if (null != cache) {
+				cache.notify(clz, ListTools.toList(objects));
+			}
+		} catch (Exception e) {
+			logger.error(e);
+		}
+	}
+}

+ 99 - 0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/cache/CacheRedisImpl.java

@@ -0,0 +1,99 @@
+package com.x.base.core.project.cache;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.List;
+import java.util.Optional;
+import java.util.concurrent.LinkedBlockingQueue;
+
+import org.apache.commons.lang3.StringUtils;
+
+import com.x.base.core.project.config.Cache.Redis;
+import com.x.base.core.project.config.Config;
+import com.x.base.core.project.jaxrs.WrapClearCacheRequest;
+
+import redis.clients.jedis.Jedis;
+import redis.clients.jedis.params.SetParams;
+
+public class CacheRedisImpl implements Cache {
+
+	private LinkedBlockingQueue<WrapClearCacheRequest> notifyQueue;
+
+	private Jedis jedis;
+
+	private String application;
+
+	private SetParams setParams;
+
+	private CacheRedisNotifyThread notifyThread;
+
+	public CacheRedisImpl(String application) throws Exception {
+		Redis redis = Config.cache().getRedis();
+		this.jedis = new Jedis(redis.getHost(), redis.getPort(), redis.getConnectionTimeout(), redis.getSocketTimeout(),
+				redis.getSslEnable());
+		if (StringUtils.isNotBlank(redis.getUser()) && StringUtils.isNotBlank(redis.getPassword())) {
+			this.jedis.auth(redis.getUser(), redis.getPassword());
+		} else if (StringUtils.isNotBlank(redis.getPassword())) {
+			this.jedis.auth(redis.getPassword());
+		}
+		jedis.select(redis.getIndex());
+		this.notifyQueue = new LinkedBlockingQueue<>();
+		this.application = application;
+		this.setParams = new SetParams();
+		this.setParams.px(1000 * 60 * 60);
+		this.notifyThread = new CacheRedisNotifyThread(jedis, notifyQueue);
+		this.notifyThread.start();
+	}
+
+	@Override
+	public void put(CacheCategory category, CacheKey key, Object o) throws Exception {
+		if (null != o) {
+			try (ByteArrayOutputStream baos = new ByteArrayOutputStream();
+					ObjectOutputStream oos = new ObjectOutputStream(baos)) {
+				oos.writeObject(o);
+				byte[] bytes = baos.toByteArray();
+				jedis.set(concrete(category, key).getBytes(StandardCharsets.UTF_8), bytes, setParams);
+			}
+		}
+	}
+
+	@Override
+	public Optional<Object> get(CacheCategory category, CacheKey key) throws Exception {
+		try (ByteArrayInputStream bais = new ByteArrayInputStream(
+				jedis.get(concrete(category, key).getBytes(StandardCharsets.UTF_8)));
+				ObjectInputStream ois = new ObjectInputStream(bais)) {
+			return Optional.ofNullable(ois.readObject());
+		}
+	}
+
+	@Override
+	public void shutdown() {
+		this.notifyThread.interrupt();
+		this.jedis.close();
+	}
+
+	@Override
+	public void receive(WrapClearCacheRequest wi) throws Exception {
+		// nothing
+	}
+
+	@Override
+	public void notify(Class<?> clz, List<Object> keys) throws Exception {
+		Wi wi = new Wi();
+		wi.setClassName(clz.getName());
+		wi.setKeys(keys);
+		this.notifyQueue.put(wi);
+	}
+
+	private String concrete(CacheCategory category, CacheKey key) {
+		return this.application + "&" + category.toString() + "&" + key.toString();
+	}
+
+	public static class Wi extends WrapClearCacheRequest {
+
+	}
+
+}

+ 47 - 0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/cache/CacheRedisNotifyThread.java

@@ -0,0 +1,47 @@
+package com.x.base.core.project.cache;
+
+import java.util.Set;
+import java.util.concurrent.LinkedBlockingQueue;
+
+import com.x.base.core.project.cache.Cache.CacheCategory;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.gson.XGsonBuilder;
+import com.x.base.core.project.jaxrs.WrapClearCacheRequest;
+
+import redis.clients.jedis.Jedis;
+
+public class CacheRedisNotifyThread extends Thread {
+
+	public CacheRedisNotifyThread(Jedis jedis, LinkedBlockingQueue<WrapClearCacheRequest> queue) {
+		this.jedis = jedis;
+		this.queue = queue;
+	}
+
+	private Jedis jedis;
+
+	private LinkedBlockingQueue<WrapClearCacheRequest> queue;
+
+	@Override
+	public void run() {
+		while (!isInterrupted()) {
+			try {
+				WrapClearCacheRequest wi = queue.take();
+//				String pattern = "^([\\s\\S]*)\\&(([\\s\\S]*)(" + new CacheCategory(wi.getClassName()).toString()
+//						+ ")(([\\s\\S]*)\\&))($|(([\\s\\S]*)" + new CacheKey(wi.getKeys()).toString()
+//						+ "([\\s\\S]*)$))";
+				String match = "*&*" + new CacheCategory(wi.getClassName()).toString() + "*&*"
+						+ new CacheKey(wi.getKeys()).toString() + "*";
+				Set<String> keys = jedis.keys(match);
+				if (!keys.isEmpty()) {
+					jedis.del(keys.toArray(new String[] {}));
+					jedis.flushDB();
+				}
+			} catch (InterruptedException ie) {
+				break;
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		}
+	}
+
+}

+ 12 - 0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/cache/TestClient.java

@@ -0,0 +1,12 @@
+package com.x.base.core.project.cache;
+
+import net.fortuna.ical4j.util.Optional;
+
+public class TestClient {
+
+	public static void main(String... strings) {
+		Optional<?> o =  Optional.ofNullable(null);
+		System.out.println(o);
+		System.out.println(o.isPresent());
+	}
+}

+ 152 - 0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Cache.java

@@ -0,0 +1,152 @@
+package com.x.base.core.project.config;
+
+import org.apache.commons.lang3.BooleanUtils;
+import org.apache.commons.lang3.StringUtils;
+
+import com.x.base.core.project.annotation.FieldDescribe;
+import com.x.base.core.project.tools.NumberTools;
+
+public class Cache extends ConfigObject {
+
+	public static final String TYPE_EHCACHE = "ehcache";
+	public static final String TYPE_REDIS = "redis";
+
+	public static Cache defaultInstance() {
+		return new Cache();
+	}
+
+	public Cache() {
+		this.type = TYPE_EHCACHE;
+		this.redis = Redis.defaultInstance();
+		this.ehcache = Ehcache.defaultInstance();
+	}
+
+	public String getType() {
+		return StringUtils.equals(this.type, TYPE_EHCACHE) ? TYPE_EHCACHE : TYPE_REDIS;
+	}
+
+	@FieldDescribe("缓存类型:ehcache,type")
+	private String type;
+
+	@FieldDescribe("redis配置")
+	private Redis redis;
+
+	@FieldDescribe("ehcache配置")
+	private Ehcache ehcache;
+
+	public Redis getRedis() {
+		return this.redis == null ? new Redis() : this.redis;
+	}
+
+	public Ehcache getEhcache() {
+		return this.redis == null ? new Ehcache() : this.ehcache;
+	}
+
+	public static class Redis extends ConfigObject {
+		private static final long serialVersionUID = 1L;
+		public static final String DEFAULT_HOST = "127.0.0.1";
+		public static final Integer DEFAULT_PORT = 6379;
+		public static final String DEFAULT_USER = "";
+		public static final String DEFAULT_PASSWORD = "";
+		public static final Integer DEFAULT_CONNECTIONTIMEOUT = 3000;
+		public static final Integer DEFAULT_SOCKETTIMEOUT = 3000;
+		public static final Boolean DEFAULT_SSLENABLE = false;
+		public static final Boolean DEFAULT_JMXENABLE = false;
+		public static final Integer DEFAULT_INDEX = 0;
+
+		public static Redis defaultInstance() {
+			return new Redis();
+		}
+
+		public Redis() {
+			this.host = DEFAULT_HOST;
+			this.port = DEFAULT_PORT;
+			this.connectionTimeout = DEFAULT_CONNECTIONTIMEOUT;
+			this.socketTimeout = DEFAULT_SOCKETTIMEOUT;
+			this.sslEnable = DEFAULT_SSLENABLE;
+			this.user = DEFAULT_USER;
+			this.password = DEFAULT_PASSWORD;
+			this.index = DEFAULT_INDEX;
+
+		}
+
+		@FieldDescribe("redis服务器地址")
+		private String host;
+
+		@FieldDescribe("redis服务器端口")
+		private Integer port;
+
+		@FieldDescribe("认证用户")
+		private String user;
+
+		@FieldDescribe("认证口令")
+		private String password;
+
+		@FieldDescribe("连接等待时间")
+		private Integer connectionTimeout;
+
+		@FieldDescribe("response返回等待时间")
+		private Integer socketTimeout;
+
+		@FieldDescribe("是否启用ssl")
+		private Boolean sslEnable;
+
+		@FieldDescribe("数据库编号")
+		private Integer index;
+
+		public String getHost() {
+			return StringUtils.isBlank(this.host) ? DEFAULT_HOST : this.host;
+		}
+
+		public Integer getPort() {
+			return NumberTools.nullOrLessThan(this.port, 0) ? DEFAULT_PORT : this.port;
+		}
+
+		public Integer getConnectionTimeout() {
+			return NumberTools.nullOrLessThan(this.connectionTimeout, 0) ? DEFAULT_CONNECTIONTIMEOUT
+					: this.connectionTimeout;
+		}
+
+		public Integer getSocketTimeout() {
+			return NumberTools.nullOrLessThan(this.socketTimeout, 0) ? DEFAULT_SOCKETTIMEOUT : this.socketTimeout;
+		}
+
+		public Boolean getSslEnable() {
+			return BooleanUtils.isTrue(sslEnable);
+		}
+
+		public String getUser() {
+			return StringUtils.isBlank(this.user) ? DEFAULT_USER : this.user;
+		}
+
+		public String getPassword() {
+			return StringUtils.isBlank(this.password) ? DEFAULT_PASSWORD : this.password;
+		}
+
+		public Integer getIndex() {
+			return NumberTools.nullOrLessThan(this.index, 0) ? DEFAULT_INDEX : this.index;
+		}
+
+	}
+
+	public static class Ehcache extends ConfigObject {
+		private static final long serialVersionUID = 1L;
+		public static final Boolean DEFAULT_JMXENABLE = false;
+
+		public static Ehcache defaultInstance() {
+			return new Ehcache();
+		}
+
+		public Ehcache() {
+			this.jmxEnable = DEFAULT_JMXENABLE;
+		}
+
+		@FieldDescribe("是否启用jmx")
+		private Boolean jmxEnable;
+
+		public Boolean getJmxEnable() {
+			return BooleanUtils.isTrue(jmxEnable);
+		}
+	}
+
+}

+ 14 - 0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/config/Config.java

@@ -75,6 +75,7 @@ public class Config {
 	public static final String PATH_CONFIG_COMMUNICATE = "config/communicate.json";
 	public static final String PATH_CONFIG_EXMAIL = "config/exmail.json";
 	public static final String PATH_CONFIG_PORTAL = "config/portal.json";
+	public static final String PATH_CONFIG_CACHE = "config/cache.json";
 	public static final String PATH_CONFIG_COMPONENTS = "config/components.json";
 
 	public static final String DIR_COMMONS = "commons";
@@ -1262,6 +1263,19 @@ public class Config {
 		return instance().portal;
 	}
 
+	public Cache cache;
+
+	public static synchronized Cache cache() throws Exception {
+		if (null == instance().cache) {
+			Cache obj = BaseTools.readConfigObject(PATH_CONFIG_CACHE, Cache.class);
+			if (null == obj) {
+				obj = Cache.defaultInstance();
+			}
+			instance().cache = obj;
+		}
+		return instance().cache;
+	}
+
 	private Components components = null;
 
 	public static Components components() throws Exception {

+ 2 - 1
o2server/x_base_core_project/src/main/java/com/x/base/core/project/jaxrs/WrapClearCacheRequest.java

@@ -1,5 +1,6 @@
 package com.x.base.core.project.jaxrs;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import com.x.base.core.project.annotation.FieldDescribe;
@@ -25,7 +26,7 @@ public abstract class WrapClearCacheRequest extends GsonPropertyObject {
 	}
 
 	public List<Object> getKeys() {
-		return keys;
+		return null == keys ? new ArrayList<>() : keys;
 	}
 
 	public void setKeys(List<Object> keys) {

+ 3 - 0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/jaxrs/cache/ActionReceive.java

@@ -4,6 +4,7 @@ import javax.servlet.ServletContext;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.jaxrs.WrapClearCacheRequest;
@@ -27,9 +28,11 @@ class ActionReceive extends BaseAction {
 				ctx.clearCacheRequestQueue().send(wi);
 			} else {
 				ApplicationCache.receive(wi);
+				CacheManager.receive(wi);
 			}
 		} else {
 			ApplicationCache.receive(wi);
+			CacheManager.receive(wi);
 		}
 		result.setData(new Wo(wi.getClassName()));
 		return result;

+ 0 - 70
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/CacheFactory.java

@@ -1,70 +0,0 @@
-package com.x.organization.assemble.express;
-
-import com.x.base.core.project.cache.ApplicationCache;
-import com.x.organization.core.entity.Group;
-import com.x.organization.core.entity.Identity;
-import com.x.organization.core.entity.Person;
-import com.x.organization.core.entity.PersonAttribute;
-import com.x.organization.core.entity.Role;
-import com.x.organization.core.entity.Unit;
-import com.x.organization.core.entity.UnitAttribute;
-import com.x.organization.core.entity.UnitDuty;
-import com.x.organization.core.entity.accredit.Empower;
-
-import net.sf.ehcache.Ehcache;
-
-public class CacheFactory {
-
-	public static Ehcache getOrganizationCache() {
-		return ApplicationCache.instance().getCache(Identity.class, Unit.class, UnitAttribute.class, UnitDuty.class,
-				Role.class, Person.class, PersonAttribute.class, Group.class, Empower.class);
-	}
-
-	public static Ehcache getIdentityCache() {
-		return ApplicationCache.instance().getCache(Identity.class);
-	}
-
-	public static Ehcache getUnitCache() {
-		return ApplicationCache.instance().getCache(Unit.class);
-	}
-
-	public static Ehcache getTrustCache() {
-		return ApplicationCache.instance().getCache(Empower.class);
-	}
-
-	public static Ehcache getUnitAttributeCache() {
-		return ApplicationCache.instance().getCache(UnitAttribute.class);
-	}
-
-	public static Ehcache getUnitDutyCache() {
-		return ApplicationCache.instance().getCache(UnitDuty.class);
-	}
-
-	public static Ehcache getRoleCache() {
-		return ApplicationCache.instance().getCache(Role.class);
-	}
-
-	public static Ehcache getPersonCache() {
-		return ApplicationCache.instance().getCache(Person.class);
-	}
-
-	public static Ehcache getPersonAttributeCache() {
-		return ApplicationCache.instance().getCache(PersonAttribute.class);
-	}
-
-	public static Ehcache getGroupCache() {
-		return ApplicationCache.instance().getCache(Group.class);
-	}
-
-	public static void cacheNotifyAll() throws Exception {
-		ApplicationCache.notify(Person.class);
-		ApplicationCache.notify(PersonAttribute.class);
-		ApplicationCache.notify(Identity.class);
-		ApplicationCache.notify(Unit.class);
-		ApplicationCache.notify(UnitAttribute.class);
-		ApplicationCache.notify(UnitDuty.class);
-		ApplicationCache.notify(Group.class);
-		ApplicationCache.notify(Role.class);
-		ApplicationCache.notify(Empower.class);
-	}
-}

+ 3 - 0
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/ThisApplication.java

@@ -1,6 +1,7 @@
 package com.x.organization.assemble.express;
 
 import com.x.base.core.project.Context;
+import com.x.base.core.project.cache.CacheManager;
 
 public class ThisApplication {
 
@@ -12,6 +13,7 @@ public class ThisApplication {
 
 	public static void init() {
 		try {
+			CacheManager.setName(context.clazz().getSimpleName());
 		} catch (Exception e) {
 			e.printStackTrace();
 		}
@@ -19,6 +21,7 @@ public class ThisApplication {
 
 	public static void destroy() {
 		try {
+			CacheManager.shutdown();
 		} catch (Exception e) {
 			e.printStackTrace();
 		}

+ 17 - 18
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/factory/GroupFactory.java

@@ -3,6 +3,7 @@ package com.x.organization.assemble.express.factory;
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.List;
+import java.util.Optional;
 import java.util.regex.Matcher;
 import java.util.stream.Collectors;
 
@@ -16,25 +17,23 @@ import org.apache.commons.collections4.set.ListOrderedSet;
 import org.apache.commons.lang3.StringUtils;
 
 import com.x.base.core.entity.JpaObject;
+import com.x.base.core.project.cache.Cache.CacheCategory;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.exception.ExceptionWhen;
 import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.AbstractFactory;
 import com.x.organization.assemble.express.Business;
-import com.x.organization.assemble.express.CacheFactory;
 import com.x.organization.core.entity.Group;
 import com.x.organization.core.entity.Group_;
 import com.x.organization.core.entity.Person;
 
-import net.sf.ehcache.Ehcache;
-import net.sf.ehcache.Element;
-
 public class GroupFactory extends AbstractFactory {
 
-	private Ehcache cache;
+	private CacheCategory cacheCategory = new CacheCategory(Group.class);
 
 	public GroupFactory(Business business) throws Exception {
 		super(business);
-		this.cache = CacheFactory.getGroupCache();
 	}
 
 	public Group pick(String flag) throws Exception {
@@ -42,14 +41,15 @@ public class GroupFactory extends AbstractFactory {
 			return null;
 		}
 		Group o = null;
-		Element element = cache.get(flag);
-		if (null != element) {
-			if (null != element.getObjectValue()) {
-				o = (Group) element.getObjectValue();
-			}
+		CacheKey cacheKey = new CacheKey(flag);
+		Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+		if (optional.isPresent()) {
+			o = (Group) optional.get();
 		} else {
 			o = this.pickObject(flag);
-			cache.put(new Element(flag, o));
+			if (o != null) {
+				CacheManager.put(cacheCategory, cacheKey, o);
+			}
 		}
 		return o;
 	}
@@ -57,15 +57,14 @@ public class GroupFactory extends AbstractFactory {
 	public List<Group> pick(List<String> flags) throws Exception {
 		List<Group> list = new ArrayList<>();
 		for (String str : flags) {
-			Element element = cache.get(str);
-			if (null != element) {
-				if (null != element.getObjectValue()) {
-					list.add((Group) element.getObjectValue());
-				}
+			CacheKey cacheKey = new CacheKey(str);
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				list.add((Group) optional.get());
 			} else {
 				Group o = this.pickObject(str);
-				cache.put(new Element(str, o));
 				if (null != o) {
+					CacheManager.put(cacheCategory, cacheKey, o);
 					list.add(o);
 				}
 			}

+ 29 - 28
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/factory/IdentityFactory.java

@@ -15,28 +15,26 @@ import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
-import com.x.base.core.project.config.Config;
 import org.apache.commons.lang3.BooleanUtils;
 import org.apache.commons.lang3.StringUtils;
 
 import com.x.base.core.entity.JpaObject;
+import com.x.base.core.project.cache.Cache.CacheCategory;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
+import com.x.base.core.project.config.Config;
 import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.AbstractFactory;
 import com.x.organization.assemble.express.Business;
-import com.x.organization.assemble.express.CacheFactory;
 import com.x.organization.core.entity.Identity;
 import com.x.organization.core.entity.Identity_;
 
-import net.sf.ehcache.Ehcache;
-import net.sf.ehcache.Element;
-
 public class IdentityFactory extends AbstractFactory {
 
-	private Ehcache cache;
+	private CacheCategory cacheCategory = new CacheCategory(Identity.class);
 
 	public IdentityFactory(Business business) throws Exception {
 		super(business);
-		this.cache = CacheFactory.getIdentityCache();
 	}
 
 	public Identity pick(String flag) throws Exception {
@@ -44,14 +42,15 @@ public class IdentityFactory extends AbstractFactory {
 			return null;
 		}
 		Identity o = null;
-		Element element = cache.get(flag);
-		if (null != element) {
-			if (null != element.getObjectValue()) {
-				o = (Identity) element.getObjectValue();
-			}
+		CacheKey cacheKey = new CacheKey(flag);
+		Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+		if (optional.isPresent()) {
+			o = (Identity) optional.get();
 		} else {
 			o = this.pickObject(flag);
-			cache.put(new Element(flag, o));
+			if (null != o) {
+				CacheManager.put(cacheCategory, cacheKey, o);
+			}
 		}
 		return o;
 	}
@@ -90,15 +89,14 @@ public class IdentityFactory extends AbstractFactory {
 	public List<Identity> pick(List<String> flags) throws Exception {
 		List<Identity> list = new ArrayList<>();
 		for (String str : flags) {
-			Element element = cache.get(str);
-			if (null != element) {
-				if (null != element.getObjectValue()) {
-					list.add((Identity) element.getObjectValue());
-				}
+			CacheKey cacheKey = new CacheKey(str);
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				list.add((Identity) optional.get());
 			} else {
 				Identity o = this.pickObject(str);
-				cache.put(new Element(str, o));
 				if (null != o) {
+					CacheManager.put(cacheCategory, cacheKey, o);
 					list.add(o);
 				}
 			}
@@ -106,7 +104,7 @@ public class IdentityFactory extends AbstractFactory {
 		return list;
 	}
 
-	public List<Identity> listByPerson(String personId) throws Exception{
+	public List<Identity> listByPerson(String personId) throws Exception {
 		EntityManager em = this.entityManagerContainer().get(Identity.class);
 		CriteriaBuilder cb = em.getCriteriaBuilder();
 		CriteriaQuery<Identity> cq = cb.createQuery(Identity.class);
@@ -117,15 +115,18 @@ public class IdentityFactory extends AbstractFactory {
 	}
 
 	public <T extends Identity> List<T> sort(List<T> list) throws Exception {
-		if(Config.person().getPersonUnitOrderByAsc()) {
-			list = list.stream().sorted(
-					Comparator.comparing(Identity::getOrderNumber, Comparator.nullsLast(Integer::compareTo)).thenComparing(
-							Comparator.comparing(Identity::getName, Comparator.nullsFirst(String::compareTo)).reversed()))
+		if (Config.person().getPersonUnitOrderByAsc()) {
+			list = list.stream()
+					.sorted(Comparator.comparing(Identity::getOrderNumber, Comparator.nullsLast(Integer::compareTo))
+							.thenComparing(Comparator
+									.comparing(Identity::getName, Comparator.nullsFirst(String::compareTo)).reversed()))
 					.collect(Collectors.toList());
-		}else{
-			list = list.stream().sorted(
-					Comparator.comparing(Identity::getOrderNumber, Comparator.nullsLast(Integer::compareTo)).reversed()
-					.thenComparing(Comparator.comparing(Identity::getName, Comparator.nullsFirst(String::compareTo)).reversed()))
+		} else {
+			list = list.stream()
+					.sorted(Comparator.comparing(Identity::getOrderNumber, Comparator.nullsLast(Integer::compareTo))
+							.reversed()
+							.thenComparing(Comparator
+									.comparing(Identity::getName, Comparator.nullsFirst(String::compareTo)).reversed()))
 					.collect(Collectors.toList());
 		}
 		return list;

+ 17 - 18
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/factory/PersonAttributeFactory.java

@@ -3,6 +3,7 @@ package com.x.organization.assemble.express.factory;
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.List;
+import java.util.Optional;
 import java.util.regex.Matcher;
 import java.util.stream.Collectors;
 
@@ -14,22 +15,20 @@ import javax.persistence.criteria.Root;
 
 import org.apache.commons.lang3.StringUtils;
 
+import com.x.base.core.project.cache.Cache.CacheCategory;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.organization.assemble.express.AbstractFactory;
 import com.x.organization.assemble.express.Business;
-import com.x.organization.assemble.express.CacheFactory;
 import com.x.organization.core.entity.PersonAttribute;
 import com.x.organization.core.entity.PersonAttribute_;
 
-import net.sf.ehcache.Ehcache;
-import net.sf.ehcache.Element;
-
 public class PersonAttributeFactory extends AbstractFactory {
 
-	private Ehcache cache;
+	private CacheCategory cacheCategory = new CacheCategory(PersonAttribute.class);
 
 	public PersonAttributeFactory(Business business) throws Exception {
 		super(business);
-		this.cache = CacheFactory.getPersonAttributeCache();
 	}
 
 	public PersonAttribute pick(String flag) throws Exception {
@@ -37,14 +36,15 @@ public class PersonAttributeFactory extends AbstractFactory {
 			return null;
 		}
 		PersonAttribute o = null;
-		Element element = cache.get(flag);
-		if (null != element) {
-			if (null != element.getObjectValue()) {
-				o = (PersonAttribute) element.getObjectValue();
-			}
+		CacheKey cacheKey = new CacheKey(flag);
+		Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+		if (optional.isPresent()) {
+			o = (PersonAttribute) optional.get();
 		} else {
 			o = this.pickObject(flag);
-			cache.put(new Element(flag, o));
+			if (null != o) {
+				CacheManager.put(cacheCategory, cacheKey, o);
+			}
 		}
 		return o;
 	}
@@ -83,15 +83,14 @@ public class PersonAttributeFactory extends AbstractFactory {
 	public List<PersonAttribute> pick(List<String> flags) throws Exception {
 		List<PersonAttribute> list = new ArrayList<>();
 		for (String str : flags) {
-			Element element = cache.get(str);
-			if (null != element) {
-				if (null != element.getObjectValue()) {
-					list.add((PersonAttribute) element.getObjectValue());
-				}
+			CacheKey cacheKey = new CacheKey(str);
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				list.add((PersonAttribute) optional.get());
 			} else {
 				PersonAttribute o = this.pickObject(str);
-				cache.put(new Element(str, o));
 				if (null != o) {
+					CacheManager.put(cacheCategory, cacheKey, o);
 					list.add(o);
 				}
 			}

+ 17 - 18
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/factory/PersonFactory.java

@@ -3,6 +3,7 @@ package com.x.organization.assemble.express.factory;
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.List;
+import java.util.Optional;
 import java.util.regex.Matcher;
 import java.util.stream.Collectors;
 
@@ -15,23 +16,21 @@ import javax.persistence.criteria.Root;
 import org.apache.commons.lang3.StringUtils;
 
 import com.x.base.core.entity.JpaObject;
+import com.x.base.core.project.cache.Cache.CacheCategory;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.AbstractFactory;
 import com.x.organization.assemble.express.Business;
-import com.x.organization.assemble.express.CacheFactory;
 import com.x.organization.core.entity.Person;
 import com.x.organization.core.entity.Person_;
 
-import net.sf.ehcache.Ehcache;
-import net.sf.ehcache.Element;
-
 public class PersonFactory extends AbstractFactory {
 
-	private Ehcache cache;
+	private CacheCategory cacheCategory = new CacheCategory(Person.class);
 
 	public PersonFactory(Business business) throws Exception {
 		super(business);
-		this.cache = CacheFactory.getPersonCache();
 	}
 
 	public Person pick(String flag) throws Exception {
@@ -39,14 +38,15 @@ public class PersonFactory extends AbstractFactory {
 			return null;
 		}
 		Person o = null;
-		Element element = cache.get(flag);
-		if (null != element) {
-			if (null != element.getObjectValue()) {
-				o = (Person) element.getObjectValue();
-			}
+		CacheKey cacheKey = new CacheKey(flag);
+		Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+		if (optional.isPresent()) {
+			o = (Person) optional.get();
 		} else {
 			o = this.pickObject(flag);
-			cache.put(new Element(flag, o));
+			if (null != o) {
+				CacheManager.put(cacheCategory, cacheKey, o);
+			}
 		}
 		return o;
 	}
@@ -88,15 +88,14 @@ public class PersonFactory extends AbstractFactory {
 	public List<Person> pick(List<String> flags) throws Exception {
 		List<Person> list = new ArrayList<>();
 		for (String str : ListTools.trim(flags, true, false)) {
-			Element element = cache.get(str);
-			if (null != element) {
-				if (null != element.getObjectValue()) {
-					list.add((Person) element.getObjectValue());
-				}
+			CacheKey cacheKey = new CacheKey(str);
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				list.add((Person) optional.get());
 			} else {
 				Person o = this.pickObject(str);
-				cache.put(new Element(str, o));
 				if (null != o) {
+					CacheManager.put(cacheCategory, cacheKey, o);
 					list.add(o);
 				}
 			}

+ 17 - 18
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/factory/RoleFactory.java

@@ -3,6 +3,7 @@ package com.x.organization.assemble.express.factory;
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.List;
+import java.util.Optional;
 import java.util.regex.Matcher;
 import java.util.stream.Collectors;
 
@@ -15,23 +16,21 @@ import javax.persistence.criteria.Root;
 import org.apache.commons.lang3.StringUtils;
 
 import com.x.base.core.entity.JpaObject;
+import com.x.base.core.project.cache.Cache.CacheCategory;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.AbstractFactory;
 import com.x.organization.assemble.express.Business;
-import com.x.organization.assemble.express.CacheFactory;
 import com.x.organization.core.entity.Role;
 import com.x.organization.core.entity.Role_;
 
-import net.sf.ehcache.Ehcache;
-import net.sf.ehcache.Element;
-
 public class RoleFactory extends AbstractFactory {
 
-	private Ehcache cache;
+	private CacheCategory cacheCategory = new CacheCategory(Role.class);
 
 	public RoleFactory(Business business) throws Exception {
 		super(business);
-		this.cache = CacheFactory.getRoleCache();
 	}
 
 	public Role pick(String flag) throws Exception {
@@ -39,14 +38,15 @@ public class RoleFactory extends AbstractFactory {
 			return null;
 		}
 		Role o = null;
-		Element element = cache.get(flag);
-		if (null != element) {
-			if (null != element.getObjectValue()) {
-				o = (Role) element.getObjectValue();
-			}
+		CacheKey cacheKey = new CacheKey(flag);
+		Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+		if (optional.isPresent()) {
+			o = (Role) optional.get();
 		} else {
 			o = this.pickObject(flag);
-			cache.put(new Element(flag, o));
+			if (null != o) {
+				CacheManager.put(cacheCategory, cacheKey, o);
+			}
 		}
 		return o;
 	}
@@ -85,15 +85,14 @@ public class RoleFactory extends AbstractFactory {
 	public List<Role> pick(List<String> flags) throws Exception {
 		List<Role> list = new ArrayList<>();
 		for (String str : flags) {
-			Element element = cache.get(str);
-			if (null != element) {
-				if (null != element.getObjectValue()) {
-					list.add((Role) element.getObjectValue());
-				}
+			CacheKey cacheKey = new CacheKey(str);
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				list.add((Role) optional.get());
 			} else {
 				Role o = this.pickObject(str);
-				cache.put(new Element(str, o));
 				if (null != o) {
+					CacheManager.put(cacheCategory, cacheKey, o);
 					list.add(o);
 				}
 			}

+ 0 - 6
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/factory/TrustFactory.java

@@ -2,17 +2,11 @@ package com.x.organization.assemble.express.factory;
 
 import com.x.organization.assemble.express.AbstractFactory;
 import com.x.organization.assemble.express.Business;
-import com.x.organization.assemble.express.CacheFactory;
-
-import net.sf.ehcache.Ehcache;
 
 public class TrustFactory extends AbstractFactory {
 
-	private Ehcache cache;
-
 	public TrustFactory(Business business) throws Exception {
 		super(business);
-		this.cache = CacheFactory.getTrustCache();
 	}
 
 }

+ 17 - 18
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/factory/UnitAttributeFactory.java

@@ -3,6 +3,7 @@ package com.x.organization.assemble.express.factory;
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.List;
+import java.util.Optional;
 import java.util.regex.Matcher;
 import java.util.stream.Collectors;
 
@@ -14,22 +15,20 @@ import javax.persistence.criteria.Root;
 
 import org.apache.commons.lang3.StringUtils;
 
+import com.x.base.core.project.cache.Cache.CacheCategory;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.organization.assemble.express.AbstractFactory;
 import com.x.organization.assemble.express.Business;
-import com.x.organization.assemble.express.CacheFactory;
 import com.x.organization.core.entity.UnitAttribute;
 import com.x.organization.core.entity.UnitAttribute_;
 
-import net.sf.ehcache.Ehcache;
-import net.sf.ehcache.Element;
-
 public class UnitAttributeFactory extends AbstractFactory {
 
-	private Ehcache cache;
+	private CacheCategory cacheCategory = new CacheCategory(UnitAttribute.class);
 
 	public UnitAttributeFactory(Business business) throws Exception {
 		super(business);
-		this.cache = CacheFactory.getUnitAttributeCache();
 	}
 
 	public UnitAttribute pick(String flag) throws Exception {
@@ -37,14 +36,15 @@ public class UnitAttributeFactory extends AbstractFactory {
 			return null;
 		}
 		UnitAttribute o = null;
-		Element element = cache.get(flag);
-		if (null != element) {
-			if (null != element.getObjectValue()) {
-				o = (UnitAttribute) element.getObjectValue();
-			}
+		CacheKey cacheKey = new CacheKey(flag);
+		Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+		if (optional.isPresent()) {
+			o = (UnitAttribute) optional.get();
 		} else {
 			o = this.pickObject(flag);
-			cache.put(new Element(flag, o));
+			if (null != o) {
+				CacheManager.put(cacheCategory, cacheKey, o);
+			}
 		}
 		return o;
 	}
@@ -83,15 +83,14 @@ public class UnitAttributeFactory extends AbstractFactory {
 	public List<UnitAttribute> pick(List<String> flags) throws Exception {
 		List<UnitAttribute> list = new ArrayList<>();
 		for (String str : flags) {
-			Element element = cache.get(str);
-			if (null != element) {
-				if (null != element.getObjectValue()) {
-					list.add((UnitAttribute) element.getObjectValue());
-				}
+			CacheKey cacheKey = new CacheKey(str);
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				list.add((UnitAttribute) optional.get());
 			} else {
 				UnitAttribute o = this.pickObject(str);
-				cache.put(new Element(str, o));
 				if (null != o) {
+					CacheManager.put(cacheCategory, cacheKey, o);
 					list.add(o);
 				}
 			}

+ 17 - 18
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/factory/UnitDutyFactory.java

@@ -3,6 +3,7 @@ package com.x.organization.assemble.express.factory;
 import java.util.ArrayList;
 import java.util.Comparator;
 import java.util.List;
+import java.util.Optional;
 import java.util.regex.Matcher;
 import java.util.stream.Collectors;
 
@@ -14,22 +15,20 @@ import javax.persistence.criteria.Root;
 
 import org.apache.commons.lang3.StringUtils;
 
+import com.x.base.core.project.cache.Cache.CacheCategory;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.organization.assemble.express.AbstractFactory;
 import com.x.organization.assemble.express.Business;
-import com.x.organization.assemble.express.CacheFactory;
 import com.x.organization.core.entity.UnitDuty;
 import com.x.organization.core.entity.UnitDuty_;
 
-import net.sf.ehcache.Ehcache;
-import net.sf.ehcache.Element;
-
 public class UnitDutyFactory extends AbstractFactory {
 
-	private Ehcache cache;
+	private CacheCategory cacheCategory = new CacheCategory(UnitDuty.class);
 
 	public UnitDutyFactory(Business business) throws Exception {
 		super(business);
-		this.cache = CacheFactory.getUnitDutyCache();
 	}
 
 	public UnitDuty pick(String flag) throws Exception {
@@ -37,14 +36,15 @@ public class UnitDutyFactory extends AbstractFactory {
 			return null;
 		}
 		UnitDuty o = null;
-		Element element = cache.get(flag);
-		if (null != element) {
-			if (null != element.getObjectValue()) {
-				o = (UnitDuty) element.getObjectValue();
-			}
+		CacheKey cacheKey = new CacheKey(flag);
+		Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+		if (optional.isPresent()) {
+			o = (UnitDuty) optional.get();
 		} else {
 			o = this.pickObject(flag);
-			cache.put(new Element(flag, o));
+			if (null != o) {
+				CacheManager.put(cacheCategory, cacheKey, o);
+			}
 		}
 		return o;
 	}
@@ -83,15 +83,14 @@ public class UnitDutyFactory extends AbstractFactory {
 	public List<UnitDuty> pick(List<String> flags) throws Exception {
 		List<UnitDuty> list = new ArrayList<>();
 		for (String str : flags) {
-			Element element = cache.get(str);
-			if (null != element) {
-				if (null != element.getObjectValue()) {
-					list.add((UnitDuty) element.getObjectValue());
-				}
+			CacheKey cacheKey = new CacheKey(str);
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				list.add((UnitDuty) optional.get());
 			} else {
 				UnitDuty o = this.pickObject(str);
-				cache.put(new Element(str, o));
 				if (null != o) {
+					CacheManager.put(cacheCategory, cacheKey, o);
 					list.add(o);
 				}
 			}

+ 28 - 25
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/factory/UnitFactory.java

@@ -5,6 +5,7 @@ import java.util.Arrays;
 import java.util.Comparator;
 import java.util.List;
 import java.util.Objects;
+import java.util.Optional;
 import java.util.regex.Matcher;
 import java.util.stream.Collectors;
 
@@ -14,28 +15,26 @@ import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
-import com.x.base.core.project.config.Config;
 import org.apache.commons.lang3.StringUtils;
 
 import com.x.base.core.entity.JpaObject;
+import com.x.base.core.project.cache.Cache.CacheCategory;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
+import com.x.base.core.project.config.Config;
 import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.AbstractFactory;
 import com.x.organization.assemble.express.Business;
-import com.x.organization.assemble.express.CacheFactory;
 import com.x.organization.core.entity.PersistenceProperties;
 import com.x.organization.core.entity.Unit;
 import com.x.organization.core.entity.Unit_;
 
-import net.sf.ehcache.Ehcache;
-import net.sf.ehcache.Element;
-
 public class UnitFactory extends AbstractFactory {
 
-	private Ehcache cache;
+	private CacheCategory cacheCategory = new CacheCategory(Unit.class);
 
 	public UnitFactory(Business business) throws Exception {
 		super(business);
-		this.cache = CacheFactory.getUnitCache();
 	}
 
 	public Unit pick(String flag) throws Exception {
@@ -43,14 +42,15 @@ public class UnitFactory extends AbstractFactory {
 			return null;
 		}
 		Unit o = null;
-		Element element = cache.get(flag);
-		if (null != element) {
-			if (null != element.getObjectValue()) {
-				o = (Unit) element.getObjectValue();
-			}
+		CacheKey cacheKey = new CacheKey(flag);
+		Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+		if (optional.isPresent()) {
+			o = (Unit) optional.get();
 		} else {
 			o = this.pickObject(flag);
-			cache.put(new Element(flag, o));
+			if (null != o) {
+				CacheManager.put(cacheCategory, cacheKey, o);
+			}
 		}
 		return o;
 	}
@@ -106,15 +106,14 @@ public class UnitFactory extends AbstractFactory {
 	public List<Unit> pick(List<String> flags) throws Exception {
 		List<Unit> list = new ArrayList<>();
 		for (String str : flags) {
-			Element element = cache.get(str);
-			if (null != element) {
-				if (null != element.getObjectValue()) {
-					list.add((Unit) element.getObjectValue());
-				}
+			CacheKey cacheKey = new CacheKey(str);
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				list.add((Unit) optional.get());
 			} else {
 				Unit o = this.pickObject(str);
-				cache.put(new Element(str, o));
 				if (null != o) {
+					CacheManager.put(cacheCategory, cacheKey, o);
 					list.add(o);
 				}
 			}
@@ -123,15 +122,18 @@ public class UnitFactory extends AbstractFactory {
 	}
 
 	public <T extends Unit> List<T> sort(List<T> list) throws Exception {
-		if(Config.person().getPersonUnitOrderByAsc()) {
+		if (Config.person().getPersonUnitOrderByAsc()) {
 			list = list.stream().sorted(Comparator.comparing(Unit::getLevel, Comparator.nullsLast(Integer::compareTo))
 					.thenComparing(Comparator.comparing(Unit::getOrderNumber, Comparator.nullsLast(Integer::compareTo)))
-					.thenComparing(Comparator.comparing(Unit::getName, Comparator.nullsFirst(String::compareTo)).reversed()))
+					.thenComparing(
+							Comparator.comparing(Unit::getName, Comparator.nullsFirst(String::compareTo)).reversed()))
 					.collect(Collectors.toList());
-		}else{
+		} else {
 			list = list.stream().sorted(Comparator.comparing(Unit::getLevel, Comparator.nullsLast(Integer::compareTo))
-					.thenComparing(Comparator.comparing(Unit::getOrderNumber, Comparator.nullsLast(Integer::compareTo)).reversed())
-					.thenComparing(Comparator.comparing(Unit::getName, Comparator.nullsFirst(String::compareTo)).reversed()))
+					.thenComparing(Comparator.comparing(Unit::getOrderNumber, Comparator.nullsLast(Integer::compareTo))
+							.reversed())
+					.thenComparing(
+							Comparator.comparing(Unit::getName, Comparator.nullsFirst(String::compareTo)).reversed()))
 					.collect(Collectors.toList());
 		}
 		return list;
@@ -295,7 +297,8 @@ public class UnitFactory extends AbstractFactory {
 		CriteriaQuery<String> cq = cb.createQuery(String.class);
 		Root<Unit> root = cq.from(Unit.class);
 		Predicate p = cb.equal(root.get(Unit_.superior), unit.getId());
-		return em.createQuery(cq.select(root.get(Unit_.id)).where(p).orderBy(cb.asc(root.get(Unit_.orderNumber)))).getResultList();
+		return em.createQuery(cq.select(root.get(Unit_.id)).where(p).orderBy(cb.asc(root.get(Unit_.orderNumber))))
+				.getResultList();
 	}
 
 	public List<String> listUnitDistinguishedNameSorted(List<String> unitIds) throws Exception {

+ 2 - 7
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/empower/ActionListWithIdentityObject.java

@@ -5,7 +5,6 @@ import java.util.Comparator;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
-import java.util.Objects;
 import java.util.stream.Collectors;
 
 import javax.persistence.EntityManager;
@@ -14,6 +13,8 @@ import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
+import org.apache.commons.lang3.StringUtils;
+
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
@@ -25,8 +26,6 @@ import com.x.base.core.project.connection.ActionResponse;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
-import com.x.base.core.project.logger.Logger;
-import com.x.base.core.project.logger.LoggerFactory;
 import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.assemble.express.ThisApplication;
@@ -35,12 +34,8 @@ import com.x.organization.core.entity.accredit.Empower;
 import com.x.organization.core.entity.accredit.Empower_;
 import com.x.organization.core.entity.accredit.Filter;
 
-import org.apache.commons.lang3.StringUtils;
-
 class ActionListWithIdentityObject extends BaseAction {
 
-	private static Logger logger = LoggerFactory.getLogger(ActionListWithIdentityObject.class);
-
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);

+ 0 - 3
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/empower/BaseAction.java

@@ -9,11 +9,8 @@ import com.x.base.core.project.annotation.FieldDescribe;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.jaxrs.StandardJaxrsAction;
 import com.x.organization.assemble.express.Business;
-import com.x.organization.assemble.express.CacheFactory;
 import com.x.organization.core.entity.Unit;
 
-import net.sf.ehcache.Ehcache;
-
 class BaseAction extends StandardJaxrsAction {
 
 	static class WoUnitListAbstract extends GsonPropertyObject {

+ 0 - 4
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/empowerlog/ActionCreate.java

@@ -13,8 +13,6 @@ import com.x.base.core.project.bean.WrapCopierFactory;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.jaxrs.WrapBoolean;
-import com.x.base.core.project.logger.Logger;
-import com.x.base.core.project.logger.LoggerFactory;
 import com.x.base.core.project.tools.StringTools;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Identity;
@@ -23,8 +21,6 @@ import com.x.organization.core.entity.accredit.EmpowerLog;
 
 class ActionCreate extends BaseAction {
 
-	private static Logger logger = LoggerFactory.getLogger(ActionCreate.class);
-
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);

+ 0 - 5
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/empowerlog/BaseAction.java

@@ -9,15 +9,10 @@ import com.x.base.core.project.annotation.FieldDescribe;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.jaxrs.StandardJaxrsAction;
 import com.x.organization.assemble.express.Business;
-import com.x.organization.assemble.express.CacheFactory;
 import com.x.organization.core.entity.Unit;
 
-import net.sf.ehcache.Ehcache;
-
 class BaseAction extends StandardJaxrsAction {
 
-	Ehcache cache = CacheFactory.getOrganizationCache();
-
 	static class WoUnitListAbstract extends GsonPropertyObject {
 
 		@FieldDescribe("组织识别名")

+ 8 - 9
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/ActionHasRole.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.group;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -16,7 +17,8 @@ import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.entity.JpaObject;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -27,8 +29,6 @@ import com.x.organization.core.entity.Group;
 import com.x.organization.core.entity.Role;
 import com.x.organization.core.entity.Role_;
 
-import net.sf.ehcache.Element;
-
 class ActionHasRole extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -36,14 +36,13 @@ class ActionHasRole extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(), wi.getGroup(),
-					StringUtils.join(wi.getRoleList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getGroup(), wi.getRoleList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.get(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 8 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/ActionList.java

@@ -2,14 +2,14 @@ package com.x.organization.assemble.express.jaxrs.group;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -17,8 +17,6 @@ import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Group;
 
-import net.sf.ehcache.Element;
-
 class ActionList extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -26,14 +24,13 @@ class ActionList extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getGroupList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getGroupList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 9 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/ActionListObject.java

@@ -2,37 +2,35 @@ package com.x.organization.assemble.express.jaxrs.group;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Group;
 
-import net.sf.ehcache.Element;
-
 class ActionListObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getGroupList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getGroupList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 8 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/ActionListWithGroupSubDirect.java

@@ -2,14 +2,14 @@ package com.x.organization.assemble.express.jaxrs.group;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -17,8 +17,6 @@ import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Group;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithGroupSubDirect extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -26,14 +24,13 @@ class ActionListWithGroupSubDirect extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getGroupList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getGroupList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 9 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/ActionListWithGroupSubDirectObject.java

@@ -2,14 +2,14 @@ package com.x.organization.assemble.express.jaxrs.group;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -17,23 +17,21 @@ import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Group;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithGroupSubDirectObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getGroupList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getGroupList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 8 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/ActionListWithGroupSubNested.java

@@ -2,14 +2,14 @@ package com.x.organization.assemble.express.jaxrs.group;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -17,8 +17,6 @@ import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Group;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithGroupSubNested extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -26,14 +24,13 @@ class ActionListWithGroupSubNested extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getGroupList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getGroupList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 9 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/ActionListWithGroupSubNestedObject.java

@@ -2,14 +2,14 @@ package com.x.organization.assemble.express.jaxrs.group;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -17,23 +17,21 @@ import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Group;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithGroupSubNestedObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getGroupList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getGroupList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 8 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/ActionListWithGroupSupDirect.java

@@ -2,14 +2,14 @@ package com.x.organization.assemble.express.jaxrs.group;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -17,8 +17,6 @@ import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Group;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithGroupSupDirect extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -26,14 +24,13 @@ class ActionListWithGroupSupDirect extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getGroupList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getGroupList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 9 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/ActionListWithGroupSupDirectObject.java

@@ -2,14 +2,14 @@ package com.x.organization.assemble.express.jaxrs.group;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -17,23 +17,21 @@ import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Group;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithGroupSupDirectObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getGroupList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getGroupList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 8 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/ActionListWithGroupSupNested.java

@@ -2,14 +2,14 @@ package com.x.organization.assemble.express.jaxrs.group;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -17,8 +17,6 @@ import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Group;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithGroupSupNested extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -26,14 +24,13 @@ class ActionListWithGroupSupNested extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getGroupList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getGroupList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 9 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/ActionListWithGroupSupNestedObject.java

@@ -2,14 +2,14 @@ package com.x.organization.assemble.express.jaxrs.group;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -17,23 +17,21 @@ import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Group;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithGroupSupNestedObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getGroupList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getGroupList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 15 - 17
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/ActionListWithPerson.java

@@ -2,25 +2,24 @@ package com.x.organization.assemble.express.jaxrs.group;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
-import com.x.organization.core.entity.Identity;
 import org.apache.commons.lang3.BooleanUtils;
-import org.apache.commons.lang3.StringUtils;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
+import com.x.organization.core.entity.Identity;
 import com.x.organization.core.entity.Person;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithPerson extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -28,15 +27,14 @@ class ActionListWithPerson extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getPersonList(), ","),
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getPersonList(),
 					wi.getRecursiveGroupFlag(), wi.getReferenceFlag(), wi.getRecursiveOrgFlag());
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;
@@ -99,14 +97,14 @@ class ActionListWithPerson extends BaseAction {
 		List<String> groupIds = new ArrayList<>();
 		for (Person person : os) {
 			groupIds.addAll(business.group().listSupDirectWithPerson(person.getId()));
-			if(BooleanUtils.isTrue(wi.getReferenceFlag())){
+			if (BooleanUtils.isTrue(wi.getReferenceFlag())) {
 				List<Identity> identityList = business.identity().listByPerson(person.getId());
-				for(Identity identity : identityList){
+				for (Identity identity : identityList) {
 					groupIds.addAll(business.group().listSupDirectWithIdentity(identity.getId()));
 					groupIds.addAll(business.group().listSupDirectWithUnit(identity.getUnit()));
-					if(BooleanUtils.isTrue(wi.getRecursiveOrgFlag())){
+					if (BooleanUtils.isTrue(wi.getRecursiveOrgFlag())) {
 						List<String> orgIds = business.unit().listSupNested(identity.getUnit());
-						for (String orgId : orgIds){
+						for (String orgId : orgIds) {
 							groupIds.addAll(business.group().listSupDirectWithUnit(orgId));
 						}
 					}
@@ -116,8 +114,8 @@ class ActionListWithPerson extends BaseAction {
 		groupIds = ListTools.trim(groupIds, true, true);
 		List<String> groupIds2 = new ArrayList<>();
 		groupIds2.addAll(groupIds);
-		if(!BooleanUtils.isFalse(wi.getRecursiveGroupFlag())){
-			for(String groupId : groupIds){
+		if (!BooleanUtils.isFalse(wi.getRecursiveGroupFlag())) {
+			for (String groupId : groupIds) {
 				groupIds2.addAll(business.group().listSupNested(groupId));
 			}
 			groupIds2 = ListTools.trim(groupIds2, true, true);

+ 16 - 17
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/ActionListWithPersonObject.java

@@ -2,42 +2,41 @@ package com.x.organization.assemble.express.jaxrs.group;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
-import com.x.organization.core.entity.Identity;
 import org.apache.commons.lang3.BooleanUtils;
-import org.apache.commons.lang3.StringUtils;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Group;
+import com.x.organization.core.entity.Identity;
 import com.x.organization.core.entity.Person;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithPersonObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getPersonList(), ","),
+			CacheKey cacheKey = new CacheKey(this.getClass(),  wi.getPersonList() ,
 					wi.getRecursiveGroupFlag(), wi.getReferenceFlag(), wi.getRecursiveOrgFlag());
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;
@@ -101,14 +100,14 @@ class ActionListWithPersonObject extends BaseAction {
 		List<String> groupIds = new ArrayList<>();
 		for (Person person : os) {
 			groupIds.addAll(business.group().listSupDirectWithPerson(person.getId()));
-			if(BooleanUtils.isTrue(wi.getReferenceFlag())){
+			if (BooleanUtils.isTrue(wi.getReferenceFlag())) {
 				List<Identity> identityList = business.identity().listByPerson(person.getId());
-				for(Identity identity : identityList){
+				for (Identity identity : identityList) {
 					groupIds.addAll(business.group().listSupDirectWithIdentity(identity.getId()));
 					groupIds.addAll(business.group().listSupDirectWithUnit(identity.getUnit()));
-					if(BooleanUtils.isTrue(wi.getRecursiveOrgFlag())){
+					if (BooleanUtils.isTrue(wi.getRecursiveOrgFlag())) {
 						List<String> orgIds = business.unit().listSupNested(identity.getUnit());
-						for (String orgId : orgIds){
+						for (String orgId : orgIds) {
 							groupIds.addAll(business.group().listSupDirectWithUnit(orgId));
 						}
 					}
@@ -118,8 +117,8 @@ class ActionListWithPersonObject extends BaseAction {
 		groupIds = ListTools.trim(groupIds, true, true);
 		List<String> groupIds2 = new ArrayList<>();
 		groupIds2.addAll(groupIds);
-		if(!BooleanUtils.isFalse(wi.getRecursiveGroupFlag())){
-			for(String groupId : groupIds){
+		if (!BooleanUtils.isFalse(wi.getRecursiveGroupFlag())) {
+			for (String groupId : groupIds) {
 				groupIds2.addAll(business.group().listSupNested(groupId));
 			}
 			groupIds2 = ListTools.trim(groupIds2, true, true);

+ 8 - 4
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/BaseAction.java

@@ -4,21 +4,25 @@ import java.util.ArrayList;
 import java.util.List;
 
 import com.x.base.core.project.annotation.FieldDescribe;
+import com.x.base.core.project.cache.Cache.CacheCategory;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.jaxrs.StandardJaxrsAction;
 import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
-import com.x.organization.assemble.express.CacheFactory;
 import com.x.organization.core.entity.Group;
 import com.x.organization.core.entity.Identity;
 import com.x.organization.core.entity.Person;
+import com.x.organization.core.entity.PersonAttribute;
+import com.x.organization.core.entity.Role;
 import com.x.organization.core.entity.Unit;
-
-import net.sf.ehcache.Ehcache;
+import com.x.organization.core.entity.UnitAttribute;
+import com.x.organization.core.entity.UnitDuty;
+import com.x.organization.core.entity.accredit.Empower;
 
 class BaseAction extends StandardJaxrsAction {
 
-	Ehcache cache = CacheFactory.getOrganizationCache();
+	CacheCategory cacheCategory = new CacheCategory(Identity.class, Unit.class, UnitAttribute.class, UnitDuty.class,
+			Role.class, Person.class, PersonAttribute.class, Group.class, Empower.class);
 
 	static class WoGroupAbstract extends GsonPropertyObject {
 

+ 9 - 12
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionList.java

@@ -2,14 +2,14 @@ package com.x.organization.assemble.express.jaxrs.identity;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -17,23 +17,20 @@ import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Identity;
 
-import net.sf.ehcache.Element;
-
 class ActionList extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
-			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getIdentityList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getIdentityList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 8 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListMajorWithPerson.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.identity;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -9,14 +10,13 @@ import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
-import org.apache.commons.lang3.StringUtils;
-
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.entity.JpaObject;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -26,8 +26,6 @@ import com.x.organization.core.entity.Identity;
 import com.x.organization.core.entity.Identity_;
 import com.x.organization.core.entity.Person;
 
-import net.sf.ehcache.Element;
-
 class ActionListMajorWithPerson extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -35,14 +33,13 @@ class ActionListMajorWithPerson extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getPersonList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getPersonList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 9 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListMajorWithPersonObject.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.identity;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -9,14 +10,13 @@ import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
-import org.apache.commons.lang3.StringUtils;
-
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.entity.JpaObject;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -26,23 +26,21 @@ import com.x.organization.core.entity.Identity;
 import com.x.organization.core.entity.Identity_;
 import com.x.organization.core.entity.Person;
 
-import net.sf.ehcache.Element;
-
 class ActionListMajorWithPersonObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getPersonList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getPersonList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 9 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListObject.java

@@ -2,37 +2,35 @@ package com.x.organization.assemble.express.jaxrs.identity;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Identity;
 
-import net.sf.ehcache.Element;
-
 class ActionListObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getIdentityList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getIdentityList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 8 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithGroup.java

@@ -2,15 +2,15 @@ package com.x.organization.assemble.express.jaxrs.identity;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.entity.JpaObject;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -19,8 +19,6 @@ import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Group;
 import com.x.organization.core.entity.Identity;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithGroup extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -28,14 +26,13 @@ class ActionListWithGroup extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getGroupList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getGroupList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 9 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithGroupObject.java

@@ -2,14 +2,14 @@ package com.x.organization.assemble.express.jaxrs.identity;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -18,23 +18,21 @@ import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Group;
 import com.x.organization.core.entity.Identity;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithGroupObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getGroupList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getGroupList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 12 - 12
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithPerson.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.identity;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -9,14 +10,13 @@ import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
-import org.apache.commons.lang3.StringUtils;
-
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.entity.JpaObject;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -26,8 +26,6 @@ import com.x.organization.core.entity.Identity;
 import com.x.organization.core.entity.Identity_;
 import com.x.organization.core.entity.Person;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithPerson extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -35,14 +33,15 @@ class ActionListWithPerson extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getPersonList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getPersonList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
+				System.out.println("!!!!!!!!!!!!!!GET with cache");
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
+				System.out.println("!!!!!!!!!!!!!!nnnnnnnnnnnnoooooooooooooo cache");
 				result.setData(wo);
 			}
 			return result;
@@ -76,7 +75,8 @@ class ActionListWithPerson extends BaseAction {
 		CriteriaQuery<String> cq = cb.createQuery(String.class);
 		Root<Identity> root = cq.from(Identity.class);
 		Predicate p = root.get(Identity_.person).in(personIds);
-		List<String> identityIds = em.createQuery(cq.select(root.get(Identity_.id)).where(p).distinct(true)) .getResultList();
+		List<String> identityIds = em.createQuery(cq.select(root.get(Identity_.id)).where(p).distinct(true))
+				.getResultList();
 		List<String> values = business.identity().listIdentityDistinguishedNameSorted(identityIds);
 		Wo wo = new Wo();
 		wo.getIdentityList().addAll(values);

+ 59 - 58
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithPersonObject.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.identity;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -9,14 +10,13 @@ import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
-import org.apache.commons.lang3.StringUtils;
-
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.entity.JpaObject;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -26,68 +26,69 @@ import com.x.organization.core.entity.Identity;
 import com.x.organization.core.entity.Identity_;
 import com.x.organization.core.entity.Person;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithPersonObject extends BaseAction {
 
-    ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
-        try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
-            Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
-            ActionResult<List<Wo>> result = new ActionResult<>();
-            Business business = new Business(emc);
-            String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-                    StringUtils.join(wi.getPersonList(), ","));
-            Element element = cache.get(cacheKey);
-            if (null != element && (null != element.getObjectValue())) {
-                result.setData((List<Wo>) element.getObjectValue());
-            } else {
-                List<Wo> wos = this.list(business, wi);
-                cache.put(new Element(cacheKey, wos));
-                result.setData(wos);
-            }
-            return result;
-        }
-    }
+	@SuppressWarnings("unchecked")
+	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
+		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
+			ActionResult<List<Wo>> result = new ActionResult<>();
+			Business business = new Business(emc);
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getPersonList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
+			} else {
+				List<Wo> wos = this.list(business, wi);
+				CacheManager.put(cacheCategory, cacheKey, wos);
+				result.setData(wos);
+			}
+			return result;
+		}
+	}
 
-    public static class Wi extends GsonPropertyObject {
-        @FieldDescribe("个人")
-        private List<String> personList = new ArrayList<>();
-        public List<String> getPersonList() {
-            return personList;
-        }
-        public void setPersonList(List<String> personList) {
-            this.personList = personList;
-        }
-    }
+	public static class Wi extends GsonPropertyObject {
+		@FieldDescribe("个人")
+		private List<String> personList = new ArrayList<>();
 
-    public static class Wo extends com.x.base.core.project.organization.Identity {
-    }
+		public List<String> getPersonList() {
+			return personList;
+		}
 
-    private List<Wo> list(Business business, Wi wi) throws Exception {
-        List<Wo> wos = new ArrayList<>();
-        List<String> personMajorIds = new ArrayList<>();
-        List<Person> os = business.person().pick(wi.getPersonList());
-        List<String> personIds = ListTools.extractProperty(os, JpaObject.id_FIELDNAME, String.class, true, true);
-        List<Identity> personMajors = business.identity().listMajorOfPerson(business, personIds);
-        if( ListTools.isNotEmpty( personMajors )){
-			for( Identity identity : personMajors ){
-                personMajorIds.add( identity.getId() );
+		public void setPersonList(List<String> personList) {
+			this.personList = personList;
+		}
+	}
+
+	public static class Wo extends com.x.base.core.project.organization.Identity {
+	}
+
+	private List<Wo> list(Business business, Wi wi) throws Exception {
+		List<Wo> wos = new ArrayList<>();
+		List<String> personMajorIds = new ArrayList<>();
+		List<Person> os = business.person().pick(wi.getPersonList());
+		List<String> personIds = ListTools.extractProperty(os, JpaObject.id_FIELDNAME, String.class, true, true);
+		List<Identity> personMajors = business.identity().listMajorOfPerson(business, personIds);
+		if (ListTools.isNotEmpty(personMajors)) {
+			for (Identity identity : personMajors) {
+				personMajorIds.add(identity.getId());
 			}
 		}
-        EntityManager em = business.entityManagerContainer().get(Identity.class);
-        CriteriaBuilder cb = em.getCriteriaBuilder();
-        CriteriaQuery<String> cq = cb.createQuery(String.class);
-        Root<Identity> root = cq.from(Identity.class);
-        Predicate p = root.get(Identity_.person).in(personIds);
-        List<String> identityIds = em.createQuery(cq.select(root.get(Identity_.id)).where(p).distinct(true)).getResultList();
-        List<Identity> list = business.identity().pick(identityIds);
-        for (Identity o : list) {
-        	if( ListTools.contains( personMajorIds, o.getId() )){
-				o.setMajor( true );
+		EntityManager em = business.entityManagerContainer().get(Identity.class);
+		CriteriaBuilder cb = em.getCriteriaBuilder();
+		CriteriaQuery<String> cq = cb.createQuery(String.class);
+		Root<Identity> root = cq.from(Identity.class);
+		Predicate p = root.get(Identity_.person).in(personIds);
+		List<String> identityIds = em.createQuery(cq.select(root.get(Identity_.id)).where(p).distinct(true))
+				.getResultList();
+		List<Identity> list = business.identity().pick(identityIds);
+		for (Identity o : list) {
+			if (ListTools.contains(personMajorIds, o.getId())) {
+				o.setMajor(true);
 			}
-            wos.add(this.convert(business, o, Wo.class));
-        }
-        return wos;
-    }
+			wos.add(this.convert(business, o, Wo.class));
+		}
+		return wos;
+	}
 
 }

+ 9 - 12
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithPersonWithUnit.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.identity;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -9,13 +10,12 @@ import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
-import org.apache.commons.lang3.StringUtils;
-
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -23,10 +23,8 @@ import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Identity;
 import com.x.organization.core.entity.Identity_;
-import com.x.organization.core.entity.Unit;
 import com.x.organization.core.entity.Person;
-
-import net.sf.ehcache.Element;
+import com.x.organization.core.entity.Unit;
 
 class ActionListWithPersonWithUnit extends BaseAction {
 
@@ -35,14 +33,13 @@ class ActionListWithPersonWithUnit extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getUnitList(), ","), StringUtils.join(wi.getPersonList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getUnitList(), wi.getPersonList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 10 - 13
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithPersonWithUnitObject.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.identity;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -9,41 +10,37 @@ import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
-import org.apache.commons.lang3.StringUtils;
-
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
-import com.x.organization.assemble.express.jaxrs.identity.ActionListWithPersonObject.Wo;
 import com.x.organization.core.entity.Identity;
 import com.x.organization.core.entity.Identity_;
-import com.x.organization.core.entity.Unit;
 import com.x.organization.core.entity.Person;
-
-import net.sf.ehcache.Element;
+import com.x.organization.core.entity.Unit;
 
 class ActionListWithPersonWithUnitObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getUnitList(), ","), StringUtils.join(wi.getPersonList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getUnitList(), wi.getPersonList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 8 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithUnitSubDirect.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.identity;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -9,13 +10,12 @@ import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
-import org.apache.commons.lang3.StringUtils;
-
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -24,8 +24,6 @@ import com.x.organization.core.entity.Identity;
 import com.x.organization.core.entity.Identity_;
 import com.x.organization.core.entity.Unit;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithUnitSubDirect extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -33,14 +31,13 @@ class ActionListWithUnitSubDirect extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getUnitList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getUnitList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 9 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithUnitSubDirectObject.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.identity;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -9,13 +10,12 @@ import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
-import org.apache.commons.lang3.StringUtils;
-
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -24,23 +24,21 @@ import com.x.organization.core.entity.Identity;
 import com.x.organization.core.entity.Identity_;
 import com.x.organization.core.entity.Unit;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithUnitSubDirectObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getUnitList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getUnitList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 8 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithUnitSubNested.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.identity;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -9,13 +10,12 @@ import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
-import org.apache.commons.lang3.StringUtils;
-
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -25,8 +25,6 @@ import com.x.organization.core.entity.Identity;
 import com.x.organization.core.entity.Identity_;
 import com.x.organization.core.entity.Unit;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithUnitSubNested extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -34,14 +32,13 @@ class ActionListWithUnitSubNested extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getUnitList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getUnitList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 9 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListWithUnitSubNestedObject.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.identity;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -9,13 +10,12 @@ import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
-import org.apache.commons.lang3.StringUtils;
-
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -25,23 +25,21 @@ import com.x.organization.core.entity.Identity;
 import com.x.organization.core.entity.Identity_;
 import com.x.organization.core.entity.Unit;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithUnitSubNestedObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getUnitList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getUnitList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 10 - 5
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/BaseAction.java

@@ -4,19 +4,24 @@ import java.util.ArrayList;
 import java.util.List;
 
 import com.x.base.core.project.annotation.FieldDescribe;
+import com.x.base.core.project.cache.Cache.CacheCategory;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.jaxrs.StandardJaxrsAction;
 import com.x.organization.assemble.express.Business;
-import com.x.organization.assemble.express.CacheFactory;
+import com.x.organization.core.entity.Group;
 import com.x.organization.core.entity.Identity;
 import com.x.organization.core.entity.Person;
+import com.x.organization.core.entity.PersonAttribute;
+import com.x.organization.core.entity.Role;
 import com.x.organization.core.entity.Unit;
-
-import net.sf.ehcache.Ehcache;
+import com.x.organization.core.entity.UnitAttribute;
+import com.x.organization.core.entity.UnitDuty;
+import com.x.organization.core.entity.accredit.Empower;
 
 class BaseAction extends StandardJaxrsAction {
 
-	Ehcache cache = CacheFactory.getOrganizationCache();
+	CacheCategory cacheCategory = new CacheCategory(Identity.class, Unit.class, UnitAttribute.class, UnitDuty.class,
+			Role.class, Person.class, PersonAttribute.class, Group.class, Empower.class);
 
 	static class WoIdentityAbstract extends GsonPropertyObject {
 
@@ -44,7 +49,7 @@ class BaseAction extends StandardJaxrsAction {
 		t.setUnitLevel(identity.getUnitLevel());
 		t.setUnitLevelName(identity.getUnitLevelName());
 		t.setOrderNumber(identity.getOrderNumber());
-		t.setMajor( identity.getMajor() );
+		t.setMajor(identity.getMajor());
 		Person p = business.person().pick(identity.getPerson());
 		if (null != p) {
 			t.setPerson(p.getDistinguishedName());

+ 8 - 9
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionHasRole.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -16,7 +17,8 @@ import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.entity.JpaObject;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -27,8 +29,6 @@ import com.x.organization.core.entity.Person;
 import com.x.organization.core.entity.Role;
 import com.x.organization.core.entity.Role_;
 
-import net.sf.ehcache.Element;
-
 class ActionHasRole extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -36,14 +36,13 @@ class ActionHasRole extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(), wi.getPerson(),
-					StringUtils.join(wi.getRoleList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getPerson(), wi.getRoleList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.get(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 8 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionList.java

@@ -2,14 +2,14 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -17,8 +17,6 @@ import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Person;
 
-import net.sf.ehcache.Element;
-
 class ActionList extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -26,14 +24,13 @@ class ActionList extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getPersonList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getPersonList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 8 - 8
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListAll.java

@@ -1,6 +1,7 @@
 package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -9,28 +10,27 @@ import javax.persistence.criteria.Root;
 
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Person;
 
-import net.sf.ehcache.Element;
-
 class ActionListAll extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass());
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 9 - 8
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListAllObject.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -10,27 +11,27 @@ import javax.persistence.criteria.Root;
 
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Person;
 
-import net.sf.ehcache.Element;
-
 class ActionListAllObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass());
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 8 - 9
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListLoginAfter.java

@@ -3,6 +3,7 @@ package com.x.organization.assemble.express.jaxrs.person;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -13,18 +14,16 @@ import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
-import com.x.base.core.project.tools.DateTools;
 import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Person;
 import com.x.organization.core.entity.Person_;
 
-import net.sf.ehcache.Element;
-
 class ActionListLoginAfter extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -32,13 +31,13 @@ class ActionListLoginAfter extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(), DateTools.format(wi.getDate()));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getDate());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 9 - 9
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListLoginAfterObject.java

@@ -3,6 +3,7 @@ package com.x.organization.assemble.express.jaxrs.person;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -13,31 +14,30 @@ import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
-import com.x.base.core.project.tools.DateTools;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Person;
 import com.x.organization.core.entity.Person_;
 
-import net.sf.ehcache.Element;
-
 class ActionListLoginAfterObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(), DateTools.format(wi.getDate()));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getDate());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 8 - 8
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListLoginRecent.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -12,7 +13,8 @@ import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -22,8 +24,6 @@ import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Person;
 import com.x.organization.core.entity.Person_;
 
-import net.sf.ehcache.Element;
-
 class ActionListLoginRecent extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -31,13 +31,13 @@ class ActionListLoginRecent extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(), wi.getCount());
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getCount());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 9 - 8
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListLoginRecentObject.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -12,7 +13,8 @@ import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -21,22 +23,21 @@ import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Person;
 import com.x.organization.core.entity.Person_;
 
-import net.sf.ehcache.Element;
-
 class ActionListLoginRecentObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(), wi.getCount());
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getCount());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 9 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListObject.java

@@ -2,37 +2,35 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Person;
 
-import net.sf.ehcache.Element;
-
 class ActionListObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getPersonList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getPersonList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 9 - 12
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithGroup.java

@@ -2,14 +2,14 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -17,8 +17,6 @@ import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Group;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithGroup extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -26,14 +24,13 @@ class ActionListWithGroup extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getGroupList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getGroupList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;
@@ -82,7 +79,7 @@ class ActionListWithGroup extends BaseAction {
 			personIds = ListTools.trim(personIds, true, true);
 		}
 		List<String> values = business.person().listPersonDistinguishedNameSorted(personIds);
-	
+
 		Wo wo = new Wo();
 		wo.getPersonList().addAll(values);
 		return wo;

+ 9 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithGroupObject.java

@@ -2,14 +2,14 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -18,23 +18,21 @@ import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Group;
 import com.x.organization.core.entity.Person;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithGroupObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getGroupList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getGroupList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 8 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithIdentity.java

@@ -2,14 +2,14 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -17,8 +17,6 @@ import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Identity;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithIdentity extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -26,14 +24,13 @@ class ActionListWithIdentity extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getIdentityList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getIdentityList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 9 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithIdentityObject.java

@@ -2,14 +2,14 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -18,23 +18,21 @@ import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Identity;
 import com.x.organization.core.entity.Person;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithIdentityObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getIdentityList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getIdentityList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 8 - 9
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithPersonAttribute.java

@@ -1,6 +1,7 @@
 package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -12,7 +13,8 @@ import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -21,8 +23,6 @@ import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.PersonAttribute;
 import com.x.organization.core.entity.PersonAttribute_;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithPersonAttribute extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -30,14 +30,13 @@ class ActionListWithPersonAttribute extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					wi.getName() + "," + wi.getAttribute());
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getName(), wi.getAttribute());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 9 - 9
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithPersonAttributeObject.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -13,7 +14,8 @@ import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -23,23 +25,21 @@ import com.x.organization.core.entity.Person;
 import com.x.organization.core.entity.PersonAttribute;
 import com.x.organization.core.entity.PersonAttribute_;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithPersonAttributeObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					wi.getName() + "," + wi.getAttribute());
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getName(), wi.getAttribute());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 9 - 12
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithPersonSubDirect.java

@@ -2,14 +2,14 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -17,8 +17,6 @@ import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Person;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithPersonSubDirect extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -26,14 +24,13 @@ class ActionListWithPersonSubDirect extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getPersonList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getPersonList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;
@@ -66,7 +63,7 @@ class ActionListWithPersonSubDirect extends BaseAction {
 			personIds.addAll(business.person().listSubDirect(o.getId()));
 		}
 		personIds = ListTools.trim(personIds, true, true);
-		List<String> values =business.person().listPersonDistinguishedNameSorted(personIds);
+		List<String> values = business.person().listPersonDistinguishedNameSorted(personIds);
 		Wo wo = new Wo();
 		wo.getPersonList().addAll(values);
 		return wo;

+ 9 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithPersonSubDirectObject.java

@@ -2,14 +2,14 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -17,23 +17,21 @@ import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Person;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithPersonSubDirectObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getPersonList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getPersonList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 8 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithPersonSubNested.java

@@ -2,14 +2,14 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -17,8 +17,6 @@ import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Person;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithPersonSubNested extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -26,14 +24,13 @@ class ActionListWithPersonSubNested extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getPersonList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getPersonList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 9 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithPersonSubNestedObject.java

@@ -2,14 +2,14 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -17,23 +17,21 @@ import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Person;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithPersonSubNestedObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getPersonList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getPersonList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 8 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithPersonSupDirect.java

@@ -2,22 +2,20 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Person;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithPersonSupDirect extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -25,14 +23,13 @@ class ActionListWithPersonSupDirect extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getPersonList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getPersonList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 9 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithPersonSupDirectObject.java

@@ -2,14 +2,14 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -17,23 +17,21 @@ import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Person;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithPersonSupDirectObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getPersonList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getPersonList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 8 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithPersonSupNested.java

@@ -2,14 +2,14 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -17,8 +17,6 @@ import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Person;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithPersonSupNested extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -26,14 +24,13 @@ class ActionListWithPersonSupNested extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getPersonList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getPersonList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 9 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithPersonSupNestedObject.java

@@ -2,37 +2,35 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Person;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithPersonSupNestedObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getPersonList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getPersonList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 8 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithRole.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -9,13 +10,12 @@ import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
-import org.apache.commons.lang3.StringUtils;
-
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -25,8 +25,6 @@ import com.x.organization.core.entity.Group;
 import com.x.organization.core.entity.Group_;
 import com.x.organization.core.entity.Role;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithRole extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -34,14 +32,13 @@ class ActionListWithRole extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getRoleList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getRoleList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 9 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithRoleObject.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -9,13 +10,12 @@ import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
-import org.apache.commons.lang3.StringUtils;
-
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -26,23 +26,21 @@ import com.x.organization.core.entity.Group_;
 import com.x.organization.core.entity.Person;
 import com.x.organization.core.entity.Role;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithRoleObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getRoleList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getRoleList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 8 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithUnitSubDirect.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -9,13 +10,12 @@ import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
-import org.apache.commons.lang3.StringUtils;
-
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -24,8 +24,6 @@ import com.x.organization.core.entity.Identity;
 import com.x.organization.core.entity.Identity_;
 import com.x.organization.core.entity.Unit;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithUnitSubDirect extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -33,14 +31,13 @@ class ActionListWithUnitSubDirect extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getUnitList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getUnitList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 8 - 9
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithUnitSubDirectLike.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -15,7 +16,8 @@ import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -28,8 +30,6 @@ import com.x.organization.core.entity.Person;
 import com.x.organization.core.entity.Person_;
 import com.x.organization.core.entity.Unit;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithUnitSubDirectLike extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -37,14 +37,13 @@ class ActionListWithUnitSubDirectLike extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getUnitList(), wi.getKey(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getUnitList(), wi.getKey());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi, this.people(business, wi));
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 11 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithUnitSubDirectLikeObject.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -9,11 +10,14 @@ import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
+import org.apache.commons.lang3.StringUtils;
+
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -26,25 +30,21 @@ import com.x.organization.core.entity.Person;
 import com.x.organization.core.entity.Person_;
 import com.x.organization.core.entity.Unit;
 
-import org.apache.commons.lang3.StringUtils;
-
-import net.sf.ehcache.Element;
-
 class ActionListWithUnitSubDirectLikeObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getUnitList(), wi.getKey(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getUnitList(), wi.getKey());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi, this.people(business, wi));
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 9 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithUnitSubDirectObject.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -9,13 +10,12 @@ import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
-import org.apache.commons.lang3.StringUtils;
-
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -26,23 +26,21 @@ import com.x.organization.core.entity.Identity_;
 import com.x.organization.core.entity.Person;
 import com.x.organization.core.entity.Unit;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithUnitSubDirectObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getUnitList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getUnitList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 8 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithUnitSubNested.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -9,13 +10,12 @@ import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
-import org.apache.commons.lang3.StringUtils;
-
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -25,8 +25,6 @@ import com.x.organization.core.entity.Identity;
 import com.x.organization.core.entity.Identity_;
 import com.x.organization.core.entity.Unit;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithUnitSubNested extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -34,14 +32,13 @@ class ActionListWithUnitSubNested extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getUnitList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getUnitList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 9 - 9
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithUnitSubNestedLike.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -15,7 +16,8 @@ import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -28,8 +30,6 @@ import com.x.organization.core.entity.Person;
 import com.x.organization.core.entity.Person_;
 import com.x.organization.core.entity.Unit;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithUnitSubNestedLike extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -37,14 +37,14 @@ class ActionListWithUnitSubNestedLike extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getUnitList(), wi.getKey(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getUnitList(), wi.getKey());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi, this.people(business, wi));
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 9 - 10
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithUnitSubNestedLikeObject.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -15,37 +16,35 @@ import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.tools.ListTools;
 import com.x.base.core.project.tools.StringTools;
 import com.x.organization.assemble.express.Business;
-import com.x.organization.assemble.express.jaxrs.person.ActionListWithUnitSubDirectObject.Wo;
 import com.x.organization.core.entity.Identity;
 import com.x.organization.core.entity.Identity_;
 import com.x.organization.core.entity.Person;
 import com.x.organization.core.entity.Person_;
 import com.x.organization.core.entity.Unit;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithUnitSubNestedLikeObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getUnitList(), wi.getKey(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getUnitList(), wi.getKey());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi, this.people(business, wi));
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 9 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListWithUnitSubNestedObject.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.person;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -9,13 +10,12 @@ import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
-import org.apache.commons.lang3.StringUtils;
-
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -26,23 +26,21 @@ import com.x.organization.core.entity.Identity_;
 import com.x.organization.core.entity.Person;
 import com.x.organization.core.entity.Unit;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithUnitSubNestedObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getUnitList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getUnitList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 11 - 4
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/BaseAction.java

@@ -6,17 +6,24 @@ import java.util.List;
 import org.apache.commons.lang3.StringUtils;
 
 import com.x.base.core.project.annotation.FieldDescribe;
+import com.x.base.core.project.cache.Cache.CacheCategory;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.jaxrs.StandardJaxrsAction;
 import com.x.organization.assemble.express.Business;
-import com.x.organization.assemble.express.CacheFactory;
+import com.x.organization.core.entity.Group;
+import com.x.organization.core.entity.Identity;
 import com.x.organization.core.entity.Person;
-
-import net.sf.ehcache.Ehcache;
+import com.x.organization.core.entity.PersonAttribute;
+import com.x.organization.core.entity.Role;
+import com.x.organization.core.entity.Unit;
+import com.x.organization.core.entity.UnitAttribute;
+import com.x.organization.core.entity.UnitDuty;
+import com.x.organization.core.entity.accredit.Empower;
 
 class BaseAction extends StandardJaxrsAction {
 
-	Ehcache cache = CacheFactory.getOrganizationCache();
+	CacheCategory cacheCategory = new CacheCategory(Identity.class, Unit.class, UnitAttribute.class, UnitDuty.class,
+			Role.class, Person.class, PersonAttribute.class, Group.class, Empower.class);
 
 	static class WoPersonListAbstract extends GsonPropertyObject {
 

+ 3 - 2
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/personattribute/ActionAppendWithPersonWithName.java

@@ -16,6 +16,7 @@ import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.entity.annotation.CheckPersistType;
 import com.x.base.core.project.annotation.FieldDescribe;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -24,7 +25,6 @@ import com.x.base.core.project.logger.Logger;
 import com.x.base.core.project.logger.LoggerFactory;
 import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
-import com.x.organization.assemble.express.CacheFactory;
 import com.x.organization.core.entity.Person;
 import com.x.organization.core.entity.PersonAttribute;
 import com.x.organization.core.entity.PersonAttribute_;
@@ -70,7 +70,8 @@ class ActionAppendWithPersonWithName extends BaseAction {
 				}
 				wo.setValue(true);
 				emc.commit();
-				CacheFactory.cacheNotifyAll();
+				CacheManager.notify(PersonAttribute.class);
+				CacheManager.notify(Person.class);
 			}
 			result.setData(wo);
 			return result;

+ 8 - 8
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/personattribute/ActionListAttributeWithPersonWithName.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.personattribute;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -13,7 +14,8 @@ import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -22,8 +24,6 @@ import com.x.organization.core.entity.Person;
 import com.x.organization.core.entity.PersonAttribute;
 import com.x.organization.core.entity.PersonAttribute_;
 
-import net.sf.ehcache.Element;
-
 class ActionListAttributeWithPersonWithName extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -31,13 +31,13 @@ class ActionListAttributeWithPersonWithName extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(), wi.getPerson() + "," + wi.getName());
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getName(), wi.getPerson());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 8 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/personattribute/ActionListNameWithPerson.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.personattribute;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 import java.util.stream.Collectors;
 
 import javax.persistence.EntityManager;
@@ -10,14 +11,13 @@ import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
-import org.apache.commons.lang3.StringUtils;
-
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.entity.JpaObject;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -27,8 +27,6 @@ import com.x.organization.core.entity.Person;
 import com.x.organization.core.entity.PersonAttribute;
 import com.x.organization.core.entity.PersonAttribute_;
 
-import net.sf.ehcache.Element;
-
 class ActionListNameWithPerson extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -36,14 +34,13 @@ class ActionListNameWithPerson extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getPersonList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getPersonList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 9 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/personattribute/ActionListWithPersonObject.java

@@ -2,6 +2,7 @@ package com.x.organization.assemble.express.jaxrs.personattribute;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Optional;
 
 import javax.persistence.EntityManager;
 import javax.persistence.criteria.CriteriaBuilder;
@@ -9,14 +10,13 @@ import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
-import org.apache.commons.lang3.StringUtils;
-
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.entity.JpaObject;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -26,23 +26,21 @@ import com.x.organization.core.entity.Person;
 import com.x.organization.core.entity.PersonAttribute;
 import com.x.organization.core.entity.PersonAttribute_;
 
-import net.sf.ehcache.Element;
-
 class ActionListWithPersonObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getPersonList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getPersonList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

+ 3 - 2
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/personattribute/ActionSetWithPersonWithName.java

@@ -16,6 +16,7 @@ import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.entity.annotation.CheckPersistType;
 import com.x.base.core.project.annotation.FieldDescribe;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -25,7 +26,6 @@ import com.x.base.core.project.logger.LoggerFactory;
 import com.x.base.core.project.organization.OrganizationDefinition;
 import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
-import com.x.organization.assemble.express.CacheFactory;
 import com.x.organization.core.entity.Person;
 import com.x.organization.core.entity.PersonAttribute;
 import com.x.organization.core.entity.PersonAttribute_;
@@ -68,7 +68,8 @@ class ActionSetWithPersonWithName extends BaseAction {
 				}
 				wo.setValue(true);
 				emc.commit();
-				CacheFactory.cacheNotifyAll();
+				CacheManager.notify(PersonAttribute.class);
+				CacheManager.notify(Person.class);
 			}
 			result.setData(wo);
 			return result;

+ 10 - 4
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/personattribute/BaseAction.java

@@ -10,20 +10,26 @@ import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
 import com.x.base.core.project.annotation.FieldDescribe;
+import com.x.base.core.project.cache.Cache.CacheCategory;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.jaxrs.StandardJaxrsAction;
 import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
-import com.x.organization.assemble.express.CacheFactory;
+import com.x.organization.core.entity.Group;
+import com.x.organization.core.entity.Identity;
 import com.x.organization.core.entity.Person;
 import com.x.organization.core.entity.PersonAttribute;
 import com.x.organization.core.entity.PersonAttribute_;
-
-import net.sf.ehcache.Ehcache;
+import com.x.organization.core.entity.Role;
+import com.x.organization.core.entity.Unit;
+import com.x.organization.core.entity.UnitAttribute;
+import com.x.organization.core.entity.UnitDuty;
+import com.x.organization.core.entity.accredit.Empower;
 
 class BaseAction extends StandardJaxrsAction {
 
-	Ehcache cache = CacheFactory.getOrganizationCache();
+	CacheCategory cacheCategory = new CacheCategory(Identity.class, Unit.class, UnitAttribute.class, UnitDuty.class,
+			Role.class, Person.class, PersonAttribute.class, Group.class, Empower.class);
 
 	protected List<String> listPersonAttributeDistinguishedNameSorted(Business business,
 			List<String> personAttributeIds) throws Exception {

+ 8 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/role/ActionList.java

@@ -2,14 +2,14 @@ package com.x.organization.assemble.express.jaxrs.role;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
@@ -17,8 +17,6 @@ import com.x.base.core.project.tools.ListTools;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Role;
 
-import net.sf.ehcache.Element;
-
 class ActionList extends BaseAction {
 
 	ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
@@ -26,14 +24,13 @@ class ActionList extends BaseAction {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<Wo> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getRoleList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((Wo) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getRoleList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((Wo) optional.get());
 			} else {
 				Wo wo = this.list(business, wi);
-				cache.put(new Element(cacheKey, wo));
+				CacheManager.put(cacheCategory, cacheKey, wo);
 				result.setData(wo);
 			}
 			return result;

+ 9 - 11
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/role/ActionListObject.java

@@ -2,37 +2,35 @@ package com.x.organization.assemble.express.jaxrs.role;
 
 import java.util.ArrayList;
 import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
+import java.util.Optional;
 
 import com.google.gson.JsonElement;
 import com.x.base.core.container.EntityManagerContainer;
 import com.x.base.core.container.factory.EntityManagerContainerFactory;
 import com.x.base.core.project.annotation.FieldDescribe;
-import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.cache.Cache.CacheKey;
+import com.x.base.core.project.cache.CacheManager;
 import com.x.base.core.project.gson.GsonPropertyObject;
 import com.x.base.core.project.http.ActionResult;
 import com.x.base.core.project.http.EffectivePerson;
 import com.x.organization.assemble.express.Business;
 import com.x.organization.core.entity.Role;
 
-import net.sf.ehcache.Element;
-
 class ActionListObject extends BaseAction {
 
+	@SuppressWarnings("unchecked")
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
 			ActionResult<List<Wo>> result = new ActionResult<>();
 			Business business = new Business(emc);
-			String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(),
-					StringUtils.join(wi.getRoleList(), ","));
-			Element element = cache.get(cacheKey);
-			if (null != element && (null != element.getObjectValue())) {
-				result.setData((List<Wo>) element.getObjectValue());
+			CacheKey cacheKey = new CacheKey(this.getClass(), wi.getRoleList());
+			Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
+			if (optional.isPresent()) {
+				result.setData((List<Wo>) optional.get());
 			} else {
 				List<Wo> wos = this.list(business, wi);
-				cache.put(new Element(cacheKey, wos));
+				CacheManager.put(cacheCategory, cacheKey, wos);
 				result.setData(wos);
 			}
 			return result;

Некоторые файлы не были показаны из-за большого количества измененных файлов