|
@@ -7,7 +7,6 @@ import java.util.Map;
|
|
|
import java.util.Objects;
|
|
import java.util.Objects;
|
|
|
|
|
|
|
|
import com.google.gson.reflect.TypeToken;
|
|
import com.google.gson.reflect.TypeToken;
|
|
|
-import com.x.base.core.project.gson.XGsonBuilder;
|
|
|
|
|
import com.x.processplatform.core.entity.element.Process;
|
|
import com.x.processplatform.core.entity.element.Process;
|
|
|
import org.apache.commons.lang3.BooleanUtils;
|
|
import org.apache.commons.lang3.BooleanUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -17,7 +16,6 @@ import org.apache.poi.xssf.usermodel.XSSFRow;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
|
|
|
|
|
-import com.x.base.core.project.cache.ApplicationCache;
|
|
|
|
|
import com.x.base.core.project.gson.GsonPropertyObject;
|
|
import com.x.base.core.project.gson.GsonPropertyObject;
|
|
|
import com.x.base.core.project.http.EffectivePerson;
|
|
import com.x.base.core.project.http.EffectivePerson;
|
|
|
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
|
|
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
|
|
@@ -32,22 +30,23 @@ import com.x.query.core.express.plan.ProcessPlatformPlan;
|
|
|
import com.x.query.core.express.plan.Row;
|
|
import com.x.query.core.express.plan.Row;
|
|
|
import com.x.query.core.express.plan.Runtime;
|
|
import com.x.query.core.express.plan.Runtime;
|
|
|
import com.x.query.core.express.plan.SelectEntry;
|
|
import com.x.query.core.express.plan.SelectEntry;
|
|
|
-
|
|
|
|
|
-import net.sf.ehcache.Element;
|
|
|
|
|
|
|
+import com.x.base.core.project.cache.Cache.CacheKey;
|
|
|
|
|
+import com.x.base.core.project.cache.CacheManager;
|
|
|
|
|
+import java.util.Optional;
|
|
|
|
|
|
|
|
abstract class BaseAction extends StandardJaxrsAction {
|
|
abstract class BaseAction extends StandardJaxrsAction {
|
|
|
|
|
|
|
|
protected Plan accessPlan(Business business, View view, Runtime runtime) throws Exception {
|
|
protected Plan accessPlan(Business business, View view, Runtime runtime) throws Exception {
|
|
|
Plan plan = null;
|
|
Plan plan = null;
|
|
|
if (BooleanUtils.isTrue(view.getCacheAccess())) {
|
|
if (BooleanUtils.isTrue(view.getCacheAccess())) {
|
|
|
- String cacheKey = ApplicationCache.concreteCacheKey("accessPlan", view.getId(),
|
|
|
|
|
|
|
+ CacheKey cacheKey = new CacheKey("accessPlan", view.getId(),
|
|
|
StringTools.sha(gson.toJson(runtime)));
|
|
StringTools.sha(gson.toJson(runtime)));
|
|
|
- Element element = business.cache().get(cacheKey);
|
|
|
|
|
- if ((null != element) && (null != element.getObjectValue())) {
|
|
|
|
|
- plan = (Plan) element.getObjectValue();
|
|
|
|
|
|
|
+ Optional<?> optional = CacheManager.get(business.cache(), cacheKey);
|
|
|
|
|
+ if (optional.isPresent()) {
|
|
|
|
|
+ plan = (Plan) optional.get();
|
|
|
} else {
|
|
} else {
|
|
|
plan = this.dealPlan(business, view, runtime);
|
|
plan = this.dealPlan(business, view, runtime);
|
|
|
- business.cache().put(new Element(cacheKey, plan));
|
|
|
|
|
|
|
+ CacheManager.put(business.cache(), cacheKey, plan);
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
plan = this.dealPlan(business, view, runtime);
|
|
plan = this.dealPlan(business, view, runtime);
|
|
@@ -112,14 +111,14 @@ abstract class BaseAction extends StandardJaxrsAction {
|
|
|
protected List<String> fetchBundle(Business business, View view, Runtime runtime) throws Exception {
|
|
protected List<String> fetchBundle(Business business, View view, Runtime runtime) throws Exception {
|
|
|
List<String> os = null;
|
|
List<String> os = null;
|
|
|
if (BooleanUtils.isTrue(view.getCacheAccess())) {
|
|
if (BooleanUtils.isTrue(view.getCacheAccess())) {
|
|
|
- String cacheKey = ApplicationCache.concreteCacheKey("fetchBundle", view.getId(),
|
|
|
|
|
|
|
+ CacheKey cacheKey = new CacheKey("fetchBundle", view.getId(),
|
|
|
StringTools.sha(gson.toJson(runtime)));
|
|
StringTools.sha(gson.toJson(runtime)));
|
|
|
- Element element = business.cache().get(cacheKey);
|
|
|
|
|
- if ((null != element) && (null != element.getObjectValue())) {
|
|
|
|
|
- os = (List<String>) element.getObjectValue();
|
|
|
|
|
|
|
+ Optional<?> optional = CacheManager.get(business.cache(), cacheKey);
|
|
|
|
|
+ if (optional.isPresent()) {
|
|
|
|
|
+ os = (List<String>) optional.get();
|
|
|
} else {
|
|
} else {
|
|
|
os = this.dealBundle(business, view, runtime);
|
|
os = this.dealBundle(business, view, runtime);
|
|
|
- business.cache().put(new Element(cacheKey, os));
|
|
|
|
|
|
|
+ CacheManager.put(business.cache(), cacheKey, os);
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
os = this.dealBundle(business, view, runtime);
|
|
os = this.dealBundle(business, view, runtime);
|
|
@@ -196,7 +195,8 @@ abstract class BaseAction extends StandardJaxrsAction {
|
|
|
obj.setName(name);
|
|
obj.setName(name);
|
|
|
obj.setPerson(effectivePerson.getDistinguishedName());
|
|
obj.setPerson(effectivePerson.getDistinguishedName());
|
|
|
String flag = StringTools.uniqueToken();
|
|
String flag = StringTools.uniqueToken();
|
|
|
- business.cache().put(new Element(flag, obj));
|
|
|
|
|
|
|
+ CacheKey cacheKey = new CacheKey(flag);
|
|
|
|
|
+ CacheManager.put(business.cache(), cacheKey, obj);
|
|
|
return flag;
|
|
return flag;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|