提交 28164c21 编写于 作者: liyi_hz2008's avatar liyi_hz2008

[内容管理]缓存系统升级,使用新的缓存写法,随平台一起支持redis

上级 50274e81
package com.x.cms.assemble.control.jaxrs.appinfo;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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.logger.Logger;
......@@ -11,6 +13,8 @@ import net.sf.ehcache.Element;
import org.apache.commons.lang3.StringUtils;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Optional;
public class ActionGet extends BaseAction {
......@@ -28,13 +32,12 @@ public class ActionGet extends BaseAction {
Exception exception = new ExceptionAppInfoIdEmpty();
result.error( exception );
}
String cacheKey = ApplicationCache.concreteCacheKey( flag );
Element element = cache.get( cacheKey );
if (( null != element ) && ( null != element.getObjectValue()) ) {
wo = ( Wo ) element.getObjectValue();
result.setData( wo );
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), flag );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if (optional.isPresent()) {
result.setData((Wo)optional.get());
} else {
if( check ){
try {
......@@ -70,8 +73,7 @@ public class ActionGet extends BaseAction {
}else{
wo.setConfig( "{}" );
}
cache.put(new Element( cacheKey, wo ));
CacheManager.put(cacheCategory, cacheKey, wo);
result.setData( wo );
} catch (Exception e) {
Exception exception = new ExceptionAppInfoProcess( e, "将查询出来的应用栏目信息对象转换为可输出的数据信息时发生异常。" );
......
......@@ -2,6 +2,8 @@ package com.x.cms.assemble.control.jaxrs.appinfo;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.cache.CacheManager;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.project.cache.ApplicationCache;
......@@ -13,6 +15,8 @@ import com.x.cms.core.entity.AppInfo;
import net.sf.ehcache.Element;
import java.util.Optional;
public class ActionGetAnonymous extends BaseAction {
private static Logger logger = LoggerFactory.getLogger( ActionGetAnonymous.class );
......@@ -28,13 +32,12 @@ public class ActionGetAnonymous extends BaseAction {
Exception exception = new ExceptionAppInfoIdEmpty();
result.error( exception );
}
String cacheKey = ApplicationCache.concreteCacheKey( flag );
Element element = cache.get( cacheKey );
if (( null != element ) && ( null != element.getObjectValue()) ) {
wo = ( Wo ) element.getObjectValue();
result.setData( wo );
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), flag );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if (optional.isPresent()) {
result.setData((Wo)optional.get());
} else {
if( check ){
try {
......@@ -60,7 +63,7 @@ public class ActionGetAnonymous extends BaseAction {
if( check ){
try {
wo = Wo.copier.copy( appInfo );
cache.put(new Element( cacheKey, wo ));
CacheManager.put(cacheCategory, cacheKey, wo);
result.setData( wo );
} catch (Exception e) {
Exception exception = new ExceptionAppInfoProcess( e, "将查询出来的应用栏目信息对象转换为可输出的数据信息时发生异常。" );
......
package com.x.cms.assemble.control.jaxrs.appinfo;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.cache.CacheManager;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.project.cache.ApplicationCache;
......@@ -32,13 +35,12 @@ public class ActionGetByAlias extends BaseAction {
Exception exception = new ExceptionAppInfoIdEmpty();
result.error( exception );
}
String cacheKey = ApplicationCache.concreteCacheKey( "alias", alias );
Element element = cache.get( cacheKey );
if ((null != element) && ( null != element.getObjectValue()) ) {
wo = ( Wo ) element.getObjectValue();
result.setData(wo);
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), alias );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if (optional.isPresent()) {
result.setData((Wo)optional.get());
} else {
if( check ){
try {
......@@ -75,7 +77,7 @@ public class ActionGetByAlias extends BaseAction {
if( check ){
try {
wo = Wo.copier.copy( appInfo );
cache.put(new Element( cacheKey, wo ));
CacheManager.put(cacheCategory, cacheKey, wo);
result.setData( wo );
} catch (Exception e) {
Exception exception = new ExceptionAppInfoProcess( e, "将查询出来的应用栏目信息对象转换为可输出的数据信息时发生异常。" );
......
package com.x.cms.assemble.control.jaxrs.appinfo;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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.WoText;
......@@ -11,6 +13,7 @@ import net.sf.ehcache.Element;
import org.apache.commons.lang3.StringUtils;
import javax.servlet.http.HttpServletRequest;
import java.util.Optional;
public class ActionGetConfig extends BaseAction {
......@@ -27,13 +30,12 @@ public class ActionGetConfig extends BaseAction {
Exception exception = new ExceptionAppInfoIdEmpty();
result.error( exception );
}
String cacheKey = ApplicationCache.concreteCacheKey( "appConfig", id );
Element element = cache.get( cacheKey );
if (( null != element ) && ( null != element.getObjectValue()) ) {
woText = ( WoText ) element.getObjectValue();
result.setData( woText );
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), id );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if (optional.isPresent()) {
result.setData((WoText)optional.get());
} else {
if( check ){
try {
......@@ -51,7 +53,7 @@ public class ActionGetConfig extends BaseAction {
}
}
if( check ){
cache.put(new Element( cacheKey, woText ));
CacheManager.put(cacheCategory, cacheKey, woText);
result.setData( woText );
}
}
......
......@@ -2,18 +2,18 @@ package com.x.cms.assemble.control.jaxrs.appinfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.tools.ListTools;
import net.sf.ehcache.Element;
public class ActionGetPublishableAppInfo extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionGetPublishableAppInfo.class);
......@@ -35,13 +35,12 @@ public class ActionGetPublishableAppInfo extends BaseAction {
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
String cacheKey = ApplicationCache.concreteCacheKey(personName, "ActionGetPublishableAppInfo", appId, isXAdmin);
Element element = cache.get(cacheKey);
if ((null != element) && (null != element.getObjectValue())) {
Wo wo = (Wo) element.getObjectValue();
result.setData( wo );
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), personName, appId, isXAdmin );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if (optional.isPresent()) {
result.setData((Wo)optional.get());
} else {
if (check) {
if ( isXAdmin ) { // 如果用户管理系统管理,则获取所有的栏目和分类信息
......@@ -75,7 +74,7 @@ public class ActionGetPublishableAppInfo extends BaseAction {
if(ListTools.isNotEmpty( wos)) {
for( Wo wo : wos ) {
if( wo.getId().equalsIgnoreCase( appId )) {
cache.put(new Element( cacheKey, wo ));
CacheManager.put(cacheCategory, cacheKey, wo);
result.setData( wo );
break;
}
......
package com.x.cms.assemble.control.jaxrs.appinfo;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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.logger.Logger;
......@@ -25,13 +28,12 @@ public class ActionListAll extends BaseAction {
List<Wo> wos = null;
List<AppInfo> appInfoList = null;
Boolean check = true;
String cacheKey = ApplicationCache.concreteCacheKey( "all" );
Element element = cache.get( cacheKey );
if ((null != element) && ( null != element.getObjectValue()) ) {
wos = ( List<Wo> ) element.getObjectValue();
result.setData( wos );
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass() );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if (optional.isPresent()) {
result.setData((List<Wo>)optional.get());
} else {
try {
appInfoList = appInfoServiceAdv.listAll( null, "全部");
......@@ -46,7 +48,7 @@ public class ActionListAll extends BaseAction {
try {
wos = Wo.copier.copy( appInfoList );
SortTools.desc( wos, "appInfoSeq");
cache.put(new Element( cacheKey, wos ));
CacheManager.put(cacheCategory, cacheKey, wos);
result.setData( wos );
} catch (Exception e) {
Exception exception = new ExceptionAppInfoProcess( e, "将查询出来的应用栏目信息对象转换为可输出的数据信息时发生异常。" );
......
......@@ -2,11 +2,14 @@ package com.x.cms.assemble.control.jaxrs.appinfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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.logger.Logger;
......@@ -37,13 +40,12 @@ public class ActionListAllAppType extends BaseAction {
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
String cacheKey = ApplicationCache.concreteCacheKey( "allType", personName, isAnonymous, isManager );
Element element = cache.get( cacheKey );
if ((null != element) && ( null != element.getObjectValue()) ) {
wos = ( List<Wo> ) element.getObjectValue();
result.setData( wos );
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), personName, isAnonymous, isManager );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if (optional.isPresent()) {
result.setData((List<Wo>)optional.get());
} else {
wos = new ArrayList<>();
try {
......@@ -89,8 +91,7 @@ public class ActionListAllAppType extends BaseAction {
if( appIdsForType.size() > 0 ) {
wos.add( new Wo( "未分类", Long.parseLong( appIdsForType.size() + "") ));
}
cache.put(new Element( cacheKey, wos ));
CacheManager.put(cacheCategory, cacheKey, wos);
result.setData( wos );
}
}
......
......@@ -2,11 +2,14 @@ package com.x.cms.assemble.control.jaxrs.appinfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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.logger.Logger;
......@@ -37,13 +40,12 @@ public class ActionListAllManageableAppType extends BaseAction {
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
String cacheKey = ApplicationCache.concreteCacheKey( "allManageableType", personName, isAnonymous, isManager );
Element element = cache.get( cacheKey );
if ((null != element) && ( null != element.getObjectValue()) ) {
wos = ( List<Wo> ) element.getObjectValue();
result.setData( wos );
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), personName, isAnonymous, isManager );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if (optional.isPresent()) {
result.setData((List<Wo>)optional.get());
} else {
wos = new ArrayList<>();
try {
......@@ -82,6 +84,7 @@ public class ActionListAllManageableAppType extends BaseAction {
List<String> groupNames = userManagerService.listGroupNamesByPerson( personName );
appIdsForType = permissionQueryService.listManageableAppIdsByPerson(personName, unitNames, groupNames, appIdsForType, null, null, null, 99 );
}
if( appIdsForType == null ){
appIdsForType = new ArrayList<>();
}
......@@ -90,7 +93,7 @@ public class ActionListAllManageableAppType extends BaseAction {
wos.add( new Wo( "未分类", Long.parseLong( appIdsForType.size() + "") ));
}
cache.put(new Element( cacheKey, wos ));
CacheManager.put(cacheCategory, cacheKey, wos);
result.setData( wos );
}
}
......
......@@ -21,8 +21,7 @@ public class ActionListNextWithFilter extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionListNextWithFilter.class);
protected ActionResult<List<Wo>> execute(HttpServletRequest request, EffectivePerson effectivePerson, String id,
Integer count, JsonElement jsonElement) throws Exception {
protected ActionResult<List<Wo>> execute(HttpServletRequest request, EffectivePerson effectivePerson, String id, Integer count, JsonElement jsonElement) throws Exception {
ActionResult<List<Wo>> result = new ActionResult<>();
EqualsTerms equals = new EqualsTerms();
InTerms ins = new InTerms();
......@@ -63,8 +62,9 @@ public class ActionListNextWithFilter extends BaseAction {
likes.put("appName", key);
}
}
try {
result = this.standardListNext(Wo.copier, id, count, "sequence", equals, null, likes, ins, null, null,
result = this.standardListNext( Wo.copier, id, count, "sequence", equals, null, likes, ins, null, null,
null, null, true, DESC);
} catch (Exception e) {
result.error(e);
......
package com.x.cms.assemble.control.jaxrs.appinfo;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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.logger.Logger;
......@@ -14,6 +16,7 @@ import net.sf.ehcache.Element;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class ActionListWhatICanManage extends BaseAction {
......@@ -40,12 +43,11 @@ public class ActionListWhatICanManage extends BaseAction {
logger.error(e, effectivePerson, request, null);
}
String cacheKey = ApplicationCache.concreteCacheKey(personName, "manage", isXAdmin);
Element element = cache.get(cacheKey);
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), personName, "manage", isXAdmin );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if ((null != element) && (null != element.getObjectValue())) {
wos = (List<Wo>) element.getObjectValue();
result.setData(wos);
if (optional.isPresent()) {
result.setData((List<Wo>)optional.get());
} else {
if (check) {
if (isXAdmin) {
......@@ -86,7 +88,7 @@ public class ActionListWhatICanManage extends BaseAction {
try {
wos = Wo.copier.copy(appInfoList);
SortTools.asc( wos, "appInfoSeq");
cache.put(new Element(cacheKey, wos));
CacheManager.put(cacheCategory, cacheKey, wos);
result.setData(wos);
} catch (Exception e) {
check = false;
......
package com.x.cms.assemble.control.jaxrs.appinfo;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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.logger.Logger;
......@@ -14,6 +16,7 @@ import net.sf.ehcache.Element;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class ActionListWhatICanManage_WithAppType extends BaseAction {
......@@ -39,12 +42,12 @@ public class ActionListWhatICanManage_WithAppType extends BaseAction {
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
String cacheKey = ApplicationCache.concreteCacheKey(personName, "manage", "appType", appType, isXAdmin);
Element element = cache.get(cacheKey);
if ((null != element) && (null != element.getObjectValue())) {
wos = (List<Wo>) element.getObjectValue();
result.setData(wos);
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), personName, appType, isXAdmin );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if (optional.isPresent()) {
result.setData((List<Wo>)optional.get());
} else {
if (check) {
if (isXAdmin) {
......@@ -85,7 +88,7 @@ public class ActionListWhatICanManage_WithAppType extends BaseAction {
try {
wos = Wo.copier.copy(appInfoList);
SortTools.asc( wos, "appInfoSeq");
cache.put(new Element(cacheKey, wos));
CacheManager.put(cacheCategory, cacheKey, wos);
result.setData(wos);
} catch (Exception e) {
check = false;
......
package com.x.cms.assemble.control.jaxrs.appinfo;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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.logger.Logger;
......@@ -12,6 +14,7 @@ import net.sf.ehcache.Element;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class ActionListWhatICanPublish extends BaseAction {
......@@ -35,15 +38,12 @@ public class ActionListWhatICanPublish extends BaseAction {
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
String cacheKey = ApplicationCache.concreteCacheKey( personName, "all", "publish", isXAdmin, isAnonymous );
Element element = cache.get(cacheKey);
if ((null != element) && (null != element.getObjectValue())) {
wos = (List<Wo>) element.getObjectValue();
result.setData( wos );
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), personName, isAnonymous, isXAdmin );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if (optional.isPresent()) {
result.setData((List<Wo>)optional.get());
} else {
if (check) {
try {
......@@ -73,7 +73,7 @@ public class ActionListWhatICanPublish extends BaseAction {
}
//按appInfoSeq列的值, 排个序
SortTools.asc( wos, "appInfoSeq");
cache.put(new Element( cacheKey, wos ));
CacheManager.put(cacheCategory, cacheKey, wos);
result.setData( wos );
}
}
......
package com.x.cms.assemble.control.jaxrs.appinfo;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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.logger.Logger;
......@@ -12,6 +14,7 @@ import net.sf.ehcache.Element;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class ActionListWhatICanPublish_WithAppType extends BaseAction {
......@@ -35,13 +38,12 @@ public class ActionListWhatICanPublish_WithAppType extends BaseAction {
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
String cacheKey = ApplicationCache.concreteCacheKey( personName, appType, "publish", isXAdmin);
Element element = cache.get(cacheKey);
if ((null != element) && (null != element.getObjectValue())) {
wos = (List<Wo>) element.getObjectValue();
result.setData( wos );
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), personName, appType, isAnonymous, isXAdmin );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if (optional.isPresent()) {
result.setData((List<Wo>)optional.get());
} else {
if (check) {
try {
......@@ -70,7 +72,7 @@ public class ActionListWhatICanPublish_WithAppType extends BaseAction {
}
//按appInfoSeq列的值, 排个序
SortTools.asc( wos, "appInfoSeq");
cache.put(new Element( cacheKey, wos ));
CacheManager.put(cacheCategory, cacheKey, wos);
result.setData( wos );
}
}
......
package com.x.cms.assemble.control.jaxrs.appinfo;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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.logger.Logger;
......@@ -12,6 +14,7 @@ import net.sf.ehcache.Element;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class ActionListWhatICanViewAllDocType extends BaseAction {
......@@ -36,13 +39,12 @@ public class ActionListWhatICanViewAllDocType extends BaseAction {
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
String cacheKey = ApplicationCache.concreteCacheKey(personName, "ViewAppInfoAll", isXAdmin, isAnonymous);
Element element = cache.get(cacheKey);
if ((null != element) && (null != element.getObjectValue())) {
wos = (List<Wo>) element.getObjectValue();
result.setData(wos);
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), personName, isAnonymous, isXAdmin );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if (optional.isPresent()) {
result.setData((List<Wo>)optional.get());
} else {
if (check) {
try {
......@@ -69,7 +71,7 @@ public class ActionListWhatICanViewAllDocType extends BaseAction {
}
//按appInfoSeq列的值, 排个序
SortTools.asc( wos, "appInfoSeq");
cache.put(new Element( cacheKey, wos ));
CacheManager.put(cacheCategory, cacheKey, wos);
result.setData( wos );
}
}
......
package com.x.cms.assemble.control.jaxrs.appinfo;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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.logger.Logger;
......@@ -12,6 +14,7 @@ import net.sf.ehcache.Element;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class ActionListWhatICanViewAllDocType_WithAppType extends BaseAction {
......@@ -36,13 +39,12 @@ public class ActionListWhatICanViewAllDocType_WithAppType extends BaseAction {
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
String cacheKey = ApplicationCache.concreteCacheKey(personName, appType, "AllType", isXAdmin);
Element element = cache.get(cacheKey);
if ((null != element) && (null != element.getObjectValue())) {
wos = (List<Wo>) element.getObjectValue();
result.setData(wos);
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), personName, appType, isAnonymous, isXAdmin );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if (optional.isPresent()) {
result.setData((List<Wo>)optional.get());
} else {
if (check) {
try {
......@@ -71,7 +73,7 @@ public class ActionListWhatICanViewAllDocType_WithAppType extends BaseAction {
}
//按appInfoSeq列的值, 排个序
SortTools.asc( wos, "appInfoSeq");
cache.put(new Element( cacheKey, wos ));
CacheManager.put(cacheCategory, cacheKey, wos);
result.setData( wos );
}
}
......
package com.x.cms.assemble.control.jaxrs.appinfo;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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.logger.Logger;
......@@ -12,6 +14,7 @@ import net.sf.ehcache.Element;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class ActionListWhatICanViewArticle extends BaseAction {
......@@ -40,13 +43,12 @@ public class ActionListWhatICanViewArticle extends BaseAction {
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
String cacheKey = ApplicationCache.concreteCacheKey(personName, "all", "Article", isXAdmin);
Element element = cache.get(cacheKey);
if ((null != element) && (null != element.getObjectValue())) {
wos = (List<Wo>) element.getObjectValue();
result.setData(wos);
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), personName, isAnonymous, isXAdmin );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if (optional.isPresent()) {
result.setData((List<Wo>)optional.get());
} else {
if (check) {
try {
......@@ -76,7 +78,7 @@ public class ActionListWhatICanViewArticle extends BaseAction {
}
//按appInfoSeq列的值, 排个序
SortTools.asc( wos, "appInfoSeq");
cache.put(new Element( cacheKey, wos ));
CacheManager.put(cacheCategory, cacheKey, wos);
result.setData( wos );
}
}
......
package com.x.cms.assemble.control.jaxrs.appinfo;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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.logger.Logger;
......@@ -12,6 +14,7 @@ import net.sf.ehcache.Element;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class ActionListWhatICanViewArticle_WithAppType extends BaseAction {
......@@ -40,13 +43,12 @@ public class ActionListWhatICanViewArticle_WithAppType extends BaseAction {
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
String cacheKey = ApplicationCache.concreteCacheKey(personName, "Article", appType, isXAdmin);
Element element = cache.get(cacheKey);
if ((null != element) && (null != element.getObjectValue())) {
wos = (List<Wo>) element.getObjectValue();
result.setData(wos);
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), personName, appType, isAnonymous, isXAdmin );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if (optional.isPresent()) {
result.setData((List<Wo>)optional.get());
} else {
if (check) {
try {
......@@ -76,7 +78,7 @@ public class ActionListWhatICanViewArticle_WithAppType extends BaseAction {
}
//按appInfoSeq列的值, 排个序
SortTools.asc( wos, "appInfoSeq");
cache.put(new Element( cacheKey, wos ));
CacheManager.put(cacheCategory, cacheKey, wos);
result.setData( wos );
}
}
......
package com.x.cms.assemble.control.jaxrs.appinfo;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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.logger.Logger;
......@@ -12,6 +14,7 @@ import net.sf.ehcache.Element;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class ActionListWhatICanViewData extends BaseAction {
......@@ -36,13 +39,12 @@ public class ActionListWhatICanViewData extends BaseAction {
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
String cacheKey = ApplicationCache.concreteCacheKey(personName, "all", "Data", isXAdmin);
Element element = cache.get(cacheKey);
if ((null != element) && (null != element.getObjectValue())) {
wos = (List<Wo>) element.getObjectValue();
result.setData(wos);
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), personName, isAnonymous, isXAdmin );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if (optional.isPresent()) {
result.setData((List<Wo>)optional.get());
} else {
if (check) {
try {
......@@ -72,7 +74,7 @@ public class ActionListWhatICanViewData extends BaseAction {
}
//按appInfoSeq列的值, 排个序
SortTools.asc( wos, "appInfoSeq");
cache.put(new Element( cacheKey, wos ));
CacheManager.put(cacheCategory, cacheKey, wos);
result.setData( wos );
}
}
......
package com.x.cms.assemble.control.jaxrs.appinfo;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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.logger.Logger;
......@@ -12,6 +14,7 @@ import net.sf.ehcache.Element;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class ActionListWhatICanViewData_WithAppType extends BaseAction {
......@@ -36,13 +39,12 @@ public class ActionListWhatICanViewData_WithAppType extends BaseAction {
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
String cacheKey = ApplicationCache.concreteCacheKey(personName, "Data", appType, isXAdmin);
Element element = cache.get(cacheKey);
if ((null != element) && (null != element.getObjectValue())) {
wos = (List<Wo>) element.getObjectValue();
result.setData(wos);
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), personName, appType, isAnonymous, isXAdmin );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if (optional.isPresent()) {
result.setData((List<Wo>)optional.get());
} else {
if (check) {
try {
......@@ -71,7 +73,7 @@ public class ActionListWhatICanViewData_WithAppType extends BaseAction {
}
//按appInfoSeq列的值, 排个序
SortTools.asc( wos, "appInfoSeq");
cache.put(new Element( cacheKey, wos ));
CacheManager.put(cacheCategory, cacheKey, wos);
result.setData( wos );
}
}
......
......@@ -5,6 +5,8 @@ import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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,6 +21,7 @@ import org.apache.commons.lang3.StringUtils;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class ActionQueryGetControl extends BaseAction {
......@@ -52,12 +55,12 @@ public class ActionQueryGetControl extends BaseAction {
Exception exception = new ExceptionAppInfoIdEmpty();
result.error(exception);
}
String cacheKey = ApplicationCache.concreteCacheKey( id, "getControl", isManager, isAnonymous, effectivePerson.getDistinguishedName() );
Element element = cache.get(cacheKey);
if ((null != element) && (null != element.getObjectValue())) {
wo = (Wo) element.getObjectValue();
result.setData(wo);
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), personName, id, isAnonymous, isManager );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if (optional.isPresent()) {
result.setData((Wo)optional.get());
} else {
woControl = new WoControl();
if( check ){
......@@ -140,7 +143,7 @@ public class ActionQueryGetControl extends BaseAction {
}
}
wo.setControl(woControl);
cache.put(new Element( cacheKey, wo ));
CacheManager.put(cacheCategory, cacheKey, wo);
}
}
result.setData(wo);
......
......@@ -5,11 +5,15 @@ import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.base.core.project.tools.ListTools;
import com.x.cms.assemble.control.service.*;
import com.x.cms.core.entity.AppInfo;
import com.x.cms.core.entity.CategoryInfo;
import com.x.cms.core.entity.element.*;
import com.x.organization.core.entity.*;
import com.x.organization.core.entity.accredit.Empower;
import net.sf.ehcache.Ehcache;
import org.apache.commons.lang3.StringUtils;
......@@ -17,19 +21,18 @@ import java.util.*;
public class BaseAction extends StandardJaxrsAction {
protected Ehcache cache = ApplicationCache.instance().getCache( AppInfo.class );
protected Cache.CacheCategory cacheCategory = new Cache.CacheCategory(AppInfo.class, AppDict.class, AppDictItem.class, View.class,
ViewCategory.class, ViewFieldConfig.class);
protected AppInfoServiceAdv appInfoServiceAdv = new AppInfoServiceAdv();
protected FormServiceAdv formServiceAdv = new FormServiceAdv();
// protected ViewServiceAdv viewServiceAdv = new ViewServiceAdv();
protected ScriptServiceAdv scriptServiceAdv = new ScriptServiceAdv();
protected AppDictServiceAdv appDictServiceAdv = new AppDictServiceAdv();
protected CategoryInfoServiceAdv categoryInfoServiceAdv = new CategoryInfoServiceAdv();
protected DocumentQueryService documentServiceAdv = new DocumentQueryService();
protected UserManagerService userManagerService = new UserManagerService();
protected PermissionQueryService permissionQueryService = new PermissionQueryService();
// protected PermissionOperateService permissionOperateService = new PermissionOperateService();
/**
* 当前登录者访问栏目分类列表查询
* 1、根据人员的访问权限获取可以访问的栏目信息ID列表
......
package com.x.cms.assemble.control.jaxrs.categoryinfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.cache.CacheManager;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.entity.JpaObject;
......@@ -35,13 +38,12 @@ public class ActionGet extends BaseAction {
Exception exception = new ExceptionIdEmpty();
result.error( exception );
}
String cacheKey = ApplicationCache.concreteCacheKey( flag );
Element element = cache.get(cacheKey);
if ((null != element) && ( null != element.getObjectValue()) ) {
wo = ( Wo ) element.getObjectValue();
result.setData( wo );
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), flag );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
result.setData((Wo)optional.get());
} else {
if( check ){
try {
......@@ -62,8 +64,8 @@ public class ActionGet extends BaseAction {
try {
wo = Wo.copier.copy( categoryInfo );
wo.setExtContent( categoryInfoServiceAdv.getExtContentWithId( wo.getId() ));
cache.put(new Element( cacheKey, wo ));
CacheManager.put(cacheCategory, cacheKey, wo);
result.setData( wo );
} catch ( Exception e ) {
check = false;
......
package com.x.cms.assemble.control.jaxrs.categoryinfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.cache.CacheManager;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.entity.JpaObject;
......@@ -35,13 +38,12 @@ public class ActionGetAnonymous extends BaseAction {
Exception exception = new ExceptionIdEmpty();
result.error( exception );
}
String cacheKey = ApplicationCache.concreteCacheKey( flag );
Element element = cache.get(cacheKey);
if ((null != element) && ( null != element.getObjectValue()) ) {
wo = ( Wo ) element.getObjectValue();
result.setData( wo );
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), flag );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
result.setData((Wo)optional.get());
} else {
if( check ){
try {
......@@ -68,8 +70,8 @@ public class ActionGetAnonymous extends BaseAction {
if( check ){
try {
wo = Wo.copier.copy( categoryInfo );
wo.setExtContent( categoryInfoServiceAdv.getExtContentWithId( wo.getId() ));
cache.put(new Element( cacheKey, wo ));
wo.setExtContent( categoryInfoServiceAdv.getExtContentWithId( wo.getId() ));
CacheManager.put(cacheCategory, cacheKey, wo);
result.setData( wo );
} catch ( Exception e ) {
check = false;
......
package com.x.cms.assemble.control.jaxrs.categoryinfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.cache.CacheManager;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.entity.JpaObject;
......@@ -36,13 +39,12 @@ public class ActionGetByAlias extends BaseAction {
Exception exception = new ExceptionIdEmpty();
result.error( exception );
}
String cacheKey = ApplicationCache.concreteCacheKey( "alias", alias );
Element element = cache.get(cacheKey);
if ((null != element) && ( null != element.getObjectValue()) ) {
wo = ( Wo ) element.getObjectValue();
result.setData(wo);
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), alias );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
result.setData((Wo)optional.get());
} else {
if( check ){
try {
......@@ -78,7 +80,7 @@ public class ActionGetByAlias extends BaseAction {
try {
wo = Wo.copier.copy( categoryInfo );
wo.setExtContent( categoryInfoServiceAdv.getExtContentWithId( wo.getId() ));
cache.put(new Element( cacheKey, wo ));
CacheManager.put(cacheCategory, cacheKey, wo);
result.setData( wo );
} catch ( Exception e ) {
check = false;
......
......@@ -2,6 +2,7 @@ package com.x.cms.assemble.control.jaxrs.categoryinfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
......@@ -9,7 +10,8 @@ import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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.logger.Logger;
......@@ -18,8 +20,6 @@ import com.x.base.core.project.tools.ListTools;
import com.x.base.core.project.tools.SortTools;
import com.x.cms.core.entity.CategoryInfo;
import net.sf.ehcache.Element;
public class ActionListAll extends BaseAction {
private static Logger logger = LoggerFactory.getLogger( ActionListAll.class );
......@@ -30,13 +30,12 @@ public class ActionListAll extends BaseAction {
List<Wo> wos = null;
List<CategoryInfo> categoryInfoList = null;
Boolean check = true;
String cacheKey = ApplicationCache.concreteCacheKey( "all" );
Element element = cache.get( cacheKey );
if ((null != element) && ( null != element.getObjectValue()) ) {
wos = ( List<Wo> ) element.getObjectValue();
result.setData(wos);
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass() );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
result.setData((List<Wo>)optional.get());
} else {
try {
categoryInfoList = categoryInfoServiceAdv.listAll();
......@@ -54,7 +53,7 @@ public class ActionListAll extends BaseAction {
wo.setExtContent( categoryInfoServiceAdv.getExtContentWithId( wo.getId() ));
}
SortTools.desc( wos, "categorySeq");
cache.put(new Element( cacheKey, wos ));
CacheManager.put(cacheCategory, cacheKey, wos);
result.setData(wos);
} catch ( Exception e ) {
check = false;
......
......@@ -2,9 +2,12 @@ package com.x.cms.assemble.control.jaxrs.categoryinfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.cache.CacheManager;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.entity.JpaObject;
......@@ -86,13 +89,12 @@ public class ActionListWhatICanPublish extends BaseAction {
}
}
}
String cacheKey = ApplicationCache.concreteCacheKey( personName, appId, "publish", isAnonymous, manager, appManager, appPublisher);
Element element = cache.get(cacheKey);
if ((null != element) && (null != element.getObjectValue())) {
wos = (List<Wo>) element.getObjectValue();
result.setData(wos);
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), personName, appId, isAnonymous, manager, appManager, appPublisher );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
result.setData((List<Wo>)optional.get());
} else {
if (check) {
if ( manager || appManager || appPublisher) {
......@@ -143,7 +145,7 @@ public class ActionListWhatICanPublish extends BaseAction {
wo.setExtContent( categoryInfoServiceAdv.getExtContentWithId( wo.getId() ));
}
SortTools.asc(wos, "categorySeq");
cache.put(new Element(cacheKey, wos));
CacheManager.put(cacheCategory, cacheKey, wos);
} catch (Exception e) {
check = false;
Exception exception = new ExceptionCategoryInfoProcess(e, "将查询出来的分类信息对象转换为可输出的数据信息时发生异常。");
......
......@@ -2,9 +2,12 @@ package com.x.cms.assemble.control.jaxrs.categoryinfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.cache.CacheManager;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.entity.JpaObject;
......@@ -96,12 +99,11 @@ public class ActionListWhatICanView_AllType extends BaseAction {
}
}
String cacheKey = ApplicationCache.concreteCacheKey( personName, appId, "AllType", isXAdmin, appManager, appPublisher, appViewer );
Element element = cache.get(cacheKey);
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), personName, appId, isAnonymous, isXAdmin, appManager, appPublisher, appViewer );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if ((null != element) && (null != element.getObjectValue())) {
wos = (List<Wo>) element.getObjectValue();
result.setData(wos);
if (optional.isPresent()) {
result.setData((List<Wo>)optional.get());
} else {
if (check) {
if ( isXAdmin || appManager || appPublisher || appViewer ) {
......@@ -151,7 +153,7 @@ public class ActionListWhatICanView_AllType extends BaseAction {
wo.setExtContent( categoryInfoServiceAdv.getExtContentWithId( wo.getId() ));
}
SortTools.asc(wos, "categorySeq");
cache.put(new Element(cacheKey, wos));
CacheManager.put(cacheCategory, cacheKey, wos);
result.setData(wos);
} catch (Exception e) {
check = false;
......
......@@ -2,9 +2,12 @@ package com.x.cms.assemble.control.jaxrs.categoryinfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.cache.CacheManager;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.entity.JpaObject;
......@@ -96,12 +99,11 @@ public class ActionListWhatICanView_Article extends BaseAction {
}
}
String cacheKey = ApplicationCache.concreteCacheKey( personName, appId, "Article", manager, appManager, appPublisher, appViewer );
Element element = cache.get(cacheKey);
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), personName, appId, isAnonymous, manager, appManager, appPublisher, appViewer );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if ((null != element) && (null != element.getObjectValue())) {
wos = (List<Wo>) element.getObjectValue();
result.setData(wos);
if (optional.isPresent()) {
result.setData((List<Wo>)optional.get());
} else {
if (check) {
if ( manager || appManager || appPublisher || appViewer ) {
......@@ -151,7 +153,7 @@ public class ActionListWhatICanView_Article extends BaseAction {
wo.setExtContent( categoryInfoServiceAdv.getExtContentWithId( wo.getId() ));
}
SortTools.asc(wos, "categorySeq");
cache.put(new Element(cacheKey, wos));
CacheManager.put(cacheCategory, cacheKey, wos);
result.setData(wos);
} catch (Exception e) {
check = false;
......
......@@ -2,9 +2,12 @@ package com.x.cms.assemble.control.jaxrs.categoryinfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.cache.CacheManager;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.entity.JpaObject;
......@@ -96,12 +99,11 @@ public class ActionListWhatICanView_Data extends BaseAction {
}
}
String cacheKey = ApplicationCache.concreteCacheKey( personName, appId, "Data", isXAdmin, appManager, appPublisher, appViewer );
Element element = cache.get(cacheKey);
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), personName, appId, isAnonymous, isXAdmin, appManager, appPublisher, appViewer );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if ((null != element) && (null != element.getObjectValue())) {
wos = (List<Wo>) element.getObjectValue();
result.setData(wos);
if (optional.isPresent()) {
result.setData((List<Wo>)optional.get());
} else {
if (check) {
if ( isXAdmin || appManager || appPublisher || appViewer ) {
......@@ -152,7 +154,7 @@ public class ActionListWhatICanView_Data extends BaseAction {
wo.setExtContent( categoryInfoServiceAdv.getExtContentWithId( wo.getId() ));
}
SortTools.asc(wos, "categorySeq");
cache.put(new Element(cacheKey, wos));
CacheManager.put(cacheCategory, cacheKey, wos);
result.setData(wos);
} catch (Exception e) {
check = false;
......
......@@ -5,6 +5,8 @@ import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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;
......@@ -20,6 +22,7 @@ import org.apache.commons.lang3.StringUtils;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class ActionQueryGetControl extends BaseAction {
......@@ -54,12 +57,12 @@ public class ActionQueryGetControl extends BaseAction {
Exception exception = new ExceptionCategoryIdEmpty();
result.error(exception);
}
String cacheKey = ApplicationCache.concreteCacheKey( id, "getControl", isManager, isAnonymous, effectivePerson.getDistinguishedName() );
Element element = cache.get(cacheKey);
if ((null != element) && (null != element.getObjectValue())) {
wo = (Wo) element.getObjectValue();
result.setData(wo);
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), personName, id, isAnonymous, isManager );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
result.setData((Wo)optional.get());
} else {
woControl = new WoControl();
if( check ){
......@@ -206,7 +209,7 @@ public class ActionQueryGetControl extends BaseAction {
}
}
wo.setControl(woControl);
cache.put(new Element( cacheKey, wo ));
CacheManager.put(cacheCategory, cacheKey, wo);
}
}
result.setData(wo);
......
package com.x.cms.assemble.control.jaxrs.categoryinfo;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.cms.assemble.control.service.AppInfoServiceAdv;
import com.x.cms.assemble.control.service.CategoryInfoServiceAdv;
import com.x.cms.assemble.control.service.DocumentQueryService;
import com.x.cms.assemble.control.service.PermissionOperateService;
import com.x.cms.assemble.control.service.PermissionQueryService;
import com.x.cms.assemble.control.service.QueryViewService;
import com.x.cms.assemble.control.service.UserManagerService;
import com.x.cms.core.entity.AppInfo;
import com.x.cms.core.entity.CategoryInfo;
import net.sf.ehcache.Ehcache;
import com.x.cms.core.entity.Document;
import com.x.cms.core.entity.element.*;
public class BaseAction extends StandardJaxrsAction {
protected Ehcache cache = ApplicationCache.instance().getCache(CategoryInfo.class);
protected Cache.CacheCategory cacheCategory = new Cache.CacheCategory(AppInfo.class, CategoryInfo.class, ViewCategory.class, Document.class);
protected QueryViewService queryViewService = new QueryViewService();
protected UserManagerService userManagerService = new UserManagerService();
protected AppInfoServiceAdv appInfoServiceAdv = new AppInfoServiceAdv();
protected CategoryInfoServiceAdv categoryInfoServiceAdv = new CategoryInfoServiceAdv();
protected DocumentQueryService documentServiceAdv = new DocumentQueryService();
protected PermissionQueryService permissionQueryService = new PermissionQueryService();
protected PermissionOperateService permissionOperateService = new PermissionOperateService();
}
......@@ -2,9 +2,13 @@ package com.x.cms.assemble.control.jaxrs.comment;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.cache.CacheManager;
import com.x.cms.assemble.control.jaxrs.categoryinfo.ActionListWhatICanView_AllType;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.entity.JpaObject;
......@@ -36,13 +40,12 @@ public class ActionGet extends BaseAction {
Exception exception = new ExceptionCommentIdForQueryEmpty();
result.error( exception );
}
String cacheKey = ApplicationCache.concreteCacheKey( id );
Element element = commentInfoCache.get( cacheKey );
if (( null != element ) && ( null != element.getObjectValue()) ) {
wo = ( Wo ) element.getObjectValue();
result.setData( wo );
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), id );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
result.setData((Wo)optional.get());
} else {
if( check ){
try {
......@@ -65,7 +68,7 @@ public class ActionGet extends BaseAction {
if( wo != null ) {
wo.setContent( documentCommentInfoQueryService.getCommentContent(id));
}
commentInfoCache.put(new Element( cacheKey, wo ));
CacheManager.put(cacheCategory, cacheKey, wo);
result.setData( wo );
} catch (Exception e) {
Exception exception = new CommentQueryException( e, "将查询出来的应用栏目信息对象转换为可输出的数据信息时发生异常。" );
......
......@@ -6,6 +6,8 @@ import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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.logger.Logger;
......@@ -19,6 +21,7 @@ import org.apache.commons.lang3.StringUtils;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class ActionListNextWithFilter extends BaseAction {
......@@ -30,7 +33,6 @@ public class ActionListNextWithFilter extends BaseAction {
List<Wo> wos = new ArrayList<>();
Wi wrapIn = null;
Boolean check = true;
String cacheKey = null;
Element element = null;
QueryFilter queryFilter = null;
......@@ -51,11 +53,13 @@ public class ActionListNextWithFilter extends BaseAction {
queryFilter = wrapIn.getQueryFilter();
}
if( check ) {
cacheKey = ApplicationCache.concreteCacheKey( "ActionListNextWithFilter", effectivePerson.getDistinguishedName(), flag, count,
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), effectivePerson.getDistinguishedName(), flag, count,
wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() );
element = commentInfoCache.get( cacheKey );
if ((null != element) && (null != element.getObjectValue())) {
resultObject = (ResultObject) element.getObjectValue();
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
resultObject = (ResultObject) optional.get();
result.setCount( resultObject.getTotal() );
result.setData( resultObject.getWos() );
} else {
......@@ -71,8 +75,8 @@ public class ActionListNextWithFilter extends BaseAction {
}
}
resultObject = new ResultObject( total, wos );
commentInfoCache.put(new Element( cacheKey, resultObject ));
CacheManager.put(cacheCategory, cacheKey, resultObject );
result.setCount( resultObject.getTotal() );
result.setData( resultObject.getWos() );
} catch (Exception e) {
......
......@@ -6,6 +6,8 @@ import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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.logger.Logger;
......@@ -18,6 +20,7 @@ import net.sf.ehcache.Element;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class ActionListPageWithFilter extends BaseAction {
......@@ -30,7 +33,6 @@ public class ActionListPageWithFilter extends BaseAction {
ResultObject resultObject = null;
Wi wrapIn = null;
Boolean check = true;
String cacheKey = null;
Element element = null;
QueryFilter queryFilter = null;
......@@ -46,17 +48,14 @@ public class ActionListPageWithFilter extends BaseAction {
if( check ) {
queryFilter = wrapIn.getQueryFilter();
}
if( check ) {
cacheKey = ApplicationCache.concreteCacheKey( "ActionListPageWithFilter", effectivePerson.getDistinguishedName(),
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), effectivePerson.getDistinguishedName(),
pageNum, count, wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() );
element = commentInfoCache.get( cacheKey );
}
if( check ) {
if ((null != element) && (null != element.getObjectValue())) {
resultObject = (ResultObject) element.getObjectValue();
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
resultObject = (ResultObject)optional.get();
result.setCount( resultObject.getTotal() );
result.setData( resultObject.getWos() );
} else {
......@@ -73,7 +72,7 @@ public class ActionListPageWithFilter extends BaseAction {
}
resultObject = new ResultObject( total, wos );
commentInfoCache.put(new Element( cacheKey, resultObject ));
CacheManager.put(cacheCategory, cacheKey, resultObject );
result.setCount( resultObject.getTotal() );
result.setData( resultObject.getWos() );
} catch (Exception e) {
......
......@@ -6,6 +6,8 @@ import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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.logger.Logger;
......@@ -19,6 +21,7 @@ import org.apache.commons.lang3.StringUtils;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class ActionListPrevWithFilter extends BaseAction {
......@@ -30,8 +33,6 @@ public class ActionListPrevWithFilter extends BaseAction {
List<Wo> wos = new ArrayList<>();
Wi wrapIn = null;
Boolean check = true;
String cacheKey = null;
Element element = null;
QueryFilter queryFilter = null;
if ( StringUtils.isEmpty( flag ) || "(0)".equals(flag)) {
......@@ -52,12 +53,12 @@ public class ActionListPrevWithFilter extends BaseAction {
}
if( check ) {
cacheKey = ApplicationCache.concreteCacheKey( "ActionListPrevWithFilter", effectivePerson.getDistinguishedName(),
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), effectivePerson.getDistinguishedName(),
flag, count, wrapIn.getOrderField(), wrapIn.getOrderType(), queryFilter.getContentSHA1() );
element = commentInfoCache.get( cacheKey );
if ((null != element) && (null != element.getObjectValue())) {
resultObject = (ResultObject) element.getObjectValue();
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
resultObject = (ResultObject)optional.get();
result.setCount( resultObject.getTotal() );
result.setData( resultObject.getWos() );
} else {
......@@ -74,7 +75,7 @@ public class ActionListPrevWithFilter extends BaseAction {
}
resultObject = new ResultObject( total, wos );
commentInfoCache.put(new Element( cacheKey, resultObject ));
CacheManager.put(cacheCategory, cacheKey, resultObject );
result.setCount( resultObject.getTotal() );
result.setData( resultObject.getWos() );
} catch (Exception e) {
......
package com.x.cms.assemble.control.jaxrs.comment;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.cms.assemble.control.service.CommentCommendPersistService;
import com.x.cms.assemble.control.service.DocumentCommentInfoPersistService;
import com.x.cms.assemble.control.service.DocumentCommentInfoQueryService;
import com.x.cms.assemble.control.service.DocumentQueryService;
import com.x.cms.core.entity.AppInfo;
import com.x.cms.core.entity.CategoryInfo;
import com.x.cms.core.entity.Document;
import com.x.cms.core.entity.DocumentCommentInfo;
import com.x.cms.core.entity.element.ViewCategory;
import net.sf.ehcache.Ehcache;
public class BaseAction extends StandardJaxrsAction {
protected Ehcache commentInfoCache = ApplicationCache.instance().getCache( DocumentCommentInfo.class );
protected Cache.CacheCategory cacheCategory = new Cache.CacheCategory(DocumentCommentInfo.class, Document.class);
protected DocumentCommentInfoPersistService documentCommentInfoPersistService = new DocumentCommentInfoPersistService();
......
......@@ -10,7 +10,6 @@ import com.google.gson.JsonElement;
import com.x.base.core.entity.dataitem.DataItemConverter;
import com.x.base.core.entity.dataitem.ItemCategory;
import com.x.base.core.entity.dataitem.ItemType;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.gson.XGsonBuilder;
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.cms.assemble.control.Business;
......@@ -20,14 +19,11 @@ import com.x.cms.assemble.control.service.UserManagerService;
import com.x.cms.core.entity.Document;
import com.x.query.core.entity.Item;
import net.sf.ehcache.Ehcache;
public class BaseAction extends StandardJaxrsAction {
private static final String title_path = "title";
private static final String subject_path = "subject";
protected Ehcache cache = ApplicationCache.instance().getCache( Item.class);
// protected Cache.CacheCategory cacheCategory = new Cache.CacheCategory(Item.class, Document.class);
protected UserManagerService userManagerService = new UserManagerService();
protected CategoryInfoServiceAdv categoryInfoServiceAdv = new CategoryInfoServiceAdv();
protected DocumentQueryService documentServiceAdv = new DocumentQueryService();
......
package com.x.cms.assemble.control.jaxrs.document;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.cache.CacheManager;
import com.x.cms.assemble.control.jaxrs.comment.ActionListNextWithFilter;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.entity.JpaObject;
......@@ -90,11 +94,11 @@ public class ActionQueryGetControl extends BaseAction {
}
}
String cacheKey = ApplicationCache.concreteCacheKey( id, "getControl", isManager, effectivePerson.getDistinguishedName() );
Element element = cache.get(cacheKey);
if ((null != element) && (null != element.getObjectValue())) {
wo = (Wo) element.getObjectValue();
result.setData(wo);
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), effectivePerson.getDistinguishedName(), id, isManager );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
result.setData((Wo) optional.get());
woControl = wo.getControl();
} else {
if (check) {
......@@ -121,7 +125,7 @@ public class ActionQueryGetControl extends BaseAction {
if (check) {
wo.setControl(woControl);
cache.put(new Element(cacheKey, wo));
CacheManager.put(cacheCategory, cacheKey, wo );
}
}
......
......@@ -2,9 +2,12 @@ package com.x.cms.assemble.control.jaxrs.document;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.cache.CacheManager;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.entity.JpaObject;
......@@ -68,10 +71,11 @@ public class ActionQueryGetDocument extends BaseAction {
}
}
String cacheKey = ApplicationCache.concreteCacheKey( id, "get", isManager, effectivePerson.getDistinguishedName() );
Element element = cache.get(cacheKey);
if ((null != element) && (null != element.getObjectValue())) {
wo = (Wo) element.getObjectValue();
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), id, effectivePerson.getDistinguishedName(), isManager );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
wo = (Wo) optional.get();
document = wo.getDocument();
wrapOutDocument = wo.getDocument();
result.setData(wo);
......@@ -155,7 +159,7 @@ public class ActionQueryGetDocument extends BaseAction {
if (check) {
wo.setDocumentLogList(new ArrayList<WoLog>());
cache.put(new Element(cacheKey, wo));
CacheManager.put(cacheCategory, cacheKey, wo );
}
}
......
package com.x.cms.assemble.control.jaxrs.document;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.cache.CacheManager;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.project.annotation.FieldDescribe;
......@@ -26,11 +29,11 @@ public class ActionQueryGetFirstPicture extends BaseAction {
Wo wo = null;
Boolean check = true;
String cacheKey = getCacheKeyFormWrapInFilter( "firstpicture", id );
Element element = cache.get(cacheKey);
if ((null != element) && ( null != element.getObjectValue()) ) {
wo = ( Wo ) element.getObjectValue();
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), id );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
wo = (Wo) optional.get();
result.setData( wo );
result.setCount( 1L );
} else {
......@@ -63,8 +66,8 @@ public class ActionQueryGetFirstPicture extends BaseAction {
wo.setFileName( file.getFileName() );
wo.setFilePath( file.getFilePath() );
wo.setFileType( file.getFileType() );
cache.put( new Element( cacheKey, wo ) );
CacheManager.put(cacheCategory, cacheKey, wo );
result.setData( wo );
result.setCount( 1L );
......
......@@ -2,9 +2,12 @@ package com.x.cms.assemble.control.jaxrs.document;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.cache.CacheManager;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.project.annotation.FieldDescribe;
......@@ -29,11 +32,11 @@ public class ActionQueryListAllPictures extends BaseAction {
Wo wo = null;
Boolean check = true;
String cacheKey = getCacheKeyFormWrapInFilter( "pictures", id );
Element element = cache.get(cacheKey);
if ((null != element) && ( null != element.getObjectValue()) ) {
wos = ( List<Wo> ) element.getObjectValue();
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), id );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
wos = ( List<Wo> ) optional.get();
result.setData(wos);
result.setCount( Long.parseLong( wos.size() + "" ) );
} else {
......@@ -69,7 +72,7 @@ public class ActionQueryListAllPictures extends BaseAction {
wos.add( wo );
}
result.setData( wos );
cache.put( new Element( cacheKey, wos ) );
CacheManager.put(cacheCategory, cacheKey, wos );
result.setCount( Long.parseLong( wos.size() + "" ) );
}
}
......
......@@ -2,6 +2,7 @@ package com.x.cms.assemble.control.jaxrs.document;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
......@@ -11,14 +12,14 @@ import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.cms.core.entity.Document;
import net.sf.ehcache.Element;
public class ActionQueryListDraftNextWithFilter extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionQueryListDraftNextWithFilter.class);
......@@ -40,11 +41,11 @@ public class ActionQueryListDraftNextWithFilter extends BaseAction {
logger.error(e, effectivePerson, request, null);
}
String cacheKey = getCacheKeyFormWrapInFilter("draft", id, count, wi);
Element element = cache.get(cacheKey);
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), id, count, wi );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if ((null != element) && (null != element.getObjectValue())) {
wos = (List<Wo>) element.getObjectValue();
if (optional.isPresent()) {
wos = ( List<Wo> ) optional.get();
result.setData(wos);
} else {
if (check) {
......@@ -74,7 +75,7 @@ public class ActionQueryListDraftNextWithFilter extends BaseAction {
}
}
result.setCount(Long.parseLong(documentList.size() + ""));
cache.put(new Element(cacheKey, wos));
CacheManager.put(cacheCategory, cacheKey, wos );
result.setData(wos);
} catch (Exception e) {
Exception exception = new ExceptionDocumentInfoProcess(e, "系统在将分页查询结果转换为可输出的数据信息时发生异常。");
......
......@@ -3,9 +3,12 @@ package com.x.cms.assemble.control.jaxrs.document;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.cache.CacheManager;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.project.cache.ApplicationCache;
......@@ -51,10 +54,11 @@ public class ActionQueryListVisiblePersons extends BaseAction {
result.error(exception);
}
String cacheKey = ApplicationCache.concreteCacheKey( id, "ActionQueryListVisiblePersons" );
Element element = cache.get(cacheKey);
if ((null != element) && (null != element.getObjectValue())) {
wo = (Wo) element.getObjectValue();
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), id );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
wo = ( Wo ) optional.get();
result.setData(wo);
} else {
if (check) {
......@@ -135,7 +139,7 @@ public class ActionQueryListVisiblePersons extends BaseAction {
wo.setValueList(persons);
result.setData(wo);
result.setCount( Long.parseLong( persons.size() + ""));
cache.put(new Element(cacheKey, wo));
CacheManager.put(cacheCategory, cacheKey, wo );
}
}
return result;
......
......@@ -2,9 +2,12 @@ package com.x.cms.assemble.control.jaxrs.document;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.cache.CacheManager;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.entity.JpaObject;
......@@ -60,16 +63,16 @@ public class ActionQueryViewDocument extends BaseAction {
}
}
String cacheKey = ApplicationCache.concreteCacheKey( id, "view", isAnonymous, isManager, effectivePerson.getDistinguishedName() );
Element element = cache.get(cacheKey);
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), id, isAnonymous, isManager, effectivePerson.getDistinguishedName() );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if ((null != element) && (null != element.getObjectValue())) {
result = (ActionResult<Wo>) element.getObjectValue();
if (optional.isPresent()) {
result = (ActionResult<Wo>) optional.get();
} else {
logger.debug(">>>>>>>>>>>>>view document '"+id+"' in database!" );
//继续进行数据查询
result = getDocumentQueryResult( id, request, effectivePerson, isManager );
cache.put(new Element(cacheKey, result ));
CacheManager.put(cacheCategory, cacheKey, result );
}
if (check ) {
......
package com.x.cms.assemble.control.jaxrs.document;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
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.cache.ApplicationCache;
import com.x.base.core.project.config.StorageMapping;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.base.core.project.tools.ListTools;
import com.x.cms.assemble.control.Business;
import com.x.cms.assemble.control.service.AppInfoServiceAdv;
import com.x.cms.assemble.control.service.CategoryInfoServiceAdv;
import com.x.cms.assemble.control.service.DocCommendPersistService;
import com.x.cms.assemble.control.service.DocCommendQueryService;
import com.x.cms.assemble.control.service.DocumentPersistService;
import com.x.cms.assemble.control.service.DocumentQueryService;
import com.x.cms.assemble.control.service.DocumentViewRecordServiceAdv;
import com.x.cms.assemble.control.service.FileInfoServiceAdv;
import com.x.cms.assemble.control.service.FormServiceAdv;
import com.x.cms.assemble.control.service.LogService;
import com.x.cms.assemble.control.service.PermissionOperateService;
import com.x.cms.assemble.control.service.PermissionQueryService;
import com.x.cms.assemble.control.service.QueryViewService;
import com.x.cms.assemble.control.service.UserManagerService;
import com.x.cms.core.entity.AppInfo;
import com.x.cms.core.entity.CategoryInfo;
import com.x.cms.core.entity.Document;
import com.x.cms.core.entity.FileInfo;
import net.sf.ehcache.Ehcache;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;
import com.x.cms.core.entity.*;
import com.x.query.core.entity.Item;
public class BaseAction extends StandardJaxrsAction {
protected Ehcache cache = ApplicationCache.instance().getCache( Document.class);
protected Cache.CacheCategory cacheCategory = new Cache.CacheCategory(Item.class, Document.class, DocumentCommentInfo.class);
protected LogService logService = new LogService();
protected QueryViewService queryViewService = new QueryViewService();
protected DocumentViewRecordServiceAdv documentViewRecordServiceAdv = new DocumentViewRecordServiceAdv();
......@@ -46,16 +35,14 @@ public class BaseAction extends StandardJaxrsAction {
protected DocumentQueryService documentQueryService = new DocumentQueryService();
protected DocCommendPersistService docCommendPersistService = new DocCommendPersistService();
// protected DocCommendQueryService docCommendQueryService = new DocCommendQueryService();
protected FormServiceAdv formServiceAdv = new FormServiceAdv();
protected CategoryInfoServiceAdv categoryInfoServiceAdv = new CategoryInfoServiceAdv();
protected AppInfoServiceAdv appInfoServiceAdv = new AppInfoServiceAdv();
protected UserManagerService userManagerService = new UserManagerService();
protected FileInfoServiceAdv fileInfoServiceAdv = new FileInfoServiceAdv();
protected PermissionQueryService permissionQueryService = new PermissionQueryService();
// protected PermissionOperateService permissionOperateService = new PermissionOperateService();
protected boolean modifyDocStatus( String id, String stauts, String personName ) throws Exception{
Business business = null;
Document document = null;
......
......@@ -46,22 +46,7 @@ class ActionFileEdit extends BaseAction {
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
// Boolean isAnonymous = effectivePerson.isAnonymous();
// Boolean isManager = false;
// if (check) {
// try {
// if ( effectivePerson.isManager() ) {
// isManager = true;
// }
// } catch (Exception e) {
// check = false;
// Exception exception = new ExceptionFileInfoProcess(e, "判断用户是否是系统管理员时发生异常!user:" + effectivePerson.getDistinguishedName() );
// result.error(exception);
// logger.error(e, effectivePerson, request, null);
// }
// }
if (check) {
try {
doc = documentQueryService.get(docId);
......@@ -131,20 +116,7 @@ class ActionFileEdit extends BaseAction {
Wo wo = new Wo();
wo.setId(file.getId());
result.setData(wo);
//
// List<String> keys = new ArrayList<>();
// keys.add( "file.all" ); //清除文档的附件列表缓存
// keys.add( "file." + id ); //清除指定ID的附件信息缓存
// keys.add( ApplicationCache.concreteCacheKey( "document", docId, isAnonymous, isManager ) ); //清除文档的附件列表缓存
// ApplicationCache.notify( FileInfo.class, keys );
//
// keys.clear();
// keys.add( ApplicationCache.concreteCacheKey( docId, "view", isAnonymous, isManager ) ); //清除文档阅读缓存
// keys.add( ApplicationCache.concreteCacheKey( docId, "get", isManager ) ); //清除文档信息获取缓存
// System.out.println(">>>>>>>>>>>>>clean cache document:" + ApplicationCache.concreteCacheKey( docId, "view", isAnonymous, isManager ) );
// System.out.println(">>>>>>>>>>>>>clean cache document:" + ApplicationCache.concreteCacheKey( docId, "get", isManager ) );
// ApplicationCache.notify( Document.class, keys );
ApplicationCache.notify( FileInfo.class );
ApplicationCache.notify( Document.class );
} catch (Exception e) {
......
......@@ -2,6 +2,7 @@ package com.x.cms.assemble.control.jaxrs.fileinfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
......@@ -11,8 +12,11 @@ import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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.cms.assemble.control.jaxrs.comment.ActionListPrevWithFilter;
import com.x.cms.core.entity.Document;
import com.x.cms.core.entity.FileInfo;
......@@ -24,11 +28,12 @@ public class ActionGet extends BaseAction {
ActionResult<Wo> result = new ActionResult<>();
Wo wrap = null;
List<String> attachmentIds = null;
String cacheKey = ApplicationCache.concreteCacheKey( "file."+id );
Element element = cache.get(cacheKey);
if ((null != element) && ( null != element.getObjectValue()) ) {
wrap = ( Wo ) element.getObjectValue();
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), id );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
wrap = ( Wo ) optional.get();
result.setData(wrap);
} else {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
......@@ -47,7 +52,7 @@ public class ActionGet extends BaseAction {
}
//如果信息存在,则需要向客户端返回信息,先将查询出来的JPA对象COPY到一个普通JAVA对象里,再进行返回
wrap = Wo.copier.copy( fileInfo );
cache.put(new Element( cacheKey, wrap ));
CacheManager.put(cacheCategory, cacheKey, wrap );
result.setData(wrap);
} catch (Throwable th) {
th.printStackTrace();
......
......@@ -3,10 +3,13 @@ package com.x.cms.assemble.control.jaxrs.fileinfo;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.util.Optional;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.cache.CacheManager;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
......@@ -35,11 +38,12 @@ public class ActionImageToBase64 extends BaseAction {
FileInfo fileInfo = null;
Integer sizeNum = null;
Boolean check = true;
String cacheKey = ApplicationCache.concreteCacheKey( "base64", id, size );
Element element = cache.get(cacheKey);
if ((null != element) && ( null != element.getObjectValue()) ) {
wrap = ( WrapOutString ) element.getObjectValue();
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), id, size );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
wrap = ( WrapOutString ) optional.get();
result.setData(wrap);
} else {
if( check ){
......@@ -108,7 +112,7 @@ public class ActionImageToBase64 extends BaseAction {
ImageIO.write( image, "png", output );
wrap = new WrapOutString();
wrap.setValue(Base64.encodeBase64String( output.toByteArray() ));
cache.put(new Element( cacheKey, wrap ));
CacheManager.put(cacheCategory, cacheKey, wrap );
result.setData( wrap );
}catch( Exception e ){
check = false;
......
......@@ -2,6 +2,7 @@ package com.x.cms.assemble.control.jaxrs.fileinfo;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
......@@ -11,8 +12,11 @@ import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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.http.WrapOutString;
import com.x.base.core.project.tools.SortTools;
import com.x.cms.assemble.control.Business;
import com.x.cms.assemble.control.factory.FileInfoFactory;
......@@ -26,11 +30,12 @@ public class ActionListAll extends BaseAction {
protected ActionResult<List<Wo>> execute( HttpServletRequest request, EffectivePerson effectivePerson ) throws Exception {
ActionResult<List<Wo>> result = new ActionResult<>();
List<Wo> wraps = null;
String cacheKey = ApplicationCache.concreteCacheKey( "file.all" );
Element element = cache.get(cacheKey);
if ((null != element) && ( null != element.getObjectValue()) ) {
wraps = ( List<Wo> ) element.getObjectValue();
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass() );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
wraps = ( List<Wo> ) optional.get();
result.setData(wraps);
} else {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
......@@ -45,7 +50,7 @@ public class ActionListAll extends BaseAction {
List<FileInfo> fileInfoList = emc.list( FileInfo.class, ids );//查询ID IN ids 的所有文件或者附件信息列表
wraps = Wo.copier.copy( fileInfoList );//将所有查询出来的有状态的对象转换为可以输出的过滤过属性的对象
SortTools.asc( wraps, "sequence" );
cache.put(new Element( cacheKey, wraps ));
CacheManager.put(cacheCategory, cacheKey, wraps );
result.setData(wraps);
} catch (Throwable th) {
th.printStackTrace();
......
......@@ -3,6 +3,7 @@ package com.x.cms.assemble.control.jaxrs.fileinfo;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
......@@ -13,6 +14,8 @@ import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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;
......@@ -33,9 +36,6 @@ public class ActionListByDocId extends BaseAction {
protected ActionResult<List<Wo>> execute(HttpServletRequest request, EffectivePerson effectivePerson, String docId ) throws Exception {
ActionResult<List<Wo>> result = new ActionResult<>();
List<Wo> wos = null;
// AppInfo appInfo = null;
// CategoryInfo categoryInfo = null;
// Document document = null;
Boolean isAnonymous = effectivePerson.isAnonymous();
Boolean isManager = false;
Boolean check = true;
......@@ -53,61 +53,13 @@ public class ActionListByDocId extends BaseAction {
}
}
String cacheKey = ApplicationCache.concreteCacheKey( "document", docId, isAnonymous, isManager, effectivePerson.getDistinguishedName() );
Element element = cache.get(cacheKey);
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), docId, isAnonymous, isManager, effectivePerson.getDistinguishedName() );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if ( (null != element) && (null != element.getObjectValue()) ) {
wos = (List<Wo>) element.getObjectValue();
if (optional.isPresent()) {
wos = (List<Wo>) optional.get();
result.setData(wos);
} else {
// if (check) {
// try {
// document = documentQueryService.get( docId );
// if (document == null) {
// check = false;
// Exception exception = new ExceptionDocumentNotExists( docId );
// result.error(exception);
// }
// } catch (Exception e) {
// check = false;
// Exception exception = new ExceptionFileInfoProcess(e, "文档信息获取操作时发生异常。Id:" + docId + ", Name:" + effectivePerson.getDistinguishedName());
// result.error(exception);
// logger.error(e, effectivePerson, request, null);
// }
// }
//
// if (check) {
// try {
// categoryInfo = categoryInfoServiceAdv.get( document.getCategoryId() );
// if (categoryInfo == null) {
// check = false;
// Exception exception = new ExceptionCategoryInfoNotExists(document.getCategoryId());
// result.error(exception);
// }
// } catch (Exception e) {
// check = false;
// Exception exception = new ExceptionFileInfoProcess(e, "系统在根据ID查询分类信息时发生异常!ID:" + document.getCategoryId());
// result.error(exception);
// logger.error(e, effectivePerson, request, null);
// }
// }
//
// if (check) {
// try {
// appInfo = appInfoServiceAdv.get( categoryInfo.getAppId() );
// if (appInfo == null) {
// check = false;
// Exception exception = new ExceptionAppInfoNotExists(categoryInfo.getAppId());
// result.error(exception);
// }
// } catch (Exception e) {
// check = false;
// Exception exception = new ExceptionFileInfoProcess(e, "系统在根据ID查询应用栏目信息时发生异常!ID:" + categoryInfo.getAppId());
// result.error(exception);
// logger.error(e, effectivePerson, request, null);
// }
// }
if (check) {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
......@@ -131,7 +83,7 @@ public class ActionListByDocId extends BaseAction {
}
}
wos = wos.stream().sorted(Comparator.comparing(Wo::getCreateTime)).collect(Collectors.toList());
cache.put(new Element(cacheKey, wos));
CacheManager.put(cacheCategory, cacheKey, wos );
result.setData(wos);
} catch (Throwable th) {
th.printStackTrace();
......
package com.x.cms.assemble.control.jaxrs.fileinfo;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.cms.assemble.control.service.AppInfoServiceAdv;
import com.x.cms.assemble.control.service.CategoryInfoServiceAdv;
import com.x.cms.assemble.control.service.DocumentQueryService;
import com.x.cms.assemble.control.service.FileInfoServiceAdv;
import com.x.cms.assemble.control.service.LogService;
import com.x.cms.core.entity.Document;
import com.x.cms.core.entity.FileInfo;
import net.sf.ehcache.Ehcache;
public class BaseAction extends StandardJaxrsAction {
protected Ehcache cache = ApplicationCache.instance().getCache( FileInfo.class);
protected Cache.CacheCategory cacheCategory = new Cache.CacheCategory(FileInfo.class, Document.class);
protected LogService logService = new LogService();
protected FileInfoServiceAdv fileInfoServiceAdv = new FileInfoServiceAdv();
protected CategoryInfoServiceAdv categoryInfoServiceAdv = new CategoryInfoServiceAdv();
protected AppInfoServiceAdv appInfoServiceAdv = new AppInfoServiceAdv();
......
......@@ -2,6 +2,7 @@ package com.x.cms.assemble.control.jaxrs.form;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
......@@ -11,8 +12,11 @@ import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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.http.WrapOutString;
import com.x.cms.assemble.control.Business;
import com.x.cms.core.entity.element.Form;
......@@ -24,11 +28,11 @@ public class ActionGet extends BaseAction {
ActionResult<Wo> result = new ActionResult<>();
Wo wo = null;
String cacheKey = ApplicationCache.concreteCacheKey( id );
Element element = cache.get(cacheKey);
if ((null != element) && ( null != element.getObjectValue()) ) {
wo = (Wo) element.getObjectValue();
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), id );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
wo = (Wo)optional.get();
result.setData( wo );
} else {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
......@@ -39,7 +43,7 @@ public class ActionGet extends BaseAction {
}
wo = new Wo();
Wo.copier.copy( form, wo );
cache.put(new Element( cacheKey, wo ));
CacheManager.put(cacheCategory, cacheKey, wo );
result.setData( wo );
} catch (Throwable th) {
th.printStackTrace();
......
......@@ -2,6 +2,7 @@ package com.x.cms.assemble.control.jaxrs.form;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
......@@ -11,6 +12,8 @@ import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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.cms.assemble.control.Business;
......@@ -25,11 +28,11 @@ public class ActionGetWithAppInfo extends BaseAction {
ActionResult<Wo> result = new ActionResult<>();
Wo wo = null;
String cacheKey = ApplicationCache.concreteCacheKey( "getWithAppInfo", formFlag, appFlag );
Element element = cache.get(cacheKey);
if ((null != element) && ( null != element.getObjectValue()) ) {
wo = (Wo) element.getObjectValue();
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), formFlag, appFlag );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
wo = (Wo) optional.get();
result.setData( wo );
} else {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
......@@ -44,7 +47,7 @@ public class ActionGetWithAppInfo extends BaseAction {
}
wo = new Wo();
Wo.copier.copy( form, wo );
cache.put(new Element( cacheKey, wo ));
CacheManager.put(cacheCategory, cacheKey, wo );
result.setData( wo );
} catch (Throwable th) {
th.printStackTrace();
......
......@@ -2,6 +2,7 @@ package com.x.cms.assemble.control.jaxrs.form;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
......@@ -11,6 +12,8 @@ import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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.SortTools;
......@@ -27,11 +30,11 @@ public class ActionListAll extends BaseAction {
ActionResult<List<Wo>> result = new ActionResult<>();
List<Wo> wraps = null;
String cacheKey = ApplicationCache.concreteCacheKey( "all" );
Element element = cache.get(cacheKey);
if ((null != element) && ( null != element.getObjectValue()) ) {
wraps = (List<Wo>) element.getObjectValue();
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass() );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
wraps = (List<Wo>) optional.get();
result.setData(wraps);
} else {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
......@@ -39,10 +42,9 @@ public class ActionListAll extends BaseAction {
FormFactory formFactory = business.getFormFactory();
List<String> ids = formFactory.listAll();// 获取所有表单模板列表
List<Form> formList = emc.list( Form.class, ids );// 查询ID IN ids 的所有表单模板信息列表
// formFactory.list(ids);
wraps = Wo.copier.copy( formList );// 将所有查询出来的有状态的对象转换为可以输出的过滤过属性的对象
SortTools.desc(wraps, "createTime" );
cache.put(new Element( cacheKey, wraps ));
CacheManager.put(cacheCategory, cacheKey, wraps );
result.setData(wraps);
} catch (Throwable th) {
th.printStackTrace();
......
......@@ -2,6 +2,7 @@ package com.x.cms.assemble.control.jaxrs.form;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
......@@ -11,6 +12,8 @@ import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
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.SortTools;
......@@ -27,11 +30,11 @@ public class ActionListByApp extends BaseAction {
ActionResult<List<Wo>> result = new ActionResult<>();
List<Wo> wraps = null;
String cacheKey = ApplicationCache.concreteCacheKey( "appId", appId );
Element element = cache.get(cacheKey);
if ((null != element) && ( null != element.getObjectValue()) ) {
wraps = (List<Wo>) element.getObjectValue();
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), appId );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
wraps = (List<Wo>) optional.get();
result.setData(wraps);
} else {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
......@@ -42,10 +45,9 @@ public class ActionListByApp extends BaseAction {
FormFactory formFactory = business.getFormFactory();
List<String> ids = formFactory.listByAppId(appId);// 获取指定应用的所有表单模板列表
List<Form> formList = emc.list( Form.class, ids );
// formFactory.list(ids);
wraps = Wo.copier.copy(formList);// 将所有查询出来的有状态的对象转换为可以输出的过滤过属性的对象
SortTools.desc( wraps, "createTime" );
cache.put(new Element( cacheKey, wraps ));
CacheManager.put(cacheCategory, cacheKey, wraps );
result.setData(wraps);
} catch (Throwable th) {
th.printStackTrace();
......
package com.x.cms.assemble.control.jaxrs.form;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.cms.assemble.control.service.LogService;
import com.x.cms.core.entity.element.Form;
import net.sf.ehcache.Ehcache;
import com.x.cms.core.entity.element.View;
import com.x.cms.core.entity.element.ViewCategory;
import com.x.cms.core.entity.element.ViewFieldConfig;
public class BaseAction extends StandardJaxrsAction {
protected Ehcache cache = ApplicationCache.instance().getCache( Form.class);
protected Cache.CacheCategory cacheCategory = new Cache.CacheCategory(Form.class, View.class, ViewFieldConfig.class, ViewCategory.class);
protected LogService logService = new LogService();
}
package com.x.cms.assemble.control.jaxrs.image;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.cms.assemble.control.service.DocumentQueryService;
import com.x.cms.assemble.control.service.FileInfoServiceAdv;
import com.x.cms.assemble.control.service.LogService;
import com.x.cms.core.entity.FileInfo;
import net.sf.ehcache.Ehcache;
public class BaseAction extends StandardJaxrsAction {
protected Ehcache cache = ApplicationCache.instance().getCache( FileInfo.class);
protected LogService logService = new LogService();
protected FileInfoServiceAdv fileInfoServiceAdv = new FileInfoServiceAdv();
......
......@@ -9,24 +9,19 @@ import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import com.x.base.core.project.cache.Cache;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.base.core.project.tools.StringTools;
import com.x.cms.assemble.control.Business;
import com.x.cms.core.entity.AppInfo;
import com.x.cms.core.entity.AppInfo_;
import net.sf.ehcache.Ehcache;
abstract class BaseAction extends StandardJaxrsAction {
protected Ehcache inputCache = ApplicationCache.instance().getCache(BaseAction.class.getName(), 100,
ApplicationCache.MINUTES_20, ApplicationCache.MINUTES_20);
public enum Method {
cover, create, ignore;
}
......
......@@ -5,6 +5,7 @@ import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.entity.dataitem.DataItemConverter;
import com.x.base.core.project.annotation.FieldDescribe;
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;
......@@ -55,7 +56,6 @@ class ActionSelect extends BaseAction {
String flag = StringTools.uniqueToken();
cache.put(new Element(flag, outputCacheObject));
Wo wo = gson.fromJson(gson.toJson(wrapAppInfo), Wo.class);
wo.setFlag(flag);
result.setData(wo);
......
package com.x.cms.assemble.control.jaxrs.output;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WoFile;
import com.x.base.core.project.tools.DefaultCharset;
import net.sf.ehcache.Element;
class ActionSelectFile extends BaseAction {
private static String extension = ".xapp";
ActionResult<Wo> execute(EffectivePerson effectivePerson, String flag) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Wo> result = new ActionResult<>();
Element element = cache.get(flag);
if (null == element || null == element.getObjectValue()) {
throw new ExceptionFlagNotExist(flag);
}
OutputCacheObject outputCacheObject = (OutputCacheObject) element.getObjectValue();
Wo wo = new Wo( gson.toJson(outputCacheObject.getCmsAppInfo()).getBytes(DefaultCharset.name ),
this.contentType(true, outputCacheObject.getName() + extension ),
this.contentDisposition(true, outputCacheObject.getName() + extension ));
result.setData(wo);
return result;
}
}
public static class Wo extends WoFile {
public Wo(byte[] bytes, String contentType, String contentDisposition) {
super(bytes, contentType, contentDisposition);
}
}
}
\ No newline at end of file
package com.x.cms.assemble.control.jaxrs.output;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.cms.core.entity.Document;
import com.x.cms.core.entity.FileInfo;
import com.x.cms.core.entity.element.wrap.WrapCms;
import net.sf.ehcache.Ehcache;
abstract class BaseAction extends StandardJaxrsAction {
protected Ehcache cache = ApplicationCache.instance().getCache(OutputCacheObject.class);
public static class OutputCacheObject {
private String name;
......
......@@ -2,15 +2,19 @@ package com.x.cms.assemble.control.jaxrs.script;
import java.util.Date;
import java.util.List;
import java.util.Optional;
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.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.cache.Cache;
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.http.WrapOutString;
import com.x.cms.core.entity.element.Script;
import net.sf.ehcache.Element;
......@@ -20,11 +24,12 @@ class ActionGet extends BaseAction {
ActionResult<Wo> execute(EffectivePerson effectivePerson, String id) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
Wo wrap = null;
String cacheKey = "script.get." + id;
Element element = null;
element = cache.get(cacheKey);
if (element != null) {
wrap = (Wo) element.getObjectValue();
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), id );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
wrap = (Wo) optional.get();
result.setData(wrap);
} else {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
......@@ -36,7 +41,7 @@ class ActionGet extends BaseAction {
result.setData(wrap);
// 将查询结果放进缓存里
cache.put(new Element(cacheKey, wrap));
CacheManager.put(cacheCategory, cacheKey, wrap );
} catch (Throwable th) {
th.printStackTrace();
......
......@@ -2,6 +2,7 @@ package com.x.cms.assemble.control.jaxrs.script;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
......@@ -9,6 +10,8 @@ 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;
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;
......@@ -31,10 +34,12 @@ class ActionGetScriptNestedImported extends BaseAction {
if (check) {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(), uniqueName, flag);
Element element = cache.get(cacheKey);
if ((null != element) && (null != element.getObjectValue())) {
wrap = (Wo) element.getObjectValue();
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), uniqueName, flag );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
wrap = (Wo) optional.get();
} else {
Business business = new Business(emc);
AppInfo appInfo = business.getAppInfoFactory().flag(flag);
......@@ -58,7 +63,7 @@ class ActionGetScriptNestedImported extends BaseAction {
wrap = new Wo();
wrap.setImportedList(imported);
wrap.setText(buffer.toString());
cache.put(new Element(cacheKey, wrap));
CacheManager.put(cacheCategory, cacheKey, wrap );
}
} catch (Throwable th) {
th.printStackTrace();
......
......@@ -2,7 +2,10 @@ package com.x.cms.assemble.control.jaxrs.script;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.cache.CacheManager;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.container.EntityManagerContainer;
......@@ -24,11 +27,12 @@ class ActionGetWithAppAndName extends BaseAction {
ActionResult<Wo> execute( EffectivePerson effectivePerson, String appFlag, String name ) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
Wo wrap = null;
String cacheKey = "script.getWithAppWithName.appFlag." + appFlag + ".scriptName." + name;
Element element = null;
element = cache.get(cacheKey);
if (element != null) {
wrap = (Wo) element.getObjectValue();
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), appFlag, name );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
wrap = (Wo) optional.get();
result.setData(wrap);
} else {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
......@@ -44,8 +48,9 @@ class ActionGetWithAppAndName extends BaseAction {
} else {
throw new Exception("[getWithAppWithName]script not existed with name or alias : " + name + ".");
}
// 将查询结果放进缓存里
cache.put(new Element( cacheKey, wrap) );
CacheManager.put(cacheCategory, cacheKey, wrap );
result.setData(wrap);
} catch (Throwable th) {
th.printStackTrace();
......
......@@ -3,12 +3,15 @@ package com.x.cms.assemble.control.jaxrs.script;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Optional;
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.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.cache.Cache;
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,11 +28,12 @@ class ActionListWithApplication extends BaseAction {
ActionResult<List<Wo>> result = new ActionResult<>();
List<Wo> wraps = new ArrayList<>();
Wo wrap = null;
String cacheKey = "script.listWithApp.appFlag." + appFlag;
Element element = null;
element = cache.get(cacheKey);
if (element != null) {
wraps = (List<Wo>) element.getObjectValue();
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), appFlag );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
wraps = (List<Wo>) optional.get();
result.setData(wraps);
} else {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
......@@ -45,7 +49,7 @@ class ActionListWithApplication extends BaseAction {
wraps.add( wrap );
}
// 将查询结果放进缓存里
cache.put(new Element(cacheKey, wraps));
CacheManager.put(cacheCategory, cacheKey, wraps );
result.setData(wraps);
} catch (Throwable th) {
th.printStackTrace();
......
package com.x.cms.assemble.control.jaxrs.script;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.cms.assemble.control.service.LogService;
import com.x.cms.core.entity.Document;
import com.x.cms.core.entity.element.Script;
import net.sf.ehcache.Ehcache;
class BaseAction extends StandardJaxrsAction {
public LogService logService = new LogService();
public Ehcache cache = ApplicationCache.instance().getCache(Script.class);
protected Cache.CacheCategory cacheCategory = new Cache.CacheCategory(Script.class, Document.class);
}
......@@ -2,32 +2,32 @@ package com.x.cms.assemble.control.jaxrs.view;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.cache.CacheManager;
import org.apache.commons.lang3.StringUtils;
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.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.cms.assemble.control.Business;
import com.x.cms.core.entity.element.View;
import net.sf.ehcache.Element;
import java.util.Optional;
public class ActionGet extends BaseAction {
protected ActionResult<Wo> execute( HttpServletRequest request, EffectivePerson effectivePerson, String flag ) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
Wo wrap = null;
String cacheKey = ApplicationCache.concreteCacheKey( flag );
Element element = cache.get(cacheKey);
if ((null != element) && ( null != element.getObjectValue()) ) {
wrap = (Wo) element.getObjectValue();
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), flag );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
wrap = (Wo) optional.get();
result.setData(wrap);
} else {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
......@@ -41,7 +41,7 @@ public class ActionGet extends BaseAction {
if(StringUtils.isNotEmpty( wrap.getFormId() )) {
wrap.setFormName( formServiceAdv.getNameWithId( wrap.getFormId() ) );
}
cache.put(new Element( cacheKey, wrap ));
CacheManager.put(cacheCategory, cacheKey, wrap );
result.setData(wrap);
} catch (Throwable th) {
th.printStackTrace();
......
......@@ -2,9 +2,12 @@ package com.x.cms.assemble.control.jaxrs.view;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.cache.CacheManager;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.container.EntityManagerContainer;
......@@ -13,7 +16,6 @@ import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.tools.SortTools;
......@@ -21,19 +23,18 @@ import com.x.cms.assemble.control.Business;
import com.x.cms.assemble.control.factory.ViewFactory;
import com.x.cms.core.entity.element.View;
import net.sf.ehcache.Element;
public class ActionListAll extends BaseAction {
@SuppressWarnings("unchecked")
protected ActionResult<List<Wo>> execute( HttpServletRequest request, EffectivePerson effectivePerson ) throws Exception {
ActionResult<List<Wo>> result = new ActionResult<>();
List<Wo> wraps = null;
String cacheKey = ApplicationCache.concreteCacheKey( "all" );
Element element = cache.get(cacheKey);
if ((null != element) && ( null != element.getObjectValue()) ) {
wraps = (List<Wo>) element.getObjectValue();
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass() );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
wraps = (List<Wo>) optional.get();
result.setData(wraps);
} else {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
......@@ -58,7 +59,7 @@ public class ActionListAll extends BaseAction {
}
}
}
cache.put(new Element( cacheKey, wraps ));
CacheManager.put(cacheCategory, cacheKey, wraps );
result.setData(wraps);
} catch (Throwable th) {
th.printStackTrace();
......
......@@ -2,9 +2,12 @@ package com.x.cms.assemble.control.jaxrs.view;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.cache.CacheManager;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.container.EntityManagerContainer;
......@@ -29,11 +32,12 @@ public class ActionListByApp extends BaseAction {
protected ActionResult<List<Wo>> execute( HttpServletRequest request, EffectivePerson effectivePerson, String appId ) throws Exception {
ActionResult<List<Wo>> result = new ActionResult<>();
List<Wo> wraps = null;
String cacheKey = ApplicationCache.concreteCacheKey( "app", appId );
Element element = cache.get(cacheKey);
if ((null != element) && ( null != element.getObjectValue()) ) {
wraps = (List<Wo>) element.getObjectValue();
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), appId );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
wraps = (List<Wo>) optional.get();
result.setData(wraps);
} else {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
......@@ -58,8 +62,8 @@ public class ActionListByApp extends BaseAction {
}
}
}
cache.put(new Element( cacheKey, wraps ));
CacheManager.put(cacheCategory, cacheKey, wraps );
result.setData(wraps);
} catch (Throwable th) {
th.printStackTrace();
......
......@@ -2,9 +2,12 @@ package com.x.cms.assemble.control.jaxrs.view;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.cache.CacheManager;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.container.EntityManagerContainer;
......@@ -30,11 +33,11 @@ public class ActionListByCategory extends BaseAction {
ActionResult<List<Wo>> result = new ActionResult<>();
List<Wo> wraps = null;
String cacheKey = ApplicationCache.concreteCacheKey( "category", categoryId );
Element element = cache.get(cacheKey);
if ((null != element) && ( null != element.getObjectValue()) ) {
wraps = (List<Wo>) element.getObjectValue();
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), categoryId );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
wraps = (List<Wo>) optional.get();
result.setData( wraps );
} else {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
......@@ -59,8 +62,8 @@ public class ActionListByCategory extends BaseAction {
}
}
}
cache.put(new Element( cacheKey, wraps ));
CacheManager.put(cacheCategory, cacheKey, wraps );
result.setData(wraps);
} catch (Throwable th) {
th.printStackTrace();
......
......@@ -2,9 +2,12 @@ package com.x.cms.assemble.control.jaxrs.view;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.cache.CacheManager;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.container.EntityManagerContainer;
......@@ -29,11 +32,12 @@ public class ActionListByForm extends BaseAction {
protected ActionResult<List<Wo>> execute( HttpServletRequest request, EffectivePerson effectivePerson, String formId ) throws Exception {
ActionResult<List<Wo>> result = new ActionResult<>();
List<Wo> wraps = null;
String cacheKey = ApplicationCache.concreteCacheKey( "formId", formId );
Element element = cache.get(cacheKey);
if ((null != element) && ( null != element.getObjectValue()) ) {
wraps = (List<Wo>) element.getObjectValue();
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), formId );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey );
if (optional.isPresent()) {
wraps = (List<Wo>) optional.get();
result.setData(wraps);
} else {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
......@@ -60,8 +64,8 @@ public class ActionListByForm extends BaseAction {
}
}
}
cache.put(new Element( cacheKey, wraps ));
CacheManager.put(cacheCategory, cacheKey, wraps );
result.setData(wraps);
} catch (Throwable th) {
th.printStackTrace();
......
package com.x.cms.assemble.control.jaxrs.view;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.cache.Cache;
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.cms.assemble.control.service.CategoryInfoServiceAdv;
import com.x.cms.assemble.control.service.DocumentQueryService;
......@@ -9,13 +10,17 @@ import com.x.cms.assemble.control.service.LogService;
import com.x.cms.assemble.control.service.PermissionQueryService;
import com.x.cms.assemble.control.service.UserManagerService;
import com.x.cms.assemble.control.service.ViewServiceAdv;
import com.x.cms.core.entity.Document;
import com.x.cms.core.entity.element.Script;
import com.x.cms.core.entity.element.View;
import com.x.cms.core.entity.element.ViewCategory;
import com.x.cms.core.entity.element.ViewFieldConfig;
import net.sf.ehcache.Ehcache;
public class BaseAction extends StandardJaxrsAction {
protected Ehcache cache = ApplicationCache.instance().getCache( View.class );
protected Cache.CacheCategory cacheCategory = new Cache.CacheCategory(View.class, ViewFieldConfig.class, ViewCategory.class);
protected LogService logService = new LogService();
protected CategoryInfoServiceAdv categoryInfoServiceAdv = new CategoryInfoServiceAdv();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册