提交 62725277 编写于 作者: O o2null

Merge branch 'fix/removeQueryView' into 'develop'

删除残留的QueryView

See merge request o2oa/o2oa!892
...@@ -2,6 +2,7 @@ package com.x.base.core.project.config; ...@@ -2,6 +2,7 @@ package com.x.base.core.project.config;
import java.io.File; import java.io.File;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
...@@ -49,6 +50,7 @@ public class General extends ConfigObject { ...@@ -49,6 +50,7 @@ public class General extends ConfigObject {
o.exposeJest = DEFAULT_EXPOSEJEST; o.exposeJest = DEFAULT_EXPOSEJEST;
o.refererHeadCheckRegular = DEFAULT_REFERERHEADCHECKREGULAR; o.refererHeadCheckRegular = DEFAULT_REFERERHEADCHECKREGULAR;
o.accessControlAllowOrigin = DEFAULT_ACCESSCONTROLALLOWORIGIN; o.accessControlAllowOrigin = DEFAULT_ACCESSCONTROLALLOWORIGIN;
o.attachmentConfig = new AttachmentConfig();
return o; return o;
} }
...@@ -91,6 +93,9 @@ public class General extends ConfigObject { ...@@ -91,6 +93,9 @@ public class General extends ConfigObject {
@FieldDescribe("跨源资源共享许可,设置http返回的Access-Control-Allow-Origin标识,可以用于CORS攻击防护,样例:https://www.o2oa.net") @FieldDescribe("跨源资源共享许可,设置http返回的Access-Control-Allow-Origin标识,可以用于CORS攻击防护,样例:https://www.o2oa.net")
private String accessControlAllowOrigin = ""; private String accessControlAllowOrigin = "";
@FieldDescribe("附件上传限制大小或者类型.")
private AttachmentConfig attachmentConfig;
public String getRefererHeadCheckRegular() { public String getRefererHeadCheckRegular() {
return (StringUtils.isBlank(refererHeadCheckRegular) ? DEFAULT_REFERERHEADCHECKREGULAR return (StringUtils.isBlank(refererHeadCheckRegular) ? DEFAULT_REFERERHEADCHECKREGULAR
: this.refererHeadCheckRegular); : this.refererHeadCheckRegular);
...@@ -148,6 +153,43 @@ public class General extends ConfigObject { ...@@ -148,6 +153,43 @@ public class General extends ConfigObject {
return null == this.deployResourceEnable ? DEFAULT_DEPLOYRESOURCEENABLE : this.deployResourceEnable; return null == this.deployResourceEnable ? DEFAULT_DEPLOYRESOURCEENABLE : this.deployResourceEnable;
} }
public AttachmentConfig getAttachmentConfig() {
return this.attachmentConfig == null ? new AttachmentConfig() : attachmentConfig;
}
public static class AttachmentConfig extends ConfigObject {
private static final long serialVersionUID = -5672631798073576284L;
public static AttachmentConfig defaultInstance() {
return new AttachmentConfig();
}
public static final Integer DEFAULT_FILE_SIZE = 0;
@FieldDescribe("附件大小限制(单位M,默认不限制).")
private Integer fileSize = DEFAULT_FILE_SIZE;
@FieldDescribe("只允许上传的文件后缀")
private List<String> fileTypeIncludes = new ArrayList<>();
@FieldDescribe("不允许上传的文件后缀")
private List<String> fileTypeExcludes = Arrays.asList("jsp", "exe", "sh", "tmp");
public Integer getFileSize() {
return fileSize;
}
public List<String> getFileTypeIncludes() {
return fileTypeIncludes;
}
public List<String> getFileTypeExcludes() {
return fileTypeExcludes;
}
}
public void save() throws Exception { public void save() throws Exception {
File file = new File(Config.base(), Config.PATH_CONFIG_GENERAL); File file = new File(Config.base(), Config.PATH_CONFIG_GENERAL);
FileUtils.write(file, XGsonBuilder.toJson(this), DefaultCharset.charset); FileUtils.write(file, XGsonBuilder.toJson(this), DefaultCharset.charset);
......
...@@ -84,7 +84,6 @@ public class ProcessPlatform extends ConfigObject { ...@@ -84,7 +84,6 @@ public class ProcessPlatform extends ConfigObject {
this.updateTable = new UpdateTable(); this.updateTable = new UpdateTable();
this.processingSignalPersistEnable = DEFAULT_PROCESSINGSIGNALPERSISTENABLE; this.processingSignalPersistEnable = DEFAULT_PROCESSINGSIGNALPERSISTENABLE;
this.asynchronousTimeout = DEFAULT_ASYNCHRONOUSTIMEOUT; this.asynchronousTimeout = DEFAULT_ASYNCHRONOUSTIMEOUT;
this.attachmentConfig = new AttachmentConfig();
} }
public Integer getExecutorCount() { public Integer getExecutorCount() {
...@@ -195,9 +194,6 @@ public class ProcessPlatform extends ConfigObject { ...@@ -195,9 +194,6 @@ public class ProcessPlatform extends ConfigObject {
@FieldDescribe("是否保存工作处理信号内容,默认false.") @FieldDescribe("是否保存工作处理信号内容,默认false.")
private Boolean processingSignalPersistEnable; private Boolean processingSignalPersistEnable;
@FieldDescribe("流程附件上传限制大小或者类型.")
private AttachmentConfig attachmentConfig;
@FieldDescribe("异步超时.") @FieldDescribe("异步超时.")
private Integer asynchronousTimeout; private Integer asynchronousTimeout;
...@@ -222,10 +218,6 @@ public class ProcessPlatform extends ConfigObject { ...@@ -222,10 +218,6 @@ public class ProcessPlatform extends ConfigObject {
return extensionEvents; return extensionEvents;
} }
public AttachmentConfig getAttachmentConfig() {
return this.attachmentConfig == null ? new AttachmentConfig() : attachmentConfig;
}
public ArchiveHadoop getArchiveHadoop() { public ArchiveHadoop getArchiveHadoop() {
return this.archiveHadoop == null ? new ArchiveHadoop() : this.archiveHadoop; return this.archiveHadoop == null ? new ArchiveHadoop() : this.archiveHadoop;
} }
...@@ -635,39 +627,6 @@ public class ProcessPlatform extends ConfigObject { ...@@ -635,39 +627,6 @@ public class ProcessPlatform extends ConfigObject {
} }
public static class AttachmentConfig extends ConfigObject {
private static final long serialVersionUID = -5672631798073576284L;
public static AttachmentConfig defaultInstance() {
return new AttachmentConfig();
}
public static final Integer DEFAULT_FILE_SIZE = 0;
@FieldDescribe("附件大小限制(单位M,默认不限制).")
private Integer fileSize = DEFAULT_FILE_SIZE;
@FieldDescribe("只允许上传的文件后缀")
private List<String> fileTypeIncludes = new ArrayList<>();
@FieldDescribe("不允许上传的文件后缀")
private List<String> fileTypeExcludes = new ArrayList<>();
public Integer getFileSize() {
return fileSize;
}
public List<String> getFileTypeIncludes() {
return fileTypeIncludes;
}
public List<String> getFileTypeExcludes() {
return fileTypeExcludes;
}
}
public static class ExtensionEvents { public static class ExtensionEvents {
@FieldDescribe("工作附件上传.") @FieldDescribe("工作附件上传.")
......
...@@ -5,22 +5,25 @@ import com.x.base.core.project.annotation.Module; ...@@ -5,22 +5,25 @@ import com.x.base.core.project.annotation.Module;
import com.x.base.core.project.annotation.ModuleCategory; import com.x.base.core.project.annotation.ModuleCategory;
import com.x.base.core.project.annotation.ModuleType; import com.x.base.core.project.annotation.ModuleType;
@Module( type = ModuleType.ASSEMBLE, category = ModuleCategory.OFFICIAL, name = "内容管理", packageName = "com.x.cms.assemble.control", containerEntities = { @Module(type = ModuleType.ASSEMBLE, category = ModuleCategory.OFFICIAL, name = "内容管理", packageName = "com.x.cms.assemble.control", containerEntities = {
"com.x.cms.core.entity.element.AppDict", "com.x.cms.core.entity.element.AppDictItem", "com.x.cms.core.entity.element.AppDict", "com.x.cms.core.entity.element.AppDictItem",
"com.x.cms.core.entity.element.Form", "com.x.cms.core.entity.element.FormField", "com.x.cms.core.entity.element.Form", "com.x.cms.core.entity.element.FormField",
"com.x.cms.core.entity.element.QueryView", "com.x.cms.core.entity.element.Script", "com.x.cms.core.entity.element.Script", "com.x.cms.core.entity.element.TemplateForm",
"com.x.cms.core.entity.element.TemplateForm", "com.x.cms.core.entity.element.View", "com.x.cms.core.entity.element.View", "com.x.cms.core.entity.element.ViewCategory",
"com.x.cms.core.entity.element.ViewCategory", "com.x.cms.core.entity.element.ViewFieldConfig", "com.x.cms.core.entity.element.ViewFieldConfig", "com.x.cms.core.entity.AppInfo",
"com.x.cms.core.entity.AppInfo", "com.x.cms.core.entity.AppInfoConfig", "com.x.cms.core.entity.CategoryInfo", "com.x.cms.core.entity.CategoryExt", "com.x.cms.core.entity.AppInfoConfig", "com.x.cms.core.entity.CategoryInfo",
"com.x.cms.core.entity.Document", "com.x.cms.core.entity.DocumentViewRecord", "com.x.cms.core.entity.CategoryExt", "com.x.cms.core.entity.Document",
"com.x.cms.core.entity.element.File", "com.x.cms.core.entity.FileInfo", "com.x.cms.core.entity.Log", "com.x.cms.core.entity.DocumentViewRecord", "com.x.cms.core.entity.element.File",
"com.x.cms.core.entity.FileInfo", "com.x.cms.core.entity.Log",
"com.x.processplatform.core.entity.content.Attachment", "com.x.query.core.entity.Item", "com.x.processplatform.core.entity.content.Attachment", "com.x.query.core.entity.Item",
"com.x.query.core.entity.View", "com.x.cms.core.entity.ReadRemind", "com.x.cms.core.entity.DocumentCommend", "com.x.query.core.entity.View", "com.x.cms.core.entity.ReadRemind", "com.x.cms.core.entity.DocumentCommend",
"com.x.cms.core.entity.DocumentCommentInfo", "com.x.cms.core.entity.CmsBatchOperation", "com.x.cms.core.entity.Review", "com.x.cms.core.entity.DocumentCommentInfo", "com.x.cms.core.entity.CmsBatchOperation",
"com.x.cms.core.entity.DocumentCommentContent", "com.x.cms.core.entity.DocumentCommentCommend", "com.x.portal.core.entity.Script" "com.x.cms.core.entity.Review", "com.x.cms.core.entity.DocumentCommentContent",
, "com.x.processplatform.core.entity.element.Script", "com.x.processplatform.core.entity.element.Form"}, storageTypes = { "com.x.cms.core.entity.DocumentCommentCommend", "com.x.portal.core.entity.Script",
StorageType.cms, StorageType.processPlatform }, storeJars = { "x_processplatform_core_entity", "com.x.processplatform.core.entity.element.Script",
"x_organization_core_entity", "x_organization_core_express", "x_cms_core_entity","x_cms_core_express", "com.x.processplatform.core.entity.element.Form" }, storageTypes = { StorageType.cms,
"x_query_core_entity", "x_query_core_express", "x_portal_core_entity" }) StorageType.processPlatform }, storeJars = { "x_processplatform_core_entity",
"x_organization_core_entity", "x_organization_core_express", "x_cms_core_entity",
"x_cms_core_express", "x_query_core_entity", "x_query_core_express", "x_portal_core_entity" })
public class x_cms_assemble_control extends Deployable { public class x_cms_assemble_control extends Deployable {
} }
...@@ -21,8 +21,7 @@ import com.x.base.core.project.annotation.ModuleType; ...@@ -21,8 +21,7 @@ import com.x.base.core.project.annotation.ModuleType;
"com.x.processplatform.core.entity.element.Parallel", "com.x.processplatform.core.entity.element.Process", "com.x.processplatform.core.entity.element.Parallel", "com.x.processplatform.core.entity.element.Process",
"com.x.processplatform.core.entity.element.Route", "com.x.processplatform.core.entity.element.Script", "com.x.processplatform.core.entity.element.Route", "com.x.processplatform.core.entity.element.Script",
"com.x.processplatform.core.entity.element.Service", "com.x.processplatform.core.entity.element.Split", "com.x.processplatform.core.entity.element.Service", "com.x.processplatform.core.entity.element.Split",
"com.x.processplatform.core.entity.element.QueryView", "com.x.query.core.entity.Item" }, storeJars = { "com.x.query.core.entity.Item" }, storeJars = { "x_organization_core_entity", "x_organization_core_express",
"x_organization_core_entity", "x_organization_core_express", "x_portal_core_entity", "x_portal_core_entity", "x_processplatform_core_entity", "x_query_core_entity" })
"x_processplatform_core_entity", "x_query_core_entity" })
public class x_processplatform_assemble_bam extends Deployable { public class x_processplatform_assemble_bam extends Deployable {
} }
\ No newline at end of file
...@@ -5,35 +5,6 @@ import com.x.base.core.project.annotation.Module; ...@@ -5,35 +5,6 @@ import com.x.base.core.project.annotation.Module;
import com.x.base.core.project.annotation.ModuleCategory; import com.x.base.core.project.annotation.ModuleCategory;
import com.x.base.core.project.annotation.ModuleType; import com.x.base.core.project.annotation.ModuleType;
//@Module(type = ModuleType.ASSEMBLE, category = ModuleCategory.OFFICIAL, name = "流程设计", packageName = "com.x.processplatform.assemble.designer", containerEntities = {
// "com.x.processplatform.core.entity.content.Snap", "com.x.processplatform.core.entity.content.DocumentVersion",
// "com.x.processplatform.core.entity.content.Draft", "com.x.processplatform.core.entity.content.Attachment",
// "com.x.processplatform.core.entity.content.Read", "com.x.processplatform.core.entity.content.ReadCompleted",
// "com.x.processplatform.core.entity.content.Review", "com.x.processplatform.core.entity.content.Record",
// "com.x.processplatform.core.entity.content.SerialNumber", "com.x.processplatform.core.entity.content.Task",
// "com.x.processplatform.core.entity.content.TaskCompleted", "com.x.processplatform.core.entity.content.Work",
// "com.x.processplatform.core.entity.content.WorkCompleted", "com.x.processplatform.core.entity.content.WorkLog",
// "com.x.processplatform.core.entity.content.Record", "com.x.processplatform.core.entity.element.Invoke",
// "com.x.processplatform.core.entity.element.Split", "com.x.processplatform.core.entity.element.File",
// "com.x.processplatform.core.entity.element.Form", "com.x.processplatform.core.entity.element.FormVersion",
// "com.x.processplatform.core.entity.element.FormField", "com.x.processplatform.core.entity.element.TemplateForm",
// "com.x.processplatform.core.entity.element.Application", "com.x.processplatform.core.entity.element.Script",
// "com.x.processplatform.core.entity.element.ScriptVersion", "com.x.processplatform.core.entity.element.Merge",
// "com.x.processplatform.core.entity.element.Agent", "com.x.processplatform.core.entity.element.Process",
// "com.x.processplatform.core.entity.element.ProcessVersion", "com.x.processplatform.core.entity.element.Choice",
// "com.x.processplatform.core.entity.element.Delay", "com.x.processplatform.core.entity.element.Parallel",
// "com.x.processplatform.core.entity.element.Begin", "com.x.processplatform.core.entity.element.Cancel",
// "com.x.processplatform.core.entity.element.Embed", "com.x.processplatform.core.entity.element.Service",
// "com.x.processplatform.core.entity.element.Manual", "com.x.processplatform.core.entity.element.Route",
// "com.x.processplatform.core.entity.element.End", "com.x.processplatform.core.entity.element.ApplicationDict",
// "com.x.processplatform.core.entity.element.ApplicationDictItem",
// "com.x.processplatform.core.entity.element.QueryView", "com.x.processplatform.core.entity.element.QueryStat",
// "com.x.processplatform.core.entity.element.Mapping", "com.x.query.core.entity.Item",
// "com.x.cms.core.entity.element.Script", "com.x.portal.core.entity.Script",
// "com.x.query.dynamic.entity.*" }, storeJars = { "x_organization_core_entity", "x_organization_core_express",
// "x_processplatform_core_entity", "x_processplatform_core_express", "x_query_core_entity",
// "x_cms_core_entity", "x_portal_core_entity" }, dynamicJars = {
// "x_query_dynamic_entity", }, storageTypes = { StorageType.processPlatform })
@Module(type = ModuleType.ASSEMBLE, category = ModuleCategory.OFFICIAL, name = "流程设计", packageName = "com.x.processplatform.assemble.designer", containerEntities = { @Module(type = ModuleType.ASSEMBLE, category = ModuleCategory.OFFICIAL, name = "流程设计", packageName = "com.x.processplatform.assemble.designer", containerEntities = {
"com.x.processplatform.core.entity.content.Snap", "com.x.processplatform.core.entity.content.DocumentVersion", "com.x.processplatform.core.entity.content.Snap", "com.x.processplatform.core.entity.content.DocumentVersion",
"com.x.processplatform.core.entity.content.Draft", "com.x.processplatform.core.entity.content.Attachment", "com.x.processplatform.core.entity.content.Draft", "com.x.processplatform.core.entity.content.Attachment",
...@@ -55,13 +26,12 @@ import com.x.base.core.project.annotation.ModuleType; ...@@ -55,13 +26,12 @@ import com.x.base.core.project.annotation.ModuleType;
"com.x.processplatform.core.entity.element.Embed", "com.x.processplatform.core.entity.element.Service", "com.x.processplatform.core.entity.element.Embed", "com.x.processplatform.core.entity.element.Service",
"com.x.processplatform.core.entity.element.Manual", "com.x.processplatform.core.entity.element.Route", "com.x.processplatform.core.entity.element.Manual", "com.x.processplatform.core.entity.element.Route",
"com.x.processplatform.core.entity.element.End", "com.x.processplatform.core.entity.element.ApplicationDict", "com.x.processplatform.core.entity.element.End", "com.x.processplatform.core.entity.element.ApplicationDict",
"com.x.processplatform.core.entity.element.ApplicationDictItem", "com.x.processplatform.core.entity.element.Publish", "com.x.processplatform.core.entity.element.ApplicationDictItem",
"com.x.processplatform.core.entity.element.QueryView", "com.x.processplatform.core.entity.element.QueryStat", "com.x.processplatform.core.entity.element.Publish", "com.x.processplatform.core.entity.element.Mapping",
"com.x.processplatform.core.entity.element.Mapping", "com.x.query.core.entity.Item", "com.x.query.core.entity.Item", "com.x.cms.core.entity.element.Script",
"com.x.cms.core.entity.element.Script", "com.x.portal.core.entity.Script" }, storeJars = { "com.x.portal.core.entity.Script" }, storeJars = { "x_organization_core_entity", "x_organization_core_express",
"x_organization_core_entity", "x_organization_core_express", "x_processplatform_core_entity", "x_processplatform_core_entity", "x_processplatform_core_express", "x_query_core_entity",
"x_processplatform_core_express", "x_query_core_entity", "x_cms_core_entity", "x_cms_core_entity", "x_portal_core_entity" }, storageTypes = { StorageType.processPlatform })
"x_portal_core_entity" }, storageTypes = { StorageType.processPlatform })
public class x_processplatform_assemble_designer extends Deployable { public class x_processplatform_assemble_designer extends Deployable {
} }
...@@ -28,10 +28,9 @@ import com.x.base.core.project.annotation.ModuleType; ...@@ -28,10 +28,9 @@ import com.x.base.core.project.annotation.ModuleType;
"com.x.processplatform.core.entity.element.Parallel", "com.x.processplatform.core.entity.element.Process", "com.x.processplatform.core.entity.element.Parallel", "com.x.processplatform.core.entity.element.Process",
"com.x.processplatform.core.entity.element.Route", "com.x.processplatform.core.entity.element.Script", "com.x.processplatform.core.entity.element.Route", "com.x.processplatform.core.entity.element.Script",
"com.x.processplatform.core.entity.element.Service", "com.x.processplatform.core.entity.element.Split", "com.x.processplatform.core.entity.element.Service", "com.x.processplatform.core.entity.element.Split",
"com.x.processplatform.core.entity.element.QueryView", "com.x.processplatform.core.entity.element.QueryStat",
"com.x.processplatform.core.entity.element.Mapping", "com.x.query.core.entity.Item", "com.x.processplatform.core.entity.element.Mapping", "com.x.query.core.entity.Item",
"com.x.cms.core.entity.element.Script", "com.x.portal.core.entity.Script", "com.x.cms.core.entity.element.Script", "com.x.portal.core.entity.Script",
"com.x.general.core.entity.GeneralFile"}, storageTypes = { StorageType.processPlatform, "com.x.general.core.entity.GeneralFile" }, storageTypes = { StorageType.processPlatform,
StorageType.general }, storeJars = { "x_organization_core_entity", "x_organization_core_express", StorageType.general }, storeJars = { "x_organization_core_entity", "x_organization_core_express",
"x_processplatform_core_entity", "x_processplatform_core_express", "x_query_core_entity", "x_processplatform_core_entity", "x_processplatform_core_express", "x_query_core_entity",
"x_cms_core_entity", "x_portal_core_entity", "x_general_core_entity" }) "x_cms_core_entity", "x_portal_core_entity", "x_general_core_entity" })
......
...@@ -34,7 +34,6 @@ import com.x.cms.assemble.control.factory.TemplateFormFactory; ...@@ -34,7 +34,6 @@ import com.x.cms.assemble.control.factory.TemplateFormFactory;
import com.x.cms.assemble.control.factory.ViewCategoryFactory; import com.x.cms.assemble.control.factory.ViewCategoryFactory;
import com.x.cms.assemble.control.factory.ViewFactory; import com.x.cms.assemble.control.factory.ViewFactory;
import com.x.cms.assemble.control.factory.ViewFieldConfigFactory; import com.x.cms.assemble.control.factory.ViewFieldConfigFactory;
import com.x.cms.assemble.control.factory.element.QueryViewFactory;
import com.x.cms.assemble.control.factory.portal.PortalFactory; import com.x.cms.assemble.control.factory.portal.PortalFactory;
import com.x.cms.assemble.control.factory.process.ProcessFactory; import com.x.cms.assemble.control.factory.process.ProcessFactory;
import com.x.cms.core.entity.AppInfo; import com.x.cms.core.entity.AppInfo;
...@@ -42,6 +41,7 @@ import com.x.organization.core.express.Organization; ...@@ -42,6 +41,7 @@ import com.x.organization.core.express.Organization;
/** /**
* 通用业务类 * 通用业务类
*
* @author sword * @author sword
*/ */
public class Business { public class Business {
...@@ -67,7 +67,6 @@ public class Business { ...@@ -67,7 +67,6 @@ public class Business {
private DocumentViewRecordFactory documentViewRecordFactory; private DocumentViewRecordFactory documentViewRecordFactory;
private FormFactory formFactory; private FormFactory formFactory;
private FileFactory fileFactory; private FileFactory fileFactory;
private QueryViewFactory queryViewFactory;
private ViewCategoryFactory viewCategoryFactory; private ViewCategoryFactory viewCategoryFactory;
private ViewFactory viewFactory; private ViewFactory viewFactory;
private ViewFieldConfigFactory viewFieldConfigFactory; private ViewFieldConfigFactory viewFieldConfigFactory;
...@@ -175,15 +174,6 @@ public class Business { ...@@ -175,15 +174,6 @@ public class Business {
return documentViewRecordFactory; return documentViewRecordFactory;
} }
public QueryViewFactory queryViewFactory() throws Exception {
if (null == this.queryViewFactory) {
this.queryViewFactory = new QueryViewFactory(this);
}
return queryViewFactory;
}
public ViewCategoryFactory getViewCategoryFactory() throws Exception { public ViewCategoryFactory getViewCategoryFactory() throws Exception {
if (null == this.viewCategoryFactory) { if (null == this.viewCategoryFactory) {
this.viewCategoryFactory = new ViewCategoryFactory(this); this.viewCategoryFactory = new ViewCategoryFactory(this);
...@@ -293,17 +283,17 @@ public class Business { ...@@ -293,17 +283,17 @@ public class Business {
return portal; return portal;
} }
public boolean isHasPlatformRole( String personName, String roleName) throws Exception { public boolean isHasPlatformRole(String personName, String roleName) throws Exception {
if ( StringUtils.isEmpty( personName ) ) { if (StringUtils.isEmpty(personName)) {
throw new Exception("personName is null!"); throw new Exception("personName is null!");
} }
if ( StringUtils.isEmpty( roleName )) { if (StringUtils.isEmpty(roleName)) {
throw new Exception("roleName is null!"); throw new Exception("roleName is null!");
} }
List<String> roleList = null; List<String> roleList = null;
roleList = organization().role().listWithPerson( personName ); roleList = organization().role().listWithPerson(personName);
if ( roleList != null && !roleList.isEmpty()) { if (roleList != null && !roleList.isEmpty()) {
if( roleList.stream().filter( r -> roleName.equalsIgnoreCase( r )).count() > 0 ){ if (roleList.stream().filter(r -> roleName.equalsIgnoreCase(r)).count() > 0) {
return true; return true;
} }
} else { } else {
...@@ -314,13 +304,14 @@ public class Business { ...@@ -314,13 +304,14 @@ public class Business {
/** /**
* 判断用户是否管理员权限 * 判断用户是否管理员权限
*
* @param person * @param person
* @return * @return
* @throws Exception * @throws Exception
*/ */
public boolean isManager(EffectivePerson person) throws Exception { public boolean isManager(EffectivePerson person) throws Exception {
// 如果用户的身份是平台的超级管理员,那么就是超级管理员权限 // 如果用户的身份是平台的超级管理员,那么就是超级管理员权限
if ( person.isManager() ) { if (person.isManager()) {
return true; return true;
} else { } else {
if (organization().person().hasRole(person, OrganizationDefinition.Manager, if (organization().person().hasRole(person, OrganizationDefinition.Manager,
...@@ -333,13 +324,14 @@ public class Business { ...@@ -333,13 +324,14 @@ public class Business {
/** /**
* 判断用户是否管理员权限 * 判断用户是否管理员权限
*
* @param person * @param person
* @return * @return
* @throws Exception * @throws Exception
*/ */
public boolean isCreatorManager(EffectivePerson person) throws Exception { public boolean isCreatorManager(EffectivePerson person) throws Exception {
// 如果用户的身份是平台的超级管理员,那么就是超级管理员权限 // 如果用户的身份是平台的超级管理员,那么就是超级管理员权限
if ( person.isManager() ) { if (person.isManager()) {
return true; return true;
} else { } else {
if (organization().person().hasRole(person, OrganizationDefinition.Manager, if (organization().person().hasRole(person, OrganizationDefinition.Manager,
...@@ -352,23 +344,25 @@ public class Business { ...@@ -352,23 +344,25 @@ public class Business {
/** /**
* 是否是栏目管理员 * 是否是栏目管理员
*
* @param person * @param person
* @param appInfo * @param appInfo
* @return * @return
* @throws Exception * @throws Exception
*/ */
public boolean isAppInfoManager(EffectivePerson person, AppInfo appInfo) throws Exception { public boolean isAppInfoManager(EffectivePerson person, AppInfo appInfo) throws Exception {
if( isManager(person) ) { if (isManager(person)) {
return true; return true;
} }
if(appInfo != null) { if (appInfo != null) {
if (ListTools.isNotEmpty(appInfo.getManageablePersonList())) { if (ListTools.isNotEmpty(appInfo.getManageablePersonList())) {
if (appInfo.getManageablePersonList().contains(person.getDistinguishedName())) { if (appInfo.getManageablePersonList().contains(person.getDistinguishedName())) {
return true; return true;
} }
} }
if (ListTools.isNotEmpty(appInfo.getManageableUnitList())) { if (ListTools.isNotEmpty(appInfo.getManageableUnitList())) {
List<String> unitNames = this.organization().unit().listWithPersonSupNested(person.getDistinguishedName()); List<String> unitNames = this.organization().unit()
.listWithPersonSupNested(person.getDistinguishedName());
if (ListTools.containsAny(unitNames, appInfo.getManageableUnitList())) { if (ListTools.containsAny(unitNames, appInfo.getManageableUnitList())) {
return true; return true;
} }
...@@ -385,13 +379,14 @@ public class Business { ...@@ -385,13 +379,14 @@ public class Business {
/** /**
* 是否是栏目创建管理员 * 是否是栏目创建管理员
*
* @param person * @param person
* @param appInfo * @param appInfo
* @return * @return
* @throws Exception * @throws Exception
*/ */
public boolean isAppCreatorManager(EffectivePerson person, AppInfo appInfo) throws Exception { public boolean isAppCreatorManager(EffectivePerson person, AppInfo appInfo) throws Exception {
if(appInfo != null){ if (appInfo != null) {
if (isManager(person)) { if (isManager(person)) {
return true; return true;
} }
...@@ -401,7 +396,8 @@ public class Business { ...@@ -401,7 +396,8 @@ public class Business {
} }
} }
if (ListTools.isNotEmpty(appInfo.getManageableUnitList())) { if (ListTools.isNotEmpty(appInfo.getManageableUnitList())) {
List<String> unitNames = this.organization().unit().listWithPersonSupNested(person.getDistinguishedName()); List<String> unitNames = this.organization().unit()
.listWithPersonSupNested(person.getDistinguishedName());
if (ListTools.containsAny(unitNames, appInfo.getManageableUnitList())) { if (ListTools.containsAny(unitNames, appInfo.getManageableUnitList())) {
return true; return true;
} }
...@@ -412,7 +408,7 @@ public class Business { ...@@ -412,7 +408,7 @@ public class Business {
return true; return true;
} }
} }
}else if (isCreatorManager(person)) { } else if (isCreatorManager(person)) {
return true; return true;
} }
return false; return false;
...@@ -425,8 +421,8 @@ public class Business { ...@@ -425,8 +421,8 @@ public class Business {
* @return * @return
* @throws Exception * @throws Exception
*/ */
public boolean formEditAvailable( EffectivePerson person) throws Exception { public boolean formEditAvailable(EffectivePerson person) throws Exception {
if ( isManager( person)) { if (isManager(person)) {
return true; return true;
} }
// 其他情况暂时全部不允许操作 // 其他情况暂时全部不允许操作
...@@ -440,7 +436,7 @@ public class Business { ...@@ -440,7 +436,7 @@ public class Business {
* @return * @return
* @throws Exception * @throws Exception
*/ */
public boolean viewEditAvailable( EffectivePerson person) throws Exception { public boolean viewEditAvailable(EffectivePerson person) throws Exception {
if (isManager(person)) { if (isManager(person)) {
return true; return true;
} }
...@@ -448,37 +444,38 @@ public class Business { ...@@ -448,37 +444,38 @@ public class Business {
return true; return true;
} }
public boolean editable( EffectivePerson effectivePerson, AppInfo appInfo ) throws Exception { public boolean editable(EffectivePerson effectivePerson, AppInfo appInfo) throws Exception {
if ((StringUtils.equals(appInfo.getCreatorPerson(), effectivePerson.getDistinguishedName())) if ((StringUtils.equals(appInfo.getCreatorPerson(), effectivePerson.getDistinguishedName()))
|| effectivePerson.isManager() || organization().person().hasRole(effectivePerson, || effectivePerson.isManager()
OrganizationDefinition.CMSManager)) { || organization().person().hasRole(effectivePerson, OrganizationDefinition.CMSManager)) {
return true; return true;
} }
//判断effectivePerson是不是该栏目的管理者:涉及 个人,组织和群组 // 判断effectivePerson是不是该栏目的管理者:涉及 个人,组织和群组
List<String> unitNameList= this.organization().unit().listWithPersonSupNested( effectivePerson.getDistinguishedName() ); List<String> unitNameList = this.organization().unit()
.listWithPersonSupNested(effectivePerson.getDistinguishedName());
List<String> groupNameList = new ArrayList<String>(); List<String> groupNameList = new ArrayList<String>();
List<String> groupList = this.organization().group().listWithPerson( effectivePerson.getDistinguishedName() ); List<String> groupList = this.organization().group().listWithPerson(effectivePerson.getDistinguishedName());
if (groupList != null && groupList.size() > 0) { if (groupList != null && groupList.size() > 0) {
groupList.stream().filter( g -> !groupNameList.contains( g )).distinct().forEach( g -> groupNameList.add( g )); groupList.stream().filter(g -> !groupNameList.contains(g)).distinct().forEach(g -> groupNameList.add(g));
} }
if( ListTools.isNotEmpty( appInfo.getManageablePersonList() )) { if (ListTools.isNotEmpty(appInfo.getManageablePersonList())) {
if (appInfo.getManageablePersonList().contains( effectivePerson.getDistinguishedName() )) { if (appInfo.getManageablePersonList().contains(effectivePerson.getDistinguishedName())) {
return true; return true;
} }
} }
if( ListTools.isNotEmpty( appInfo.getManageableGroupList() ) && ListTools.isNotEmpty( groupNameList )) { if (ListTools.isNotEmpty(appInfo.getManageableGroupList()) && ListTools.isNotEmpty(groupNameList)) {
groupNameList.retainAll( appInfo.getManageableGroupList() ); groupNameList.retainAll(appInfo.getManageableGroupList());
if( ListTools.isNotEmpty( groupNameList )) { if (ListTools.isNotEmpty(groupNameList)) {
return true; return true;
} }
} }
if( ListTools.isNotEmpty( appInfo.getManageableUnitList() )&& ListTools.isNotEmpty( unitNameList )) { if (ListTools.isNotEmpty(appInfo.getManageableUnitList()) && ListTools.isNotEmpty(unitNameList)) {
unitNameList.retainAll( appInfo.getManageableUnitList() ); unitNameList.retainAll(appInfo.getManageableUnitList());
if( ListTools.isNotEmpty( unitNameList )) { if (ListTools.isNotEmpty(unitNameList)) {
return true; return true;
} }
} }
......
package com.x.cms.assemble.control.factory.element;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.tools.ListTools;
import com.x.cms.assemble.control.Business;
import com.x.cms.core.entity.AppInfo;
import com.x.cms.core.entity.element.QueryView;
import com.x.cms.core.entity.element.QueryView_;
public class QueryViewFactory extends ElementFactory {
public QueryViewFactory(Business abstractBusiness) throws Exception {
super(abstractBusiness);
}
public QueryView pick(String flag) throws Exception {
return this.pick(flag, QueryView.class);
}
public Boolean allowRead(EffectivePerson effectivePerson, QueryView queryView) throws Exception {
if (queryView == null) {
throw new Exception("queryView is null!");
}
/* 全部为空,没有设置范围 */
if (ListTools.isEmpty(queryView.getAvailableUnitList())
&& ListTools.isEmpty(queryView.getAvailableIdentityList())
&& ListTools.isEmpty(queryView.getAvailablePersonList())) {
return true;
}
if (effectivePerson.isPerson(queryView.getCreatorPerson())) {
return true;
}
if (effectivePerson.isManager()) {
return true;
}
if (effectivePerson.isPerson(queryView.getControllerList())) {
return true;
}
if (ListTools.isNotEmpty(queryView.getAvailablePersonList())) {
if (ListTools.contains(queryView.getAvailableIdentityList(), effectivePerson.getDistinguishedName())) {
return true;
}
}
if (ListTools.isNotEmpty(queryView.getAvailableIdentityList())) {
List<String> identityNameList = this.business().organization().identity()
.listWithPerson(effectivePerson.getDistinguishedName());
if (ListTools.containsAny(identityNameList, queryView.getAvailableIdentityList())) {
return true;
}
}
if (ListTools.isNotEmpty(queryView.getAvailableUnitList())) {
List<String> unitNames = this.business().organization().unit()
.listWithPerson(effectivePerson.getDistinguishedName());
if (ListTools.containsAny(unitNames, queryView.getAvailableUnitList())) {
return true;
}
}
return false;
}
public List<String> listWithAppId(String appId) throws Exception {
EntityManager em = this.entityManagerContainer().get(QueryView.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<QueryView> root = cq.from(QueryView.class);
Predicate p = cb.equal(root.get(QueryView_.appId), appId);
cq.select(root.get(QueryView_.id)).where(p);
return em.createQuery(cq).getResultList();
}
public boolean allowRead(EffectivePerson effectivePerson, QueryView queryView, AppInfo application) {
return true;
}
}
\ No newline at end of file
...@@ -33,8 +33,6 @@ import com.x.cms.assemble.control.jaxrs.output.OutputAction; ...@@ -33,8 +33,6 @@ import com.x.cms.assemble.control.jaxrs.output.OutputAction;
import com.x.cms.assemble.control.jaxrs.permission.PermissionAction; import com.x.cms.assemble.control.jaxrs.permission.PermissionAction;
import com.x.cms.assemble.control.jaxrs.permission.PermissionForDocumentAction; import com.x.cms.assemble.control.jaxrs.permission.PermissionForDocumentAction;
import com.x.cms.assemble.control.jaxrs.permission.PermissionManagerAction; import com.x.cms.assemble.control.jaxrs.permission.PermissionManagerAction;
import com.x.cms.assemble.control.jaxrs.queryview.QueryViewAction;
import com.x.cms.assemble.control.jaxrs.queryviewdesign.QueryViewDesignAction;
import com.x.cms.assemble.control.jaxrs.script.ScriptAction; import com.x.cms.assemble.control.jaxrs.script.ScriptAction;
import com.x.cms.assemble.control.jaxrs.script.ScriptAnonymousAction; import com.x.cms.assemble.control.jaxrs.script.ScriptAnonymousAction;
import com.x.cms.assemble.control.jaxrs.search.SearchFilterAction; import com.x.cms.assemble.control.jaxrs.search.SearchFilterAction;
...@@ -67,8 +65,6 @@ public class ActionApplication extends AbstractActionApplication { ...@@ -67,8 +65,6 @@ public class ActionApplication extends AbstractActionApplication {
this.classes.add(FileAction.class); this.classes.add(FileAction.class);
this.classes.add(FormAction.class); this.classes.add(FormAction.class);
this.classes.add(ViewAction.class); this.classes.add(ViewAction.class);
this.classes.add(QueryViewDesignAction.class);
this.classes.add(QueryViewAction.class);
this.classes.add(ViewCategoryAction.class); this.classes.add(ViewCategoryAction.class);
this.classes.add(ViewFieldConfigAction.class); this.classes.add(ViewFieldConfigAction.class);
this.classes.add(ImageBase64Action.class); this.classes.add(ImageBase64Action.class);
......
...@@ -19,8 +19,6 @@ import com.x.base.core.project.jaxrs.CipherManagerUserJaxrsFilter; ...@@ -19,8 +19,6 @@ import com.x.base.core.project.jaxrs.CipherManagerUserJaxrsFilter;
"/jaxrs/file/*", "/jaxrs/file/*",
"/jaxrs/form/*", "/jaxrs/form/*",
"/jaxrs/view/*", "/jaxrs/view/*",
"/jaxrs/queryview/*",
"/jaxrs/queryview/design/*",
"/jaxrs/viewcategory/*", "/jaxrs/viewcategory/*",
"/jaxrs/viewfieldconfig/*", "/jaxrs/viewfieldconfig/*",
"/jaxrs/image/*", "/jaxrs/image/*",
......
...@@ -27,307 +27,280 @@ import com.x.cms.core.entity.element.ViewFieldConfig; ...@@ -27,307 +27,280 @@ import com.x.cms.core.entity.element.ViewFieldConfig;
public class ActionAppInfoExport extends BaseAction { public class ActionAppInfoExport extends BaseAction {
private static Logger logger = LoggerFactory.getLogger( ActionAppInfoExport.class ); private static Logger logger = LoggerFactory.getLogger(ActionAppInfoExport.class);
/** /**
* 实现栏目设计导出功能 * 实现栏目设计导出功能 1、栏目信息 2、所有分类信息 3、所有的表单设计 4、视图(列表和数据视图)设计 5、数据字典设计 6、脚本信息
* 1、栏目信息 *
* 2、所有分类信息 * @param request
* 3、所有的表单设计 * @param effectivePerson
* 4、视图(列表和数据视图)设计 * @param appInfoId
* 5、数据字典设计 * @return
* 6、脚本信息 * @throws Exception
* */
* @param request protected ActionResult<Wo> execute(HttpServletRequest request, EffectivePerson effectivePerson, String appInfoId)
* @param effectivePerson throws Exception {
* @param appInfoId
* @return
* @throws Exception
*/
protected ActionResult<Wo> execute( HttpServletRequest request, EffectivePerson effectivePerson, String appInfoId ) throws Exception {
ActionResult<Wo> result = new ActionResult<>(); ActionResult<Wo> result = new ActionResult<>();
Wo wo = null; Wo wo = null;
AppInfo appInfo = null; AppInfo appInfo = null;
Boolean check = true; Boolean check = true;
if( StringUtils.isEmpty(appInfoId) ){ if (StringUtils.isEmpty(appInfoId)) {
check = false; check = false;
Exception exception = new ExceptionAppInfoIdEmpty(); Exception exception = new ExceptionAppInfoIdEmpty();
result.error( exception ); result.error(exception);
}
// 尝试查询栏目信息,判断栏目信息是否存在
if (check) {
try {
appInfo = appInfoServiceAdv.get(appInfoId);
if (appInfo == null) {
check = false;
Exception exception = new ExceptionAppInfoNotExists(appInfoId);
result.error(exception);
}
} catch (Exception e) {
check = false;
Exception exception = new ExceptionAppInfoProcess(e, "根据指定ID查询应用栏目信息对象时发生异常。ID:" + appInfoId);
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
} }
//尝试查询栏目信息,判断栏目信息是否存在
if( check ){
try {
appInfo = appInfoServiceAdv.get( appInfoId );
if( appInfo == null ){
check = false;
Exception exception = new ExceptionAppInfoNotExists( appInfoId );
result.error( exception );
}
} catch (Exception e) {
check = false;
Exception exception = new ExceptionAppInfoProcess( e, "根据指定ID查询应用栏目信息对象时发生异常。ID:" + appInfoId );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
}
if( check ){
try {
wo = Wo.copier.copy( appInfo );
} catch (Exception e) {
Exception exception = new ExceptionAppInfoProcess( e, "将查询出来的应用栏目信息对象转换为可输出的数据信息时发生异常。" );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
}
//开始查询所有的分类列表
if( check ){
List<CategoryInfo> categoryList = null;
try{
categoryList = categoryInfoServiceAdv.listByAppId( appInfoId );
if(ListTools.isNotEmpty(categoryList) ){
wo.setCategories( WoCategory.copier.copy( categoryList ) );
}
}catch(Exception e){
check = false;
Exception exception = new ExceptionAppInfoProcess( e, "系统根据栏目ID查询所有的分类信息ID列表时发生异常。ID:" + appInfoId );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
}
//开始查询所有的表单列表
if( check ){
List<Form> formList = null;
try{
formList = formServiceAdv.listByAppId( appInfoId );
if(ListTools.isNotEmpty(formList) ){
wo.setForms( WoForm.copier.copy(formList) );
}
}catch(Exception e){
check = false;
Exception exception = new ExceptionAppInfoProcess( e, "系统根据栏目ID查询所有的表单信息ID列表时发生异常。ID:" + appInfoId );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
}
//开始查询所有的脚本列表
if( check ){
List<Script> scriptList = null;
try{
scriptList = scriptServiceAdv.listWithAppId(appInfoId);
if(ListTools.isNotEmpty(scriptList) ){
wo.setScripts( WoScript.copier.copy(scriptList) );
}
}catch(Exception e){
check = false;
Exception exception = new ExceptionAppInfoProcess( e, "系统根据栏目ID查询所有的脚本信息列表时发生异常。ID:" + appInfoId );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
}
result.setData( wo );
return result;
}
/**
* 1、栏目信息
* 2、所有分类信息
* 3、所有的表单设计
* 4、视图(列表和数据视图)设计
* 5、数据字典设计
* 6、脚本信息
*/
public static class Wo extends AppInfo {
private static final long serialVersionUID = -5076990764713538973L;
public static List<String> excludes = new ArrayList<>();
public static final WrapCopier<AppInfo, Wo> copier = WrapCopierFactory.wo( AppInfo.class, Wo.class, null, Wo.excludes ); if (check) {
try {
wo = Wo.copier.copy(appInfo);
} catch (Exception e) {
Exception exception = new ExceptionAppInfoProcess(e, "将查询出来的应用栏目信息对象转换为可输出的数据信息时发生异常。");
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
}
@FieldDescribe("栏目内所有的分类信息列表") // 开始查询所有的分类列表
private List<WoCategory> categories = null; if (check) {
List<CategoryInfo> categoryList = null;
try {
categoryList = categoryInfoServiceAdv.listByAppId(appInfoId);
if (ListTools.isNotEmpty(categoryList)) {
wo.setCategories(WoCategory.copier.copy(categoryList));
}
} catch (Exception e) {
check = false;
Exception exception = new ExceptionAppInfoProcess(e, "系统根据栏目ID查询所有的分类信息ID列表时发生异常。ID:" + appInfoId);
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
}
@FieldDescribe("栏目内所有的表单信息列表") // 开始查询所有的表单列表
private List<WoForm> forms = null; if (check) {
List<Form> formList = null;
try {
formList = formServiceAdv.listByAppId(appInfoId);
if (ListTools.isNotEmpty(formList)) {
wo.setForms(WoForm.copier.copy(formList));
}
} catch (Exception e) {
check = false;
Exception exception = new ExceptionAppInfoProcess(e, "系统根据栏目ID查询所有的表单信息ID列表时发生异常。ID:" + appInfoId);
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
}
@FieldDescribe("栏目内所有的列表视图信息列表") // 开始查询所有的脚本列表
private List<WoView> views = null; if (check) {
List<Script> scriptList = null;
try {
scriptList = scriptServiceAdv.listWithAppId(appInfoId);
if (ListTools.isNotEmpty(scriptList)) {
wo.setScripts(WoScript.copier.copy(scriptList));
}
} catch (Exception e) {
check = false;
Exception exception = new ExceptionAppInfoProcess(e, "系统根据栏目ID查询所有的脚本信息列表时发生异常。ID:" + appInfoId);
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
}
@FieldDescribe("栏目内所有的数据视图信息列表") result.setData(wo);
private List<WoQueryView> queryViews = null; return result;
}
@FieldDescribe("栏目内所有的脚本信息列表") /**
private List<WoScript> scripts = null; * 1、栏目信息 2、所有分类信息 3、所有的表单设计 4、视图(列表和数据视图)设计 5、数据字典设计 6、脚本信息
*/
public static class Wo extends AppInfo {
@FieldDescribe("栏目内所有的数据字典信息列表") private static final long serialVersionUID = -5076990764713538973L;
private List<WoAppDict> dicts = null;
public List<WoCategory> getCategories() { public static List<String> excludes = new ArrayList<>();
return categories;
}
public void setCategories(List<WoCategory> categories) { public static final WrapCopier<AppInfo, Wo> copier = WrapCopierFactory.wo(AppInfo.class, Wo.class, null,
this.categories = categories; Wo.excludes);
}
public List<WoForm> getForms() { @FieldDescribe("栏目内所有的分类信息列表")
return forms; private List<WoCategory> categories = null;
}
public void setForms(List<WoForm> forms) { @FieldDescribe("栏目内所有的表单信息列表")
this.forms = forms; private List<WoForm> forms = null;
}
public List<WoView> getViews() { @FieldDescribe("栏目内所有的列表视图信息列表")
return views; private List<WoView> views = null;
}
public void setViews(List<WoView> views) { @FieldDescribe("栏目内所有的脚本信息列表")
this.views = views; private List<WoScript> scripts = null;
}
public List<WoQueryView> getQueryViews() { @FieldDescribe("栏目内所有的数据字典信息列表")
return queryViews; private List<WoAppDict> dicts = null;
}
public void setQueryViews(List<WoQueryView> queryViews) { public List<WoCategory> getCategories() {
this.queryViews = queryViews; return categories;
} }
public List<WoScript> getScripts() { public void setCategories(List<WoCategory> categories) {
return scripts; this.categories = categories;
} }
public void setScripts(List<WoScript> scripts) { public List<WoForm> getForms() {
this.scripts = scripts; return forms;
} }
public List<WoAppDict> getDicts() { public void setForms(List<WoForm> forms) {
return dicts; this.forms = forms;
} }
public void setDicts(List<WoAppDict> dicts) { public List<WoView> getViews() {
this.dicts = dicts; return views;
} }
}
/** public void setViews(List<WoView> views) {
* 用于输出的分类信息对象 this.views = views;
*/ }
public static class WoCategory extends CategoryInfo {
private static final long serialVersionUID = -5076990764713538973L; public List<WoScript> getScripts() {
return scripts;
}
public static List<String> excludes = new ArrayList<>(); public void setScripts(List<WoScript> scripts) {
this.scripts = scripts;
}
public static final WrapCopier<CategoryInfo, WoCategory> copier = WrapCopierFactory.wo( CategoryInfo.class, WoCategory.class, null, WoCategory.excludes ); public List<WoAppDict> getDicts() {
return dicts;
}
} public void setDicts(List<WoAppDict> dicts) {
this.dicts = dicts;
}
}
/** /**
* 用于输出的表单信息对象 * 用于输出的分类信息对象
*/ */
public static class WoForm extends Form { public static class WoCategory extends CategoryInfo {
private static final long serialVersionUID = -5076990764713538973L; private static final long serialVersionUID = -5076990764713538973L;
public static List<String> excludes = new ArrayList<>(); public static List<String> excludes = new ArrayList<>();
public static final WrapCopier<Form, WoForm> copier = WrapCopierFactory.wo( Form.class, WoForm.class, null, WoForm.excludes ); public static final WrapCopier<CategoryInfo, WoCategory> copier = WrapCopierFactory.wo(CategoryInfo.class,
WoCategory.class, null, WoCategory.excludes);
} }
/** /**
* 用于输出的列表视图信息对象 * 用于输出的表单信息对象
*/ */
public static class WoView extends View { public static class WoForm extends Form {
private static final long serialVersionUID = -5076990764713538973L; private static final long serialVersionUID = -5076990764713538973L;
public static List<String> excludes = new ArrayList<>(); public static List<String> excludes = new ArrayList<>();
public static final WrapCopier< View, WoView > copier = WrapCopierFactory.wo( View.class, WoView.class, null, WoView.excludes ); public static final WrapCopier<Form, WoForm> copier = WrapCopierFactory.wo(Form.class, WoForm.class, null,
WoForm.excludes);
@FieldDescribe("列表视图内所有的列表列信息") }
private List<ViewFieldConfig> fields = null;
@FieldDescribe("列表视图所有的分类关联关系") /**
private List<ViewCategory> viewCatagories = null; * 用于输出的列表视图信息对象
*/
public static class WoView extends View {
public List<ViewFieldConfig> getFields() { private static final long serialVersionUID = -5076990764713538973L;
return fields;
}
public void setFields(List<ViewFieldConfig> fields) { public static List<String> excludes = new ArrayList<>();
this.fields = fields;
}
public List<ViewCategory> getViewCatagories() { public static final WrapCopier<View, WoView> copier = WrapCopierFactory.wo(View.class, WoView.class, null,
return viewCatagories; WoView.excludes);
}
public void setViewCatagories(List<ViewCategory> viewCatagories) { @FieldDescribe("列表视图内所有的列表列信息")
this.viewCatagories = viewCatagories; private List<ViewFieldConfig> fields = null;
}
}
/** @FieldDescribe("列表视图所有的分类关联关系")
* 用于输出的数据视图信息对象 private List<ViewCategory> viewCatagories = null;
*/
public static class WoQueryView extends View {
private static final long serialVersionUID = -5076990764713538973L; public List<ViewFieldConfig> getFields() {
return fields;
}
public static List<String> excludes = new ArrayList<>(); public void setFields(List<ViewFieldConfig> fields) {
this.fields = fields;
}
public static final WrapCopier<View, WoQueryView> copier = WrapCopierFactory.wo( View.class, WoQueryView.class, null, WoQueryView.excludes ); public List<ViewCategory> getViewCatagories() {
return viewCatagories;
}
} public void setViewCatagories(List<ViewCategory> viewCatagories) {
this.viewCatagories = viewCatagories;
}
}
/** /**
* 用于输出的数据字典信息对象 * 用于输出的数据字典信息对象
*/ */
public static class WoScript extends Script { public static class WoScript extends Script {
private static final long serialVersionUID = -5076990764713538973L; private static final long serialVersionUID = -5076990764713538973L;
public static List<String> excludes = new ArrayList<>(); public static List<String> excludes = new ArrayList<>();
public static final WrapCopier<Script, WoScript> copier = WrapCopierFactory.wo( Script.class, WoScript.class, null, WoScript.excludes ); public static final WrapCopier<Script, WoScript> copier = WrapCopierFactory.wo(Script.class, WoScript.class,
null, WoScript.excludes);
} }
/** /**
* 用于输出的数据字典信息对象 * 用于输出的数据字典信息对象
*/ */
public static class WoAppDict extends AppDict { public static class WoAppDict extends AppDict {
private static final long serialVersionUID = -5076990764713538973L; private static final long serialVersionUID = -5076990764713538973L;
public static List<String> excludes = new ArrayList<>(); public static List<String> excludes = new ArrayList<>();
public static final WrapCopier<Script, WoScript> copier = WrapCopierFactory.wo( Script.class, WoScript.class, null, WoScript.excludes ); public static final WrapCopier<Script, WoScript> copier = WrapCopierFactory.wo(Script.class, WoScript.class,
null, WoScript.excludes);
@FieldDescribe("数据字典中所有的对象列表") @FieldDescribe("数据字典中所有的对象列表")
private List<WoAppDictItem> items = null; private List<WoAppDictItem> items = null;
} }
/** /**
* 用于输出的数据字典信息对象 * 用于输出的数据字典信息对象
*/ */
public static class WoAppDictItem extends AppDictItem { public static class WoAppDictItem extends AppDictItem {
private static final long serialVersionUID = -5076990764713538973L; private static final long serialVersionUID = -5076990764713538973L;
public static List<String> excludes = new ArrayList<>(); public static List<String> excludes = new ArrayList<>();
public static final WrapCopier<AppDictItem, WoAppDictItem> copier = WrapCopierFactory.wo( AppDictItem.class, WoAppDictItem.class, null, WoAppDictItem.excludes ); public static final WrapCopier<AppDictItem, WoAppDictItem> copier = WrapCopierFactory.wo(AppDictItem.class,
WoAppDictItem.class, null, WoAppDictItem.excludes);
} }
} }
...@@ -77,23 +77,23 @@ public class ActionSaveImportView extends BaseAction { ...@@ -77,23 +77,23 @@ public class ActionSaveImportView extends BaseAction {
// result.error( exception ); // result.error( exception );
// } // }
if( check ){ // if( check ){
if( StringUtils.isNotEmpty( wi.getViewId() )) { // if( StringUtils.isNotEmpty( wi.getViewId() )) {
try { // try {
view = queryViewService.getQueryView( wi.getViewId() ); // view = queryViewService.getQueryView( wi.getViewId() );
if( view == null ){ // if( view == null ){
check = false; // check = false;
Exception exception = new ExceptionViewInfoNotExists( wi.getViewId() ); // Exception exception = new ExceptionViewInfoNotExists( wi.getViewId() );
result.error( exception ); // result.error( exception );
} // }
} catch (Exception e) { // } catch (Exception e) {
check = false; // check = false;
Exception exception = new ExceptionCategoryInfoProcess( e, "根据ID查询数据视图信息对象时发生异常。VIEWID:" + wi.getViewId() ); // Exception exception = new ExceptionCategoryInfoProcess( e, "根据ID查询数据视图信息对象时发生异常。VIEWID:" + wi.getViewId() );
result.error( exception ); // result.error( exception );
logger.error( e, effectivePerson, request, null); // logger.error( e, effectivePerson, request, null);
} // }
} // }
} // }
if( check ){ if( check ){
try { try {
......
...@@ -6,7 +6,6 @@ import com.x.cms.assemble.control.service.AppInfoServiceAdv; ...@@ -6,7 +6,6 @@ import com.x.cms.assemble.control.service.AppInfoServiceAdv;
import com.x.cms.assemble.control.service.CategoryInfoServiceAdv; import com.x.cms.assemble.control.service.CategoryInfoServiceAdv;
import com.x.cms.assemble.control.service.DocumentQueryService; import com.x.cms.assemble.control.service.DocumentQueryService;
import com.x.cms.assemble.control.service.PermissionQueryService; 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.assemble.control.service.UserManagerService;
import com.x.cms.core.entity.AppInfo; import com.x.cms.core.entity.AppInfo;
import com.x.cms.core.entity.CategoryInfo; import com.x.cms.core.entity.CategoryInfo;
...@@ -15,9 +14,10 @@ import com.x.cms.core.entity.element.ViewCategory; ...@@ -15,9 +14,10 @@ import com.x.cms.core.entity.element.ViewCategory;
public class BaseAction extends StandardJaxrsAction { public class BaseAction extends StandardJaxrsAction {
protected Cache.CacheCategory cacheCategory = new Cache.CacheCategory(AppInfo.class, CategoryInfo.class, ViewCategory.class, Document.class); protected Cache.CacheCategory cacheCategory = new Cache.CacheCategory(AppInfo.class, CategoryInfo.class,
ViewCategory.class, Document.class);
protected QueryViewService queryViewService = new QueryViewService(); // protected QueryViewService queryViewService = new QueryViewService();
protected UserManagerService userManagerService = new UserManagerService(); protected UserManagerService userManagerService = new UserManagerService();
protected AppInfoServiceAdv appInfoServiceAdv = new AppInfoServiceAdv(); protected AppInfoServiceAdv appInfoServiceAdv = new AppInfoServiceAdv();
protected CategoryInfoServiceAdv categoryInfoServiceAdv = new CategoryInfoServiceAdv(); protected CategoryInfoServiceAdv categoryInfoServiceAdv = new CategoryInfoServiceAdv();
......
...@@ -132,37 +132,37 @@ public class ActionPersistImportDataExcel extends BaseAction { ...@@ -132,37 +132,37 @@ public class ActionPersistImportDataExcel extends BaseAction {
} }
} }
if( check ){ // if( check ){
try { // try {
view = queryViewService.getQueryView( viewId ); // view = queryViewService.getQueryView( viewId );
if( view == null ){ // if( view == null ){
check = false; // check = false;
Exception exception = new ExceptionViewNotExists( viewId ); // Exception exception = new ExceptionViewNotExists( viewId );
result.error( exception ); // result.error( exception );
} // }
} catch (Exception e) { // } catch (Exception e) {
check = false; // check = false;
Exception exception = new ExceptionDocumentInfoProcess( e, "根据ID查询分类信息绑定的导入数据视图信息对象时发生异常。VIEWID:" + viewId ); // Exception exception = new ExceptionDocumentInfoProcess( e, "根据ID查询分类信息绑定的导入数据视图信息对象时发生异常。VIEWID:" + viewId );
result.error( exception ); // result.error( exception );
logger.error( e, effectivePerson, request, null); // logger.error( e, effectivePerson, request, null);
} // }
} // }
if( check ){ // if( check ){
try { // try {
propertyNames = queryViewService.listColumnPathsFromQueryView(view); // propertyNames = queryViewService.listColumnPathsFromQueryView(view);
if( ListTools.isEmpty( propertyNames )) { // if( ListTools.isEmpty( propertyNames )) {
check = false; // check = false;
Exception exception = new ExceptionDocumentInfoProcess( "请检查导入视图中的列配置,数据路径path必须配置才可以导入。VIEWID:" + viewId ); // Exception exception = new ExceptionDocumentInfoProcess( "请检查导入视图中的列配置,数据路径path必须配置才可以导入。VIEWID:" + viewId );
result.error( exception ); // result.error( exception );
} // }
} catch (Exception e) { // } catch (Exception e) {
check = false; // check = false;
Exception exception = new ExceptionDocumentInfoProcess( e, "根据VIEWID查询数据视图中所有的列信息时发生异常。VIEWID:" + viewId ); // Exception exception = new ExceptionDocumentInfoProcess( e, "根据VIEWID查询数据视图中所有的列信息时发生异常。VIEWID:" + viewId );
result.error( exception ); // result.error( exception );
logger.error( e, effectivePerson, request, null); // logger.error( e, effectivePerson, request, null);
} // }
} // }
if( check ){ if( check ){
template = new ExcelReadRuntime.DocTemplate(); template = new ExcelReadRuntime.DocTemplate();
......
...@@ -27,7 +27,6 @@ import com.x.cms.assemble.control.service.FileInfoServiceAdv; ...@@ -27,7 +27,6 @@ import com.x.cms.assemble.control.service.FileInfoServiceAdv;
import com.x.cms.assemble.control.service.FormServiceAdv; import com.x.cms.assemble.control.service.FormServiceAdv;
import com.x.cms.assemble.control.service.LogService; import com.x.cms.assemble.control.service.LogService;
import com.x.cms.assemble.control.service.PermissionQueryService; 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.assemble.control.service.UserManagerService;
import com.x.cms.core.entity.AppInfo; import com.x.cms.core.entity.AppInfo;
import com.x.cms.core.entity.Document; import com.x.cms.core.entity.Document;
...@@ -39,7 +38,7 @@ public class BaseAction extends StandardJaxrsAction { ...@@ -39,7 +38,7 @@ public class BaseAction extends StandardJaxrsAction {
protected Cache.CacheCategory cacheCategory = new Cache.CacheCategory(Item.class, Document.class, DocumentCommentInfo.class); protected Cache.CacheCategory cacheCategory = new Cache.CacheCategory(Item.class, Document.class, DocumentCommentInfo.class);
protected LogService logService = new LogService(); protected LogService logService = new LogService();
protected QueryViewService queryViewService = new QueryViewService(); // protected QueryViewService queryViewService = new QueryViewService();
protected DocumentViewRecordServiceAdv documentViewRecordServiceAdv = new DocumentViewRecordServiceAdv(); protected DocumentViewRecordServiceAdv documentViewRecordServiceAdv = new DocumentViewRecordServiceAdv();
protected DocumentPersistService documentPersistService = new DocumentPersistService(); protected DocumentPersistService documentPersistService = new DocumentPersistService();
protected DocumentQueryService documentQueryService = new DocumentQueryService(); protected DocumentQueryService documentQueryService = new DocumentQueryService();
......
package com.x.cms.assemble.control.jaxrs.queryview;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.reflect.TypeToken;
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.bean.NameIdPair;
import com.x.base.core.project.gson.GsonPropertyObject;
import com.x.base.core.project.gson.XGsonBuilder;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.tools.ListTools;
import com.x.cms.assemble.control.Business;
import com.x.cms.assemble.control.ExceptionWrapInConvert;
import com.x.cms.core.entity.AppInfo;
import com.x.cms.core.entity.element.QueryView;
import com.x.cms.core.entity.query.DateRangeEntry;
import com.x.cms.core.entity.query.FilterEntry;
import com.x.cms.core.entity.query.Query;
import com.x.cms.core.entity.query.SelectEntry;
import com.x.cms.core.entity.query.WhereEntry;
public class ActionExecute extends BaseAction {
private static Type filterEntryCollectionType = new TypeToken<List<FilterEntry>>() {
}.getType();
private static Type stringCollectionType = new TypeToken<List<String>>() {
}.getType();
private Gson gson = XGsonBuilder.instance();
public ActionResult<Query> execute( HttpServletRequest request, EffectivePerson effectivePerson, String flag, String appId, JsonElement jsonElement ) throws Exception {
ActionResult<Query> result = new ActionResult<>();
Wi wi = null;
Boolean check = true;
try {
wi = this.convertToWrapIn( jsonElement, Wi.class );
} catch (Exception e ) {
check = false;
Exception exception = new ExceptionWrapInConvert( e, jsonElement );
result.error( exception );
e.printStackTrace();
}
if( check ){
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
AppInfo appInfo = business.getAppInfoFactory().get( appId );
QueryView queryView = business.queryViewFactory().pick( flag );
if (!business.queryViewFactory().allowRead( effectivePerson, queryView, appInfo )) {
throw new Exception("insufficient permissions.");
}
Query query = this.concrete( queryView, wi );
query.query();
/* 整理一下输出值 */
if ((null != query.getGroupEntry()) && query.getGroupEntry().available()) {
query.setGrid(null);
}
if ((null != query.getCalculate()) && (query.getCalculate().available())) {
query.setGrid(null);
query.setGroupGrid(null);
}
result.setData(query);
}
}
return result;
}
private Query concrete( QueryView queryView, Wi wi ) throws Exception {
Query query = gson.fromJson(queryView.getData(), Query.class);
if (null != wi) {
if (null != wi.getDate()) {
query.setDateRangeEntry( this.readDateRangeEntry(wi.getDate()) );
}
if ((null != wi.getFilter()) && (!wi.getFilter().isJsonNull())) {
query.setFilterEntryList(this.readFilterEntryList(wi.getFilter()));
}
if ((null != wi.getColumn()) && (!wi.getColumn().isJsonNull())) {
query.setColumnList(this.readColumnList(wi.getColumn(), query.getSelectEntryList()));
}
WhereEntry whereEntry = this.readWhereEntry( wi.getApplication(), wi.getCategory(),
wi.getUnitName(), wi.getPerson(), wi.getIdentity());
if (whereEntry.available()) {
query.setWhereEntry(whereEntry);
}
}
return query;
}
private WhereEntry readWhereEntry(JsonElement application, JsonElement category,
JsonElement unit, JsonElement person, JsonElement identity) throws Exception {
WhereEntry whereEntry = new WhereEntry();
if (null != application && (!application.isJsonNull())) {
whereEntry.setAppInfoList( this.readApplication(application) );
}
if (null != category && (!category.isJsonNull())) {
whereEntry.setCategoryList(this.readCategory( category ));
}
if (null != unit && (!unit.isJsonNull())) {
whereEntry.setUnitList(this.readUnit(unit));
}
if (null != person && (!person.isJsonNull())) {
whereEntry.setPersonList(this.readPerson(person));
}
if (null != identity && (!identity.isJsonNull())) {
whereEntry.setIdentityList(this.readIdentity(identity));
}
return whereEntry;
}
private List<NameIdPair> readApplication(JsonElement o) throws Exception {
List<NameIdPair> results = new ArrayList<>();
List<String> flags = new ArrayList<>();
if (o.isJsonArray()) {
flags = XGsonBuilder.instance().fromJson(o, stringCollectionType);
} else if (o.isJsonPrimitive() && o.getAsJsonPrimitive().isString()) {
flags.add(o.getAsJsonPrimitive().getAsString());
}
for (String str : flags) {
NameIdPair p = new NameIdPair(str, str);
results.add(p);
}
return results;
}
private List<NameIdPair> readCategory(JsonElement o) throws Exception {
List<NameIdPair> results = new ArrayList<>();
List<String> flags = new ArrayList<>();
if (o.isJsonArray()) {
flags = XGsonBuilder.instance().fromJson(o, stringCollectionType);
} else if (o.isJsonPrimitive() && o.getAsJsonPrimitive().isString()) {
flags.add(o.getAsJsonPrimitive().getAsString());
}
for (String str : flags) {
NameIdPair p = new NameIdPair(str, str);
results.add(p);
}
return results;
}
@SuppressWarnings("unused")
private List<NameIdPair> readTopUnit(JsonElement o) throws Exception {
List<NameIdPair> results = new ArrayList<>();
List<String> flags = new ArrayList<>();
if (o.isJsonArray()) {
flags = XGsonBuilder.instance().fromJson(o, stringCollectionType );
} else if (o.isJsonPrimitive() && o.getAsJsonPrimitive().isString()) {
flags.add(o.getAsJsonPrimitive().getAsString());
}
for (String str : flags) {
NameIdPair p = new NameIdPair(str, str);
results.add(p);
}
return results;
}
private List<NameIdPair> readUnit(JsonElement o) throws Exception {
List<NameIdPair> results = new ArrayList<>();
List<String> flags = new ArrayList<>();
if (o.isJsonArray()) {
flags = XGsonBuilder.instance().fromJson(o, stringCollectionType);
} else if (o.isJsonPrimitive() && o.getAsJsonPrimitive().isString()) {
flags.add(o.getAsJsonPrimitive().getAsString());
}
for (String str : flags) {
NameIdPair p = new NameIdPair(str, str);
results.add(p);
}
return results;
}
private List<NameIdPair> readIdentity(JsonElement o) throws Exception {
List<NameIdPair> results = new ArrayList<>();
List<String> flags = new ArrayList<>();
if (o.isJsonArray()) {
flags = XGsonBuilder.instance().fromJson(o, stringCollectionType);
} else if (o.isJsonPrimitive() && o.getAsJsonPrimitive().isString()) {
flags.add(o.getAsJsonPrimitive().getAsString());
}
for (String str : flags) {
NameIdPair p = new NameIdPair(str, str);
results.add(p);
}
return results;
}
private List<NameIdPair> readPerson(JsonElement o) throws Exception {
List<NameIdPair> results = new ArrayList<>();
List<String> flags = new ArrayList<>();
if (o.isJsonArray()) {
flags = XGsonBuilder.instance().fromJson(o, stringCollectionType);
} else if (o.isJsonPrimitive() && o.getAsJsonPrimitive().isString()) {
flags.add(o.getAsJsonPrimitive().getAsString());
}
for (String str : flags) {
NameIdPair p = new NameIdPair(str, str);
results.add(p);
}
return results;
}
private DateRangeEntry readDateRangeEntry(DateRangeEntry o) throws Exception {
if (!o.available()) {
throw new Exception("dateRangeEntry not available:" + o);
}
return o;
}
private List<FilterEntry> readFilterEntryList(JsonElement o) throws Exception {
List<FilterEntry> list = new ArrayList<>();
if (o.isJsonArray()) {
list = XGsonBuilder.instance().fromJson(o, filterEntryCollectionType);
} else if (o.isJsonObject()) {
list.add(XGsonBuilder.instance().fromJson(o, FilterEntry.class));
}
for (FilterEntry entry : list) {
if (!entry.available()) {
throw new Exception("filterEntry not available:" + entry);
}
}
return list;
}
private List<String> readColumnList(JsonElement o, List<SelectEntry> selectEntryList) throws Exception {
List<String> columns = new ArrayList<>();
if (o.isJsonArray()) {
/* 多值 */
for (JsonElement element : o.getAsJsonArray()) {
String column = this.getColumn(element, selectEntryList);
if (StringUtils.isNotEmpty(column)) {
columns.add(column);
}
}
} else if (o.isJsonPrimitive()) {
/* 单值 */
String column = this.getColumn(o, selectEntryList);
if (StringUtils.isNotEmpty(column)) {
columns.add(column);
}
}
return columns;
}
private String getColumn(JsonElement o, List<SelectEntry> list) throws Exception {
if (null == o || o.isJsonNull() || (!o.isJsonPrimitive()) || ListTools.isEmpty(list)) {
return null;
}
if (o.getAsJsonPrimitive().isNumber()) {
Integer idx = o.getAsJsonPrimitive().getAsInt();
if ((idx >= 1) && (idx <= (list.size() + 1))) {
return list.get(idx - 1).getColumn();
}
} else if (o.getAsJsonPrimitive().isString()) {
String str = o.getAsJsonPrimitive().getAsString();
for (SelectEntry entry : list) {
if (StringUtils.equals(entry.getColumn(), str)) {
return entry.getColumn();
}
}
}
return null;
}
public class Wi extends GsonPropertyObject {
@FieldDescribe("查询数据时间范围.")
private DateRangeEntry date;
@FieldDescribe("过滤条件内容.")
private JsonElement filter;
@FieldDescribe("展现的列信息.")
private JsonElement column;
@FieldDescribe("用于过滤条件的栏目ID.")
private JsonElement application;
@FieldDescribe("用于过滤条件的栏目ID列表.")
private JsonElement appIdList;
@FieldDescribe("用于过滤条件的分类ID.")
private JsonElement category;
@FieldDescribe("用于过滤条件的顶层组织名.")
private JsonElement topUnitName;
@FieldDescribe("用于过滤条件的拟稿者所属组织.")
private JsonElement unitName;
@FieldDescribe("用于过滤条件的拟稿人.")
private JsonElement person;
@FieldDescribe("用于过滤条件的拟稿人身份.")
private JsonElement identity;
public DateRangeEntry getDate() {
return date;
}
public void setDate(DateRangeEntry date) {
this.date = date;
}
public JsonElement getFilter() {
return filter;
}
public void setFilter(JsonElement filter) {
this.filter = filter;
}
public JsonElement getColumn() {
return column;
}
public void setColumn(JsonElement column) {
this.column = column;
}
public JsonElement getApplication() {
return application;
}
public void setApplication(JsonElement application) {
this.application = application;
}
public JsonElement getCategory() {
return category;
}
public void setCategory(JsonElement category) {
this.category = category;
}
public JsonElement getTopUnitName() {
return topUnitName;
}
public JsonElement getUnitName() {
return unitName;
}
public void setTopUnitName(JsonElement topUnitName) {
this.topUnitName = topUnitName;
}
public void setUnitName(JsonElement unitName) {
this.unitName = unitName;
}
public JsonElement getPerson() {
return person;
}
public void setPerson(JsonElement person) {
this.person = person;
}
public JsonElement getIdentity() {
return identity;
}
public void setIdentity(JsonElement identity) {
this.identity = identity;
}
public JsonElement getAppIdList() {
return appIdList;
}
public void setAppIdList(JsonElement appIdList) {
this.appIdList = appIdList;
}
}
}
\ No newline at end of file
package com.x.cms.assemble.control.jaxrs.queryview;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
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.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.cms.assemble.control.Business;
import com.x.cms.core.entity.element.QueryView;
public class ActionFlag extends BaseAction {
public ActionResult<Wo> execute( HttpServletRequest request, EffectivePerson effectivePerson, String flag) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Wo> result = new ActionResult<>();
Business business = new Business(emc);
QueryView queryView = business.queryViewFactory().pick( flag );
if( queryView == null ){
Exception exception = new ExceptionQueryViewNotExists( flag );
result.error( exception );
}else{
if (!business.queryViewFactory().allowRead( effectivePerson, queryView )) {
Exception exception = new ExceptionInsufficientPermissions( flag );
result.error( exception );
}else{
Wo wrap = Wo.copier.copy( queryView );
result.setData(wrap);
}
}
return result;
}
}
public static class Wo extends QueryView {
private static final long serialVersionUID = 2886873983211744188L;
public static List<String> excludes = new ArrayList<>(JpaObject.FieldsInvisible);
public static final WrapCopier<QueryView, Wo> copier = WrapCopierFactory.wo( QueryView.class, Wo.class, null, JpaObject.FieldsInvisible );
}
}
package com.x.cms.assemble.control.jaxrs.queryview;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import javax.servlet.http.HttpServletRequest;
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.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.organization.OrganizationDefinition;
import com.x.base.core.project.tools.SortTools;
import com.x.cms.assemble.control.Business;
import com.x.cms.core.entity.element.QueryView;
import com.x.cms.core.entity.element.QueryView_;
public class ActionList extends BaseAction {
public ActionResult<List<Wo>> execute(HttpServletRequest request, EffectivePerson effectivePerson) throws Exception {
List<String> identities = null;
List<String> unitNames = null;
identities = userManagerService.listIdentitiesWithPerson( effectivePerson.getDistinguishedName() );
unitNames = userManagerService.listUnitNamesWithPerson( effectivePerson.getDistinguishedName() );
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
ActionResult<List<Wo>> result = new ActionResult<>();
List<Wo> wraps = new ArrayList<>();
List<String> ids = this.list( business, effectivePerson, identities, unitNames );
List<QueryView> os = business.entityManagerContainer().list(QueryView.class, ids);
wraps = Wo.copier.copy(os);
SortTools.asc( wraps, true, "name" );
result.setData(wraps);
return result;
}
}
private List<String> list( Business business, EffectivePerson effectivePerson, List<String> identities, List<String> unitNames ) throws Exception {
EntityManager em = business.entityManagerContainer().get(QueryView.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<QueryView> root = cq.from(QueryView.class);
Predicate p = cb.conjunction();
/* 不是管理员或者流程管理员 */
if ( effectivePerson.isNotManager() && userManagerService.isHasPlatformRole( effectivePerson.getDistinguishedName(), OrganizationDefinition.ProcessPlatformManager )) {
p = cb.equal(root.get(QueryView_.creatorPerson), effectivePerson.getDistinguishedName());
p = cb.or(p, root.get(QueryView_.controllerList).in(effectivePerson.getDistinguishedName()));
p = cb.or(p,
cb.and(cb.isEmpty(root.get(QueryView_.availablePersonList)),
cb.isEmpty(root.get(QueryView_.availableUnitList)),
cb.isEmpty(root.get(QueryView_.availableIdentityList))));
p = cb.or(p, cb.isMember(effectivePerson.getDistinguishedName(), root.get(QueryView_.availablePersonList)));
p = cb.or(p, root.get(QueryView_.availableUnitList).in(unitNames));
p = cb.or(p, root.get(QueryView_.availableIdentityList).in(identities));
}
cq.select(root.get(QueryView_.id)).where(p);
List<String> list = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
return list;
}
public static class Wo extends QueryView {
private static final long serialVersionUID = 2886873983211744188L;
public static List<String> excludes = new ArrayList<>(JpaObject.FieldsInvisible);
public static final WrapCopier<QueryView, Wo> copier = WrapCopierFactory.wo( QueryView.class, Wo.class, null, JpaObject.FieldsInvisible);
}
}
package com.x.cms.assemble.control.jaxrs.queryview;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import javax.servlet.http.HttpServletRequest;
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.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.tools.SortTools;
import com.x.cms.assemble.control.Business;
import com.x.cms.core.entity.AppInfo;
import com.x.cms.core.entity.element.QueryView;
import com.x.cms.core.entity.element.QueryView_;
public class ActionListAll extends BaseAction {
public ActionResult<List<Wo>> execute(HttpServletRequest request, EffectivePerson effectivePerson) throws Exception {
ActionResult<List<Wo>> result = new ActionResult<>();
List<String> appInfoIds = null;
List<String> queryViewIds = null;
List<QueryView> queryViews = null;
List<AppInfo> appInfos = null;
List<WoQueryView> woQueryViews = null;
List<Wo> wraps = null;
Business business = null;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
business = new Business(emc);
appInfoIds = this.distinctAppInfoIdsWithQueryView( business );
if( appInfoIds != null && !appInfoIds.isEmpty() ) {
appInfos = appInfoServiceAdv.list( appInfoIds );
if( appInfos != null && !appInfos.isEmpty() ) {
wraps = Wo.copier.copy( appInfos );
for( Wo wrap : wraps ) {
queryViewIds = this.listQueryViewIdsWithAppInfoId( business, wrap.getId() );
if( queryViewIds != null && !queryViewIds.isEmpty() ) {
queryViews = business.entityManagerContainer().list( QueryView.class, queryViewIds );
if( queryViews != null && !queryViews.isEmpty() ) {
woQueryViews = WoQueryView.copier.copy( queryViews );
SortTools.asc( woQueryViews, true, "name" );
wrap.setQueryViews( woQueryViews );
}
}
}
}
SortTools.asc( wraps, true, "appName" );
}
result.setData(wraps);
return result;
}
}
/**
* 获取所有视图涉及的栏目信息ID列表
* @param business
* @return
* @throws Exception
*/
private List<String> distinctAppInfoIdsWithQueryView(Business business) throws Exception {
EntityManager em = business.entityManagerContainer().get(QueryView.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<QueryView> root = cq.from( QueryView.class );
cq.select(root.get( QueryView_.appId ));
List<String> list = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
return list;
}
private List<String> listQueryViewIdsWithAppInfoId( Business business, String appId ) throws Exception {
EntityManager em = business.entityManagerContainer().get(QueryView.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<QueryView> root = cq.from(QueryView.class);
Predicate p = cb.equal( root.get(QueryView_.appId), appId );
cq.select(root.get(QueryView_.id)).where(p);
List<String> list = em.createQuery(cq).getResultList().stream().distinct().collect(Collectors.toList());
return list;
}
public static class Wo extends AppInfo {
private static final long serialVersionUID = 2886873983211744188L;
public static List<String> excludes = new ArrayList<>(JpaObject.FieldsInvisible);
public static WrapCopier<AppInfo, Wo> copier = WrapCopierFactory.wo( AppInfo.class, Wo.class, null, JpaObject.FieldsInvisible );
private List<WoQueryView> queryViews = null;
public List<WoQueryView> getQueryViews() {
return queryViews;
}
public void setQueryViews(List<WoQueryView> queryViews) {
this.queryViews = queryViews;
}
}
public static class WoQueryView extends QueryView {
private static final long serialVersionUID = 2886873983211744188L;
public static List<String> excludes = new ArrayList<>(JpaObject.FieldsInvisible);
public static final WrapCopier<QueryView, WoQueryView> copier = WrapCopierFactory.wo( QueryView.class, WoQueryView.class, null, JpaObject.FieldsInvisible);
}
}
package com.x.cms.assemble.control.jaxrs.queryview;
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.cms.assemble.control.service.AppInfoServiceAdv;
import com.x.cms.assemble.control.service.UserManagerService;
public abstract class BaseAction extends StandardJaxrsAction {
protected AppInfoServiceAdv appInfoServiceAdv = new AppInfoServiceAdv();
protected UserManagerService userManagerService = new UserManagerService();
}
\ No newline at end of file
package com.x.cms.assemble.control.jaxrs.queryview;
import com.x.base.core.project.exception.LanguagePromptException;
class ExceptionInsufficientPermissions extends LanguagePromptException {
private static final long serialVersionUID = 1859164370743532895L;
ExceptionInsufficientPermissions( String flag ) {
super("视图操作权限不足。Flag:{}", flag );
}
}
package com.x.cms.assemble.control.jaxrs.queryview;
import com.x.base.core.project.exception.LanguagePromptException;
class ExceptionQueryViewNotExists extends LanguagePromptException {
private static final long serialVersionUID = 1859164370743532895L;
ExceptionQueryViewNotExists( String flag ) {
super("数据视图信息不存在,无法继续进行操作。id:{}", flag );
}
}
package com.x.cms.assemble.control.jaxrs.queryview;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.container.AsyncResponse;
import javax.ws.rs.container.Suspended;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import com.google.gson.JsonElement;
import com.x.base.core.project.annotation.JaxrsDescribe;
import com.x.base.core.project.annotation.JaxrsMethodDescribe;
import com.x.base.core.project.annotation.JaxrsParameterDescribe;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.http.HttpMediaType;
import com.x.base.core.project.jaxrs.ResponseFactory;
import com.x.cms.core.entity.query.Query;
@Path("queryview")
@JaxrsDescribe("数据视图信息管理")
public class QueryViewAction extends BaseAction {
@JaxrsMethodDescribe(value = "列示所有栏目中的数据视图信息.", action = ActionListAll.class)
@GET
@Path("list/all")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listAll( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request ) {
ActionResult<List<ActionListAll.Wo>> result = new ActionResult<>();
try {
EffectivePerson effectivePerson = this.effectivePerson( request );
result = new ActionListAll().execute( request, effectivePerson);
} catch (Throwable th) {
th.printStackTrace();
result.error(th);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "列示指定栏目中所有当前用户可见的数据视图信息.", action = ActionList.class)
@GET
@Path("list/application/flag/{applicationFlag}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void list( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request ) {
ActionResult<List<ActionList.Wo>> result = new ActionResult<>();
try {
EffectivePerson effectivePerson = this.effectivePerson( request );
result = new ActionList().execute( request, effectivePerson);
} catch (Throwable th) {
th.printStackTrace();
result.error(th);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "列示指定栏目中所有当前用户可见的数据视图信息.", action = ActionFlag.class)
@GET
@Path("flag/{flag}/application/flag/{applicationFlag}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void flag( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("数据视图信息标识") @PathParam("flag") String flag ) {
ActionResult<ActionFlag.Wo> result = new ActionResult<>();
try {
EffectivePerson effectivePerson = this.effectivePerson(request);
result = new ActionFlag().execute( request, effectivePerson, flag);
} catch (Throwable th) {
th.printStackTrace();
result.error(th);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "执行指定栏目中指定数据视图查询.", action = ActionExecute.class)
@PUT
@Path("flag/{flag}/application/flag/{appId}/execute")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void execute( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("数据视图信息标识") @PathParam("flag") String flag,
@JaxrsParameterDescribe("栏目ID") @PathParam("appId") String appId,
JsonElement jsonElement) {
ActionResult<Query> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
Boolean check = true;
if( check ){
try {
result = new ActionExecute().execute( request, effectivePerson, flag, appId, jsonElement);
} catch (Throwable th) {
th.printStackTrace();
result.error(th);
}
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "执行指定栏目中指定数据视图查询.", action = ActionExecute.class)
@POST
@Path("flag/{flag}/application/flag/{appId}/execute/mockputtopost")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void executeMockPutToPost( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("数据视图信息标识") @PathParam("flag") String flag,
@JaxrsParameterDescribe("栏目ID") @PathParam("appId") String appId,
JsonElement jsonElement) {
ActionResult<Query> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
Boolean check = true;
if( check ){
try {
result = new ActionExecute().execute( request, effectivePerson, flag, appId, jsonElement);
} catch (Throwable th) {
th.printStackTrace();
result.error(th);
}
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
}
package com.x.cms.assemble.control.jaxrs.queryviewdesign;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.google.gson.JsonElement;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.entity.annotation.CheckPersistType;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
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.WoId;
import com.x.cms.assemble.control.ExceptionWrapInConvert;
import com.x.cms.core.entity.AppInfo;
import com.x.cms.core.entity.element.QueryView;
class ActionCreate extends BaseAction {
ActionResult<Wo> execute(HttpServletRequest request, EffectivePerson effectivePerson, JsonElement jsonElement)
throws Exception {
ActionResult<Wo> result = new ActionResult<>();
Wi wrapIn = null;
Boolean check = true;
try {
wrapIn = this.convertToWrapIn(jsonElement, Wi.class);
} catch (Exception e) {
check = false;
Exception exception = new ExceptionWrapInConvert(e, jsonElement);
result.error(exception);
e.printStackTrace();
}
if (check && wrapIn != null) {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
AppInfo appInfo = null;
if (wrapIn.getAppId() != null && !wrapIn.getAppId().isEmpty()) {
appInfo = emc.find(wrapIn.getAppId(), AppInfo.class);
if (appInfo != null) {
QueryView queryView = new QueryView();
wrapIn.copyTo(queryView);
if (wrapIn != null && wrapIn.getId() != null && wrapIn.getId().isEmpty()) {
queryView.setId(wrapIn.getId());
}
queryView.setAppId(appInfo.getId());
queryView.setAppName(appInfo.getAppName());
queryView.setCreatorPerson(effectivePerson.getDistinguishedName());
queryView.setLastUpdatePerson(effectivePerson.getDistinguishedName());
queryView.setLastUpdateTime(new Date());
this.transQuery(queryView);
emc.beginTransaction(QueryView.class);
emc.persist(queryView, CheckPersistType.all);
emc.commit();
CacheManager.notify(QueryView.class);
Wo wo = new Wo();
wo.setId(queryView.getId());
result.setData(wo);
} else {
Exception exception = new ExceptionAppInfoNotExists(wrapIn.getAppId());
result.error(exception);
}
} else {
Exception exception = new ExceptionQueryViewAppIdEmpty();
result.error(exception);
}
}
}
return result;
}
public static class Wi extends QueryView {
private static final long serialVersionUID = -5237741099036357033L;
public static List<String> createExcludes = new ArrayList<>();
public static List<String> updateExcludes = new ArrayList<>();
public static final WrapCopier<Wi, QueryView> copier = WrapCopierFactory.wi(Wi.class, QueryView.class, null,
Wi.createExcludes);
static {
createExcludes.add(JpaObject.distributeFactor_FIELDNAME);
createExcludes.add("updateTime");
createExcludes.add("createTime");
createExcludes.add("sequence");
createExcludes.add("lastUpdatePerson");
createExcludes.add("lastUpdateTime");
}
static {
updateExcludes.add(JpaObject.distributeFactor_FIELDNAME);
updateExcludes.add(JpaObject.id_FIELDNAME);
updateExcludes.add("updateTime");
updateExcludes.add("createTime");
updateExcludes.add("sequence");
updateExcludes.add("lastUpdatePerson");
updateExcludes.add("lastUpdateTime");
}
}
public static class Wo extends WoId {
}
}
package com.x.cms.assemble.control.jaxrs.queryviewdesign;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.entity.annotation.CheckRemoveType;
import com.x.base.core.project.cache.CacheManager;
import com.x.base.core.project.exception.ExceptionWhen;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WoId;
import com.x.cms.core.entity.element.QueryView;
class ActionDelete extends BaseAction {
ActionResult<Wo> execute( EffectivePerson effectivePerson, String id) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Wo> result = new ActionResult<>();
//Business business = new Business(emc);
emc.beginTransaction(QueryView.class);
QueryView queryView = emc.find(id, QueryView.class, ExceptionWhen.not_found);
//AppInfo appInfo = emc.find(queryView.getAppId(), AppInfo.class, ExceptionWhen.not_found);
//business.applicationEditAvailable(effectivePerson, application, ExceptionWhen.not_allow);
emc.remove(queryView, CheckRemoveType.all);
emc.commit();
CacheManager.notify(QueryView.class);
Wo wo = new Wo();
wo.setId( queryView.getId() );
result.setData( wo );
return result;
}
}
public static class Wo extends WoId {
}
}
package com.x.cms.assemble.control.jaxrs.queryviewdesign;
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.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.cms.core.entity.element.QueryView;
class ActionFlag extends BaseAction {
ActionResult<Wo> execute(EffectivePerson effectivePerson, String flag) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Wo> result = new ActionResult<>();
QueryView queryView = emc.flag(flag, QueryView.class);
Wo wrap = Wo.copier.copy(queryView);
result.setData(wrap);
return result;
}
}
public static class Wo extends QueryView {
private static final long serialVersionUID = 2886873983211744188L;
public static final WrapCopier<QueryView, Wo> copier = WrapCopierFactory.wo(QueryView.class, Wo.class, null,
JpaObject.FieldsInvisible);
private Long rank;
public Long getRank() {
return rank;
}
public void setRank(Long rank) {
this.rank = rank;
}
}
}
package com.x.cms.assemble.control.jaxrs.queryviewdesign;
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.exception.ExceptionWhen;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.cms.core.entity.element.QueryView;
class ActionGet extends BaseAction {
ActionResult<Wo> execute(EffectivePerson effectivePerson, String id) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Wo> result = new ActionResult<>();
QueryView queryView = emc.find(id, QueryView.class, ExceptionWhen.not_found);
Wo wrap = Wo.copier.copy(queryView);
result.setData(wrap);
return result;
}
}
public static class Wo extends QueryView {
private static final long serialVersionUID = 2886873983211744188L;
public static final WrapCopier<QueryView, Wo> copier = WrapCopierFactory.wo(QueryView.class, Wo.class, null, JpaObject.FieldsInvisible);
private Long rank;
public Long getRank() {
return rank;
}
public void setRank(Long rank) {
this.rank = rank;
}
}
}
package com.x.cms.assemble.control.jaxrs.queryviewdesign;
import java.util.ArrayList;
import java.util.List;
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.http.ActionResult;
import com.x.cms.core.entity.element.QueryView;
class ActionListNext extends BaseAction {
ActionResult<List<Wo>> execute(String id, Integer count) throws Exception {
ActionResult<List<Wo>> result = new ActionResult<>();
result = this.standardListNext(Wo.copier, id, count, "sequence", null, null, null, null, null, null, null, null,
true, DESC);
return result;
}
public static class Wo extends QueryView {
private static final long serialVersionUID = 2886873983211744188L;
public static List<String> excludes = new ArrayList<>(JpaObject.FieldsInvisible);
public static final WrapCopier<QueryView, Wo> copier = WrapCopierFactory.wo(QueryView.class, Wo.class, null,
Wo.excludes);
private Long rank;
public Long getRank() {
return rank;
}
public void setRank(Long rank) {
this.rank = rank;
}
}
}
package com.x.cms.assemble.control.jaxrs.queryviewdesign;
import java.util.ArrayList;
import java.util.List;
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.http.ActionResult;
import com.x.cms.core.entity.element.QueryView;
class ActionListPrev extends BaseAction {
ActionResult<List<Wo>> execute(String id, Integer count) throws Exception {
ActionResult<List<Wo>> result = new ActionResult<>();
result = this.standardListPrev(Wo.copier, id, count, "sequence", null, null, null, null, null, null, null, null,
true, DESC);
return result;
}
public static class Wo extends QueryView {
private static final long serialVersionUID = 2886873983211744188L;
public static List<String> excludes = new ArrayList<>(JpaObject.FieldsInvisible);
public static final WrapCopier<QueryView, Wo> copier = WrapCopierFactory.wo(QueryView.class, Wo.class, null,
Wo.excludes);
private Long rank;
public Long getRank() {
return rank;
}
public void setRank(Long rank) {
this.rank = rank;
}
}
}
package com.x.cms.assemble.control.jaxrs.queryviewdesign;
import java.util.ArrayList;
import java.util.List;
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.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.tools.SortTools;
import com.x.cms.assemble.control.Business;
import com.x.cms.core.entity.element.QueryView;
class ActionListWithApplication extends BaseAction {
ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, String appId )
throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<List<Wo>> result = new ActionResult<>();
List<Wo> wraps = new ArrayList<>();
Business business = new Business(emc);
List<String> ids = business.queryViewFactory().listWithAppId( appId );
List<QueryView> os = emc.list(QueryView.class, ids);
wraps = Wo.copier.copy(os);
SortTools.asc(wraps, "name");
result.setData(wraps);
return result;
}
}
public static class Wo extends QueryView {
private static final long serialVersionUID = 2886873983211744188L;
public static final WrapCopier<QueryView, Wo> copier = WrapCopierFactory.wo(QueryView.class, Wo.class, null, JpaObject.FieldsInvisible);
private Long rank;
public Long getRank() {
return rank;
}
public void setRank(Long rank) {
this.rank = rank;
}
}
}
package com.x.cms.assemble.control.jaxrs.queryviewdesign;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.reflect.TypeToken;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.project.bean.NameIdPair;
import com.x.base.core.project.gson.XGsonBuilder;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.tools.ListTools;
import com.x.cms.core.entity.element.QueryView;
import com.x.cms.core.entity.query.DateRangeEntry;
import com.x.cms.core.entity.query.FilterEntry;
import com.x.cms.core.entity.query.Query;
import com.x.cms.core.entity.query.SelectEntry;
import com.x.cms.core.entity.query.WhereEntry;
class ActionSimulate extends BaseAction {
private static Type filterEntryCollectionType = new TypeToken<List<FilterEntry>>() {
}.getType();
private static Type stringCollectionType = new TypeToken<List<String>>() {
}.getType();
public ActionResult<Query> execute(EffectivePerson effectivePerson, String flag, WrapInQueryViewExecute wrapIn)
throws Exception {
/* 前台通过wrapIn将Query的可选择部分FilterEntryList和WhereEntry进行输入 */
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Query> result = new ActionResult<>();
QueryView queryView = emc.flag(flag, QueryView.class);
Query query = this.concrete(queryView);
if (null != wrapIn) {
if (null != wrapIn.getDate()) {
query.setDateRangeEntry(this.readDateRangeEntry(wrapIn.getDate()));
}
if ((null != wrapIn.getFilter()) && (!wrapIn.getFilter().isJsonNull())) {
query.setFilterEntryList(this.readFilterEntryList(wrapIn.getFilter()));
}
if ((null != wrapIn.getColumn()) && (!wrapIn.getColumn().isJsonNull())) {
query.setColumnList(this.readColumnList(wrapIn.getColumn(), query.getSelectEntryList()));
}
WhereEntry whereEntry = this.readWhereEntry(wrapIn.getApplication(), wrapIn.getCategory(),
wrapIn.getUnit(), wrapIn.getPerson(), wrapIn.getIdentity());
if (whereEntry.available()) {
query.setWhereEntry(whereEntry);
}
}
query.query();
/* 整理一下输出值 */
if ((null != query.getGroupEntry()) && query.getGroupEntry().available()) {
query.setGrid(null);
}
if ((null != query.getCalculate()) && (query.getCalculate().available())) {
query.setGrid(null);
query.setGroupGrid(null);
}
result.setData(query);
return result;
}
}
private DateRangeEntry readDateRangeEntry(DateRangeEntry o) throws Exception {
if (!o.available()) {
throw new Exception("dateRangeEntry not available:" + o);
}
return o;
}
private List<FilterEntry> readFilterEntryList(JsonElement o) throws Exception {
List<FilterEntry> list = new ArrayList<>();
if (o.isJsonArray()) {
list = XGsonBuilder.instance().fromJson(o, filterEntryCollectionType);
} else if (o.isJsonObject()) {
list.add(XGsonBuilder.instance().fromJson(o, FilterEntry.class));
}
for (FilterEntry entry : list) {
if (!entry.available()) {
throw new Exception("filterEntry not available:" + entry);
}
}
return list;
}
private WhereEntry readWhereEntry(JsonElement application, JsonElement process, JsonElement unit,
JsonElement person, JsonElement identity) throws Exception {
WhereEntry whereEntry = new WhereEntry();
if (null != application && (!application.isJsonNull())) {
whereEntry.setAppInfoList(this.readApplication(application));
}
if (null != process && (!process.isJsonNull())) {
whereEntry.setCategoryList(this.readCategory(process));
}
if (null != unit && (!unit.isJsonNull())) {
whereEntry.setUnitList(this.readUnit(unit));
}
if (null != person && (!person.isJsonNull())) {
whereEntry.setPersonList(this.readPerson(person));
}
if (null != identity && (!identity.isJsonNull())) {
whereEntry.setIdentityList(this.readIdentity(identity));
}
return whereEntry;
}
private List<String> readColumnList(JsonElement o, List<SelectEntry> selectEntryList) throws Exception {
List<String> columns = new ArrayList<>();
if (o.isJsonArray()) {
/* 多值 */
for (JsonElement element : o.getAsJsonArray()) {
String column = this.getColumn(element, selectEntryList);
if (StringUtils.isNotEmpty(column)) {
columns.add(column);
}
}
} else if (o.isJsonPrimitive()) {
/* 单值 */
String column = this.getColumn(o, selectEntryList);
if (StringUtils.isNotEmpty(column)) {
columns.add(column);
}
}
return columns;
}
private String getColumn(JsonElement o, List<SelectEntry> list) throws Exception {
if (null == o || o.isJsonNull() || (!o.isJsonPrimitive()) || ListTools.isEmpty(list)) {
return null;
}
if (o.getAsJsonPrimitive().isNumber()) {
Integer idx = o.getAsJsonPrimitive().getAsInt();
if ((idx >= 1) && (idx <= (list.size() + 1))) {
return list.get(idx - 1).getColumn();
}
} else if (o.getAsJsonPrimitive().isString()) {
String str = o.getAsJsonPrimitive().getAsString();
for (SelectEntry entry : list) {
if (StringUtils.equals(entry.getColumn(), str)) {
return entry.getColumn();
}
}
}
return null;
}
private Query concrete(QueryView queryView) throws Exception {
Gson gson = XGsonBuilder.instance();
Query query = gson.fromJson(queryView.getData(), Query.class);
return query;
}
private List<NameIdPair> readApplication(JsonElement o) throws Exception {
List<NameIdPair> results = new ArrayList<>();
List<String> flags = new ArrayList<>();
if (o.isJsonArray()) {
flags = XGsonBuilder.instance().fromJson(o, stringCollectionType);
} else if (o.isJsonPrimitive() && o.getAsJsonPrimitive().isString()) {
flags.add(o.getAsJsonPrimitive().getAsString());
}
for (String str : flags) {
NameIdPair p = new NameIdPair(str, str);
results.add(p);
}
return results;
}
private List<NameIdPair> readCategory(JsonElement o) throws Exception {
List<NameIdPair> results = new ArrayList<>();
List<String> flags = new ArrayList<>();
if (o.isJsonArray()) {
flags = XGsonBuilder.instance().fromJson(o, stringCollectionType);
} else if (o.isJsonPrimitive() && o.getAsJsonPrimitive().isString()) {
flags.add(o.getAsJsonPrimitive().getAsString());
}
for (String str : flags) {
NameIdPair p = new NameIdPair(str, str);
results.add(p);
}
return results;
}
private List<NameIdPair> readUnit(JsonElement o) throws Exception {
List<NameIdPair> results = new ArrayList<>();
List<String> flags = new ArrayList<>();
if (o.isJsonArray()) {
flags = XGsonBuilder.instance().fromJson(o, stringCollectionType);
} else if (o.isJsonPrimitive() && o.getAsJsonPrimitive().isString()) {
flags.add(o.getAsJsonPrimitive().getAsString());
}
for (String str : flags) {
NameIdPair p = new NameIdPair(str, str);
results.add(p);
}
return results;
}
private List<NameIdPair> readIdentity(JsonElement o) throws Exception {
List<NameIdPair> results = new ArrayList<>();
List<String> flags = new ArrayList<>();
if (o.isJsonArray()) {
flags = XGsonBuilder.instance().fromJson(o, stringCollectionType);
} else if (o.isJsonPrimitive() && o.getAsJsonPrimitive().isString()) {
flags.add(o.getAsJsonPrimitive().getAsString());
}
for (String str : flags) {
NameIdPair p = new NameIdPair(str, str);
results.add(p);
}
return results;
}
private List<NameIdPair> readPerson(JsonElement o) throws Exception {
List<NameIdPair> results = new ArrayList<>();
List<String> flags = new ArrayList<>();
if (o.isJsonArray()) {
flags = XGsonBuilder.instance().fromJson(o, stringCollectionType);
} else if (o.isJsonPrimitive() && o.getAsJsonPrimitive().isString()) {
flags.add(o.getAsJsonPrimitive().getAsString());
}
for (String str : flags) {
NameIdPair p = new NameIdPair(str, str);
results.add(p);
}
return results;
}
}
\ No newline at end of file
package com.x.cms.assemble.control.jaxrs.queryviewdesign;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import com.google.gson.JsonElement;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.entity.annotation.CheckPersistType;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
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.WoId;
import com.x.cms.assemble.control.ExceptionWrapInConvert;
import com.x.cms.core.entity.element.QueryView;
class ActionUpdate extends BaseAction {
ActionResult<Wo> execute( EffectivePerson effectivePerson, String id, JsonElement jsonElement ) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
Wi wrapIn = null;
Boolean check = true;
try {
wrapIn = this.convertToWrapIn( jsonElement, Wi.class );
} catch (Exception e ) {
check = false;
Exception exception = new ExceptionWrapInConvert( e, jsonElement );
result.error( exception );
e.printStackTrace();
}
if( check ){
try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create() ) {
QueryView queryView = emc.find( id, QueryView.class );
if( queryView != null ) {
emc.beginTransaction(QueryView.class);
wrapIn.copyTo( queryView, JpaObject.ID_DISTRIBUTEFACTOR );
if( StringUtils.isEmpty( queryView.getCreatorPerson() )) {
queryView.setCreatorPerson( effectivePerson.getDistinguishedName() );
}
queryView.setLastUpdatePerson(effectivePerson.getDistinguishedName());
queryView.setLastUpdateTime( new Date() );
this.transQuery(queryView);
emc.check(queryView, CheckPersistType.all);
emc.commit();
CacheManager.notify(QueryView.class);
Wo wo = new Wo();
wo.setId( queryView.getId() );
result.setData( wo );
}else {
Exception exception = new ExceptionQueryViewNotExists( id );
result.error(exception);
}
}
}
return result;
}
public static class Wi extends QueryView {
private static final long serialVersionUID = -5237741099036357033L;
public static List<String> createExcludes = new ArrayList<>();
public static List<String> updateExcludes = new ArrayList<>();
public static final WrapCopier<Wi, QueryView> copier = WrapCopierFactory .wi( Wi.class, QueryView.class, null, Wi.createExcludes);
static {
createExcludes.add(JpaObject.distributeFactor_FIELDNAME);
createExcludes.add("updateTime");
createExcludes.add("createTime");
createExcludes.add("sequence");
createExcludes.add("lastUpdatePerson");
createExcludes.add("lastUpdateTime");
}
static {
updateExcludes.add(JpaObject.distributeFactor_FIELDNAME);
updateExcludes.add(JpaObject.id_FIELDNAME);
updateExcludes.add("updateTime");
updateExcludes.add("createTime");
updateExcludes.add("sequence");
updateExcludes.add("lastUpdatePerson");
updateExcludes.add("lastUpdateTime");
}
}
public static class Wo extends WoId {
}
}
package com.x.cms.assemble.control.jaxrs.queryviewdesign;
import com.google.gson.Gson;
import com.x.base.core.project.gson.XGsonBuilder;
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.cms.core.entity.element.QueryView;
import com.x.cms.core.entity.query.Query;
class BaseAction extends StandardJaxrsAction {
protected void transQuery( QueryView queryView ) {
Gson gson = XGsonBuilder.instance();
Query query = gson.fromJson( queryView.getData(), Query.class );
queryView.setData( gson.toJson(query) );
}
}
package com.x.cms.assemble.control.jaxrs.queryviewdesign;
import com.x.base.core.project.exception.LanguagePromptException;
class ExceptionAppInfoNotExists extends LanguagePromptException {
private static final long serialVersionUID = 1859164370743532895L;
ExceptionAppInfoNotExists( String id ) {
super("指定的应用不存在:{}" + id );
}
}
package com.x.cms.assemble.control.jaxrs.queryviewdesign;
import com.x.base.core.project.exception.LanguagePromptException;
class ExceptionQueryViewAppIdEmpty extends LanguagePromptException {
private static final long serialVersionUID = 1859164370743532895L;
ExceptionQueryViewAppIdEmpty() {
super("视图信息中应用栏目ID为空,无法保存视图信息。" );
}
}
package com.x.cms.assemble.control.jaxrs.queryviewdesign;
import com.x.base.core.project.exception.LanguagePromptException;
class ExceptionQueryViewNotExists extends LanguagePromptException {
private static final long serialVersionUID = 1859164370743532895L;
ExceptionQueryViewNotExists( String flag ) {
super("指定的数据视图不存在:{}" + flag );
}
}
package com.x.cms.assemble.control.jaxrs.queryviewdesign;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.container.AsyncResponse;
import javax.ws.rs.container.Suspended;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import com.google.gson.JsonElement;
import com.x.base.core.project.annotation.JaxrsDescribe;
import com.x.base.core.project.annotation.JaxrsMethodDescribe;
import com.x.base.core.project.annotation.JaxrsParameterDescribe;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.http.HttpMediaType;
import com.x.base.core.project.jaxrs.ResponseFactory;
import com.x.cms.assemble.control.ExceptionWrapInConvert;
import com.x.cms.core.entity.query.Query;
@Path("queryview/design")
@JaxrsDescribe("数据视图设计信息管理")
public class QueryViewDesignAction extends BaseAction {
@JaxrsMethodDescribe(value = "列示数据视图设计信息对象,下一页.", action = ActionListNext.class)
@GET
@Path("list/{id}/next/{count}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listNext( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("最后一条信息ID,如果是第一页,则可以用(0)代替") @PathParam("id") String id,
@JaxrsParameterDescribe("每页显示的条目数量") @PathParam("count") Integer count
) {
ActionResult<List<ActionListNext.Wo>> result = new ActionResult<>();
try {
result = new ActionListNext().execute(id, count);
} catch (Throwable th) {
th.printStackTrace();
result.error(th);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "列示数据视图设计信息对象,上一页.", action = ActionListPrev.class)
@GET
@Path("list/{id}/prev/{count}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void standardListPrev( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("最后一条信息ID,如果是第一页,则可以用(0)代替") @PathParam("id") String id,
@JaxrsParameterDescribe("每页显示的条目数量") @PathParam("count") Integer count
) {
ActionResult<List<ActionListPrev.Wo>> result = new ActionResult<>();
try {
result = new ActionListPrev().execute(id, count);
} catch (Throwable th) {
th.printStackTrace();
result.error(th);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "根据标识获取数据视图设计信息内容.", action = ActionFlag.class)
@GET
@Path("flag/{flag}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void flag( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("视图信息标识") @PathParam("flag") String flag) {
ActionResult<ActionFlag.Wo> result = new ActionResult<>();
try {
EffectivePerson effectivePerson = this.effectivePerson(request);
result = new ActionFlag().execute(effectivePerson, flag);
} catch (Throwable th) {
th.printStackTrace();
result.error(th);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "根据ID获取数据视图设计信息内容.", action = ActionGet.class)
@GET
@Path("{id}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void get( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("视图信息ID") @PathParam("id") String id) {
ActionResult<ActionGet.Wo> result = new ActionResult<>();
try {
EffectivePerson effectivePerson = this.effectivePerson(request);
result = new ActionGet().execute(effectivePerson, id);
} catch (Throwable th) {
th.printStackTrace();
result.error(th);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe( value = "创建数据视图设计信息.", action = ActionCreate.class )
@POST
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void create( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, JsonElement jsonElement) {
ActionResult<ActionCreate.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
Boolean check = true;
if( check ){
try {
result = new ActionCreate().execute( request, effectivePerson, jsonElement );
} catch (Throwable th) {
th.printStackTrace();
result.error(th);
}
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe( value = "更新数据视图设计信息.", action = ActionUpdate.class )
@PUT
@Path("{id}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void update( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("视图信息ID") @PathParam("id") String id,
JsonElement jsonElement) {
ActionResult<ActionUpdate.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
Boolean check = true;
if( check ){
try {
result = new ActionUpdate().execute(effectivePerson, id, jsonElement );
} catch (Throwable th) {
th.printStackTrace();
result.error(th);
}
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe( value = "更新数据视图设计信息.", action = ActionUpdate.class )
@POST
@Path("{id}/mockputtopost")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void updateMockPutToPost( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("视图信息ID") @PathParam("id") String id,
JsonElement jsonElement) {
ActionResult<ActionUpdate.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
Boolean check = true;
if( check ){
try {
result = new ActionUpdate().execute(effectivePerson, id, jsonElement );
} catch (Throwable th) {
th.printStackTrace();
result.error(th);
}
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe( value = "删除数据视图设计信息.", action = ActionDelete.class )
@DELETE
@Path("{id}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void delete( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("视图信息ID") @PathParam("id") String id) {
ActionResult<ActionDelete.Wo> result = new ActionResult<>();
try {
EffectivePerson effectivePerson = this.effectivePerson(request);
result = new ActionDelete().execute( effectivePerson, id );
} catch (Throwable th) {
th.printStackTrace();
result.error(th);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe( value = "删除数据视图设计信息.", action = ActionDelete.class )
@GET
@Path("{id}/mockdeletetoget")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void deleteMockDeleteToGet( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("视图信息ID") @PathParam("id") String id) {
ActionResult<ActionDelete.Wo> result = new ActionResult<>();
try {
EffectivePerson effectivePerson = this.effectivePerson(request);
result = new ActionDelete().execute( effectivePerson, id );
} catch (Throwable th) {
th.printStackTrace();
result.error(th);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe( value = "根据应用列示视图设计信息.", action = ActionListWithApplication.class )
@GET
@Path("list/application/{applicationId}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listWithApplication( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("栏目信息ID") @PathParam("applicationId") String applicationId ) {
ActionResult<List<ActionListWithApplication.Wo>> result = new ActionResult<>();
try {
EffectivePerson effectivePerson = this.effectivePerson(request);
result = new ActionListWithApplication().execute(effectivePerson, applicationId);
} catch (Throwable th) {
th.printStackTrace();
result.error(th);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe( value = "模拟执行视图设计信息.", action = ActionSimulate.class )
@PUT
@Path("flag/{flag}/simulate")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void simulate( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("视图信息标识")@PathParam("flag") String flag, JsonElement jsonElement ) {
ActionResult<Query> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
WrapInQueryViewExecute wrapIn = null;
Boolean check = true;
try {
wrapIn = this.convertToWrapIn( jsonElement, WrapInQueryViewExecute.class );
} catch (Exception e ) {
check = false;
Exception exception = new ExceptionWrapInConvert( e, jsonElement );
result.error( exception );
e.printStackTrace();
}
if( check ){
try {
result = new ActionSimulate().execute(effectivePerson, flag, wrapIn);
} catch (Throwable th) {
th.printStackTrace();
result.error(th);
}
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe( value = "模拟执行视图设计信息.", action = ActionSimulate.class )
@POST
@Path("flag/{flag}/simulate/mockputtopost")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void simulateMockPutToPost( @Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("视图信息标识")@PathParam("flag") String flag, JsonElement jsonElement ) {
ActionResult<Query> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
WrapInQueryViewExecute wrapIn = null;
Boolean check = true;
try {
wrapIn = this.convertToWrapIn( jsonElement, WrapInQueryViewExecute.class );
} catch (Exception e ) {
check = false;
Exception exception = new ExceptionWrapInConvert( e, jsonElement );
result.error( exception );
e.printStackTrace();
}
if( check ){
try {
result = new ActionSimulate().execute(effectivePerson, flag, wrapIn);
} catch (Throwable th) {
th.printStackTrace();
result.error(th);
}
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
}
package com.x.cms.assemble.control.jaxrs.queryviewdesign;
import com.google.gson.JsonElement;
import com.x.base.core.project.gson.GsonPropertyObject;
import com.x.cms.core.entity.query.DateRangeEntry;
public class WrapInQueryViewExecute extends GsonPropertyObject {
private DateRangeEntry date;
private JsonElement filter;
private JsonElement column;
private JsonElement application;
private JsonElement category;
private JsonElement unit;
private JsonElement person;
private JsonElement identity;
public DateRangeEntry getDate() {
return date;
}
public void setDate(DateRangeEntry date) {
this.date = date;
}
public JsonElement getFilter() {
return filter;
}
public void setFilter(JsonElement filter) {
this.filter = filter;
}
public JsonElement getColumn() {
return column;
}
public void setColumn(JsonElement column) {
this.column = column;
}
public JsonElement getApplication() {
return application;
}
public void setApplication(JsonElement application) {
this.application = application;
}
public JsonElement getCategory() {
return category;
}
public void setCategory(JsonElement category) {
this.category = category;
}
public JsonElement getUnit() {
return unit;
}
public void setUnit(JsonElement unit) {
this.unit = unit;
}
public JsonElement getPerson() {
return person;
}
public void setPerson(JsonElement person) {
this.person = person;
}
public JsonElement getIdentity() {
return identity;
}
public void setIdentity(JsonElement identity) {
this.identity = identity;
}
}
\ No newline at end of file
...@@ -147,9 +147,9 @@ public class CategoryInfoService { ...@@ -147,9 +147,9 @@ public class CategoryInfoService {
//补全默认列表名称 //补全默认列表名称
if ( StringUtils.isNotEmpty( object.getDefaultViewId() ) ) { if ( StringUtils.isNotEmpty( object.getDefaultViewId() ) ) {
View queryView = emc.find( object.getDefaultViewId(), View.class ); View view = emc.find( object.getDefaultViewId(), View.class );
if (queryView != null) { if (view != null) {
object.setDefaultViewName( queryView.getName() ); object.setDefaultViewName( view.getName() );
} else { } else {
throw new Exception("category default view not exits. view id:" + object.getDefaultViewId() ); throw new Exception("category default view not exits. view id:" + object.getDefaultViewId() );
} }
......
package com.x.cms.assemble.control.service;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import com.google.gson.Gson;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.project.gson.XGsonBuilder;
import com.x.query.core.entity.View;
import com.x.query.core.express.plan.CmsPlan;
import com.x.query.core.express.plan.SelectEntries;
import com.x.query.core.express.plan.SelectEntry;
/**
* 查询数据中心视图
* @author O2LEE
*
*/
public class QueryViewService {
private static Gson gson = XGsonBuilder.instance();
public View getQueryView( String id ) throws Exception{
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
return emc.find( id, View.class );
}
}
public List<String> listColumnsFromQueryView( String id ) throws Exception{
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
View view = emc.find( id, View.class );
if (null == view) {
throw new Exception("view is not exists.id:" + id);
}
CmsPlan cmsPlan = gson.fromJson( view.getData(), CmsPlan.class );
SelectEntries selectEntries = cmsPlan.selectList;
List<String> columnNames = new ArrayList<>();
for (SelectEntry o : selectEntries ) {
columnNames.add( o.column );
}
return columnNames;
}
}
public List<String> listColumnsFromQueryView( View view ) throws Exception{
if (null == view) {
throw new Exception("view is null");
}
CmsPlan cmsPlan = gson.fromJson( view.getData(), CmsPlan.class );
SelectEntries selectEntries = cmsPlan.selectList;
List<String> columnNames = new ArrayList<>();
for (SelectEntry o : selectEntries ) {
columnNames.add( o.column );
}
return columnNames;
}
public List<String> listColumnPathsFromQueryView( View view ) throws Exception{
if (null == view) {
throw new Exception("view is null");
}
CmsPlan cmsPlan = gson.fromJson( view.getData(), CmsPlan.class );
SelectEntries selectEntries = cmsPlan.selectList;
List<String> columnNames = new ArrayList<>();
for (SelectEntry o : selectEntries ) {
if( o.path != null ) {
o.path = o.path.trim();
}
if( StringUtils.isNotEmpty(o.path)) {
columnNames.add( o.path );
}
}
return columnNames;
}
}
...@@ -3,38 +3,44 @@ package com.x.cms.core.entity; ...@@ -3,38 +3,44 @@ package com.x.cms.core.entity;
import com.x.base.core.entity.AbstractPersistenceProperties; import com.x.base.core.entity.AbstractPersistenceProperties;
public final class PersistenceProperties extends AbstractPersistenceProperties { public final class PersistenceProperties extends AbstractPersistenceProperties {
public static class Element { public static class Element {
public static class QueryView {
public static final String table = "CMS_E_QUERYVIEW";
}
public static class View { public static class View {
public static final String table = "CMS_VIEW"; public static final String table = "CMS_VIEW";
} }
public static class ViewFieldConfig { public static class ViewFieldConfig {
public static final String table = "CMS_VIEWFIELD_CONFIG"; public static final String table = "CMS_VIEWFIELD_CONFIG";
} }
public static class ViewCategory { public static class ViewCategory {
public static final String table = "CMS_VIEWCATEGORY"; public static final String table = "CMS_VIEWCATEGORY";
} }
public static class Form { public static class Form {
public static final String table = "CMS_FORM"; public static final String table = "CMS_FORM";
} }
public static class File { public static class File {
public static final String table = "CMS_FILE"; public static final String table = "CMS_FILE";
} }
public static class FormField { public static class FormField {
public static final String table = "CMS_FORMFIELD"; public static final String table = "CMS_FORMFIELD";
} }
public static class TemplateForm { public static class TemplateForm {
public static final String table = "CMS_TEMPLATEFORM"; public static final String table = "CMS_TEMPLATEFORM";
} }
public static class AppDict { public static class AppDict {
public static final String table = "CMS_APPNDICT"; public static final String table = "CMS_APPNDICT";
} }
public static class AppDictItem { public static class AppDictItem {
public static final String table = "CMS_APPDICTITEM"; public static final String table = "CMS_APPDICTITEM";
} }
public static class Script { public static class Script {
public static final String table = "CMS_SCRIPT"; public static final String table = "CMS_SCRIPT";
} }
...@@ -51,51 +57,51 @@ public final class PersistenceProperties extends AbstractPersistenceProperties { ...@@ -51,51 +57,51 @@ public final class PersistenceProperties extends AbstractPersistenceProperties {
public static class CategoryInfo { public static class CategoryInfo {
public static final String table = "CMS_CATEGORYINFO"; public static final String table = "CMS_CATEGORYINFO";
} }
public static class CategoryExt { public static class CategoryExt {
public static final String table = "CMS_CATEGORYEXT"; public static final String table = "CMS_CATEGORYEXT";
} }
public static class Document { public static class Document {
public static final String table = "CMS_DOCUMENT"; public static final String table = "CMS_DOCUMENT";
} }
public static class FileInfo { public static class FileInfo {
public static final String table = "CMS_FILEINFO"; public static final String table = "CMS_FILEINFO";
} }
public static class Log { public static class Log {
public static final String table = "CMS_LOG"; public static final String table = "CMS_LOG";
} }
public static class DocumentViewRecord { public static class DocumentViewRecord {
public static final String table = "CMS_DOCUMENT_VIEWRECORD"; public static final String table = "CMS_DOCUMENT_VIEWRECORD";
} }
public static class Review { public static class Review {
public static final String table = "CMS_REVIEW"; public static final String table = "CMS_REVIEW";
} }
public static class ReadRemind { public static class ReadRemind {
public static final String table = "CMS_READREMIND"; public static final String table = "CMS_READREMIND";
} }
public static class DocumentCommentInfo { public static class DocumentCommentInfo {
public static final String table = "CMS_DOCUMENT_COMMENTINFO"; public static final String table = "CMS_DOCUMENT_COMMENTINFO";
} }
public static class DocumentCommentContent { public static class DocumentCommentContent {
public static final String table = "CMS_DOCUMENT_COMMENTCONTENT"; public static final String table = "CMS_DOCUMENT_COMMENTCONTENT";
} }
public static class DocumentCommend { public static class DocumentCommend {
public static final String table = "CMS_DOCUMENT_COMMEND"; public static final String table = "CMS_DOCUMENT_COMMEND";
} }
public static class DocumentCommentCommend { public static class DocumentCommentCommend {
public static final String table = "CMS_DOCUMENT_COMMENTCOMMEND"; public static final String table = "CMS_DOCUMENT_COMMENTCOMMEND";
} }
public static class CmsBatchOperation { public static class CmsBatchOperation {
public static final String table = "CMS_BATCH_OPERATION"; public static final String table = "CMS_BATCH_OPERATION";
} }
......
package com.x.cms.core.entity.element;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Lob;
import javax.persistence.OrderColumn;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.openjpa.persistence.PersistentCollection;
import org.apache.openjpa.persistence.jdbc.ContainerTable;
import org.apache.openjpa.persistence.jdbc.ElementColumn;
import org.apache.openjpa.persistence.jdbc.ElementIndex;
import org.apache.openjpa.persistence.jdbc.Index;
import com.x.base.core.entity.AbstractPersistenceProperties;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.entity.SliceJpaObject;
import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.entity.annotation.Flag;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.cms.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(name = "QueryView", description = "内容管理查询视图.")
@Entity
@ContainerEntity(dumpSize = 200, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Element.QueryView.table, uniqueConstraints = {
@UniqueConstraint(name = PersistenceProperties.Element.QueryView.table + JpaObject.IndexNameMiddle
+ JpaObject.DefaultUniqueConstraintSuffix, columnNames = { JpaObject.IDCOLUMN,
JpaObject.CREATETIMECOLUMN, JpaObject.UPDATETIMECOLUMN, JpaObject.SEQUENCECOLUMN }) })
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class QueryView extends SliceJpaObject {
private static final long serialVersionUID = -7520516033901189347L;
private static final String TABLE = PersistenceProperties.Element.QueryView.table;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@FieldDescribe("数据库主键,自动生成.")
@Id
@Column(length = length_id, name = ColumnNamePrefix + id_FIELDNAME)
private String id = createId();
/* 以上为 JpaObject 默认字段 */
public void onPersist() throws Exception {
}
/* 更新运行方法 */
// public static String[] FLA GS = new String[] { "name", "id" };
/* flag标志位 */
/* Entity 默认字段结束 */
public static final String name_FIELDNAME = "name";
@Flag
@FieldDescribe("名称.")
@Column(length = AbstractPersistenceProperties.processPlatform_name_length, name = ColumnNamePrefix
+ name_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + name_FIELDNAME)
@CheckPersist(allowEmpty = false)
private String name;
public static final String alias_FIELDNAME = "alias";
@FieldDescribe("别名.")
@Column(length = AbstractPersistenceProperties.processPlatform_name_length, name = ColumnNamePrefix
+ alias_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String alias;
public static final String description_FIELDNAME = "description";
@FieldDescribe("描述.")
@Column(length = JpaObject.length_255B, name = ColumnNamePrefix + description_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String description;
public static final String appId_FIELDNAME = "appId";
@FieldDescribe("所属应用.")
@Column(length = JpaObject.length_id, name = ColumnNamePrefix + appId_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + appId_FIELDNAME)
@CheckPersist(allowEmpty = false)
private String appId;
public static final String appName_FIELDNAME = "appName";
@FieldDescribe("所属应用.")
@Column(length = JpaObject.length_id, name = ColumnNamePrefix + appName_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + appName_FIELDNAME)
@CheckPersist(allowEmpty = false)
private String appName;
public static final String timingEnable_FIELDNAME = "timingEnable";
@FieldDescribe("是否是定时任务.")
@CheckPersist(allowEmpty = true)
@Column(name = ColumnNamePrefix + timingEnable_FIELDNAME)
private Boolean timingEnable;
public static final String timingTouch_FIELDNAME = "timingTouch";
@FieldDescribe("上次运行后触发器触发过的次数,用于判断是否要运行,如果需要运行那么重置为0,避免由于时间往后调导致的不运行.")
@CheckPersist(allowEmpty = true)
@Column(name = ColumnNamePrefix + timingTouch_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + timingTouch_FIELDNAME)
private Integer timingTouch;
public static final String timingInterval_FIELDNAME = "timingInterval";
@FieldDescribe("运行间隔,分钟.")
@CheckPersist(allowEmpty = true)
@Column(name = ColumnNamePrefix + timingInterval_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + timingInterval_FIELDNAME)
private Integer timingInterval;
public static final String icon_FIELDNAME = "icon";
@FieldDescribe("icon Base64编码后的文本.")
@Lob
@Basic(fetch = FetchType.EAGER)
@Column(length = JpaObject.length_1M, name = ColumnNamePrefix + icon_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String icon;
public static final String creatorPerson_FIELDNAME = "creatorPerson";
@FieldDescribe("应用的创建者。")
@CheckPersist(allowEmpty = false)
@Column(length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix
+ creatorPerson_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + creatorPerson_FIELDNAME)
private String creatorPerson;
public static final String lastUpdateTime_FIELDNAME = "lastUpdateTime";
@FieldDescribe("应用的最后修改时间。")
@Temporal(TemporalType.TIMESTAMP)
@CheckPersist(allowEmpty = false)
@Column(name = ColumnNamePrefix + lastUpdateTime_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + lastUpdateTime_FIELDNAME)
private Date lastUpdateTime;
public static final String lastUpdatePerson_FIELDNAME = "lastUpdatePerson";
@FieldDescribe("应用的最后修改者")
@CheckPersist(allowEmpty = false)
@Column(length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix
+ lastUpdatePerson_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + lastUpdatePerson_FIELDNAME)
private String lastUpdatePerson;
public static final String layout_FIELDNAME = "layout";
@FieldDescribe("显示布局.")
@Lob
@Basic(fetch = FetchType.EAGER)
@Column(length = JpaObject.length_10M, name = ColumnNamePrefix + layout_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String layout;
public static final String data_FIELDNAME = "data";
@FieldDescribe("方案文本.")
@Lob
@Basic(fetch = FetchType.EAGER)
@Column(length = JpaObject.length_10M, name = ColumnNamePrefix + data_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String data;
public static final String afterGridScriptText_FIELDNAME = "afterGridScriptText";
@FieldDescribe("gird生成后运行脚本.")
@Lob
@Basic(fetch = FetchType.EAGER)
@Column(length = JpaObject.length_1M, name = ColumnNamePrefix + afterGridScriptText_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String afterGridScriptText;
public static final String afterGroupGridScriptText_FIELDNAME = "afterGroupGridScriptText";
@FieldDescribe("gropuGird生成后运行脚本.")
@Lob
@Basic(fetch = FetchType.EAGER)
@Column(length = JpaObject.length_1M, name = ColumnNamePrefix + afterGroupGridScriptText_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String afterGroupGridScriptText;
public static final String afterCalculateGridScriptText_FIELDNAME = "afterCalculateGridScriptText";
@FieldDescribe("calculateGrid生成后运行脚本.")
@Lob
@Basic(fetch = FetchType.EAGER)
@Column(length = JpaObject.length_1M, name = ColumnNamePrefix + afterCalculateGridScriptText_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String afterCalculateGridScriptText;
public static final String display_FIELDNAME = "display";
@FieldDescribe("是否前端可见.")
@Column(name = ColumnNamePrefix + display_FIELDNAME)
private Boolean display;
public static final String code_FIELDNAME = "code";
@FieldDescribe("前台运行脚本.")
@Lob
@Basic(fetch = FetchType.EAGER)
@Column(length = JpaObject.length_1M, name = ColumnNamePrefix + code_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String code;
public static final String availablePersonList_FIELDNAME = "availablePersonList";
@FieldDescribe("可使用的人.")
@PersistentCollection(fetch = FetchType.EAGER)
@OrderColumn(name = ORDERCOLUMNCOLUMN)
@ContainerTable(name = TABLE + ContainerTableNameMiddle
+ availablePersonList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle
+ availablePersonList_FIELDNAME + JoinIndexNameSuffix))
@ElementColumn(length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix
+ availablePersonList_FIELDNAME)
@ElementIndex(name = TABLE + IndexNameMiddle + availablePersonList_FIELDNAME + ElementIndexNameSuffix)
@CheckPersist(allowEmpty = true)
private List<String> availablePersonList;
public static final String availableIdentityList_FIELDNAME = "availableIdentityList";
@FieldDescribe("可使用的身份.")
@PersistentCollection(fetch = FetchType.EAGER)
@OrderColumn(name = ORDERCOLUMNCOLUMN)
@ContainerTable(name = TABLE + ContainerTableNameMiddle
+ availableIdentityList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle
+ availableIdentityList_FIELDNAME + JoinIndexNameSuffix))
@ElementColumn(length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix
+ availableIdentityList_FIELDNAME)
@ElementIndex(name = TABLE + IndexNameMiddle + availableIdentityList_FIELDNAME + ElementIndexNameSuffix)
@CheckPersist(allowEmpty = true)
private List<String> availableIdentityList;
public static final String availableUnitList_FIELDNAME = "availableUnitList";
@FieldDescribe("允许访问的组织列表.")
@PersistentCollection(fetch = FetchType.EAGER)
@OrderColumn(name = ORDERCOLUMNCOLUMN)
@ContainerTable(name = TABLE + ContainerTableNameMiddle
+ availableUnitList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle
+ availableUnitList_FIELDNAME + JoinIndexNameSuffix))
@ElementColumn(length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix
+ availableUnitList_FIELDNAME)
@ElementIndex(name = TABLE + IndexNameMiddle + availableUnitList_FIELDNAME + ElementIndexNameSuffix)
@CheckPersist(allowEmpty = true)
private List<String> availableUnitList;
public static final String controllerList_FIELDNAME = "controllerList";
@FieldDescribe("栏目管理者。")
@PersistentCollection(fetch = FetchType.EAGER)
@OrderColumn(name = ORDERCOLUMNCOLUMN)
@ContainerTable(name = TABLE + ContainerTableNameMiddle
+ controllerList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle + controllerList_FIELDNAME
+ JoinIndexNameSuffix))
@ElementColumn(length = AbstractPersistenceProperties.organization_name_length, name = ColumnNamePrefix
+ controllerList_FIELDNAME)
@ElementIndex(name = TABLE + IndexNameMiddle + controllerList_FIELDNAME + ElementIndexNameSuffix)
@CheckPersist(allowEmpty = true)
private List<String> controllerList;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getAlias() {
return alias;
}
public void setAlias(String alias) {
this.alias = alias;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public List<String> getControllerList() {
return controllerList;
}
public void setControllerList(List<String> controllerList) {
this.controllerList = controllerList;
}
public String getCreatorPerson() {
return creatorPerson;
}
public void setCreatorPerson(String creatorPerson) {
this.creatorPerson = creatorPerson;
}
public Date getLastUpdateTime() {
return lastUpdateTime;
}
public void setLastUpdateTime(Date lastUpdateTime) {
this.lastUpdateTime = lastUpdateTime;
}
public String getLastUpdatePerson() {
return lastUpdatePerson;
}
public void setLastUpdatePerson(String lastUpdatePerson) {
this.lastUpdatePerson = lastUpdatePerson;
}
public String getLayout() {
return layout;
}
public void setLayout(String layout) {
this.layout = layout;
}
public String getAfterGridScriptText() {
return afterGridScriptText;
}
public void setAfterGridScriptText(String afterGridScriptText) {
this.afterGridScriptText = afterGridScriptText;
}
public String getAfterGroupGridScriptText() {
return afterGroupGridScriptText;
}
public void setAfterGroupGridScriptText(String afterGroupGridScriptText) {
this.afterGroupGridScriptText = afterGroupGridScriptText;
}
public String getAfterCalculateGridScriptText() {
return afterCalculateGridScriptText;
}
public void setAfterCalculateGridScriptText(String afterCalculateGridScriptText) {
this.afterCalculateGridScriptText = afterCalculateGridScriptText;
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public Boolean getTimingEnable() {
return timingEnable;
}
public void setTimingEnable(Boolean timingEnable) {
this.timingEnable = timingEnable;
}
public Integer getTimingTouch() {
return timingTouch;
}
public void setTimingTouch(Integer timingTouch) {
this.timingTouch = timingTouch;
}
public Integer getTimingInterval() {
return timingInterval;
}
public void setTimingInterval(Integer timingInterval) {
this.timingInterval = timingInterval;
}
public List<String> getAvailableIdentityList() {
return availableIdentityList;
}
public void setAvailableIdentityList(List<String> availableIdentityList) {
this.availableIdentityList = availableIdentityList;
}
public List<String> getAvailablePersonList() {
return availablePersonList;
}
public void setAvailablePersonList(List<String> availablePersonList) {
this.availablePersonList = availablePersonList;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public Boolean getDisplay() {
return display;
}
public void setDisplay(Boolean display) {
this.display = display;
}
public String getAppName() {
return appName;
}
public void setAppName(String appName) {
this.appName = appName;
}
public List<String> getAvailableUnitList() {
return availableUnitList;
}
public void setAvailableUnitList(List<String> availableUnitList) {
this.availableUnitList = availableUnitList;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}
...@@ -87,24 +87,6 @@ public class Business { ...@@ -87,24 +87,6 @@ public class Business {
return templateForm; return templateForm;
} }
private QueryViewFactory queryView;
public QueryViewFactory queryView() throws Exception {
if (null == this.queryView) {
this.queryView = new QueryViewFactory(this);
}
return queryView;
}
private QueryStatFactory queryStat;
public QueryStatFactory queryStat() throws Exception {
if (null == this.queryStat) {
this.queryStat = new QueryStatFactory(this);
}
return queryStat;
}
private ApplicationFactory application; private ApplicationFactory application;
public ApplicationFactory application() throws Exception { public ApplicationFactory application() throws Exception {
......
package com.x.processplatform.assemble.designer.element.factory;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import com.x.processplatform.assemble.designer.AbstractFactory;
import com.x.processplatform.assemble.designer.Business;
import com.x.processplatform.core.entity.element.QueryStat;
import com.x.processplatform.core.entity.element.QueryStat_;
public class QueryStatFactory extends AbstractFactory {
public QueryStatFactory(Business business) throws Exception {
super(business);
}
public List<String> listWithApplication(String application) throws Exception {
EntityManager em = this.entityManagerContainer().get(QueryStat.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<QueryStat> root = cq.from(QueryStat.class);
Predicate p = cb.equal(root.get(QueryStat_.application), application);
cq.select(root.get(QueryStat_.id)).where(p);
return em.createQuery(cq).getResultList();
}
public List<QueryStat> listWithApplicationObject(String application) throws Exception {
EntityManager em = this.entityManagerContainer().get(QueryStat.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<QueryStat> cq = cb.createQuery(QueryStat.class);
Root<QueryStat> root = cq.from(QueryStat.class);
Predicate p = cb.equal(root.get(QueryStat_.application), application);
cq.select(root).where(p);
return em.createQuery(cq).getResultList();
}
public <T extends QueryStat> List<T> sort(List<T> list) {
list = list.stream().sorted(Comparator.comparing(QueryStat::getName, Comparator.nullsLast(String::compareTo)))
.collect(Collectors.toList());
return list;
}
}
\ No newline at end of file
package com.x.processplatform.assemble.designer.element.factory;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import com.x.processplatform.assemble.designer.AbstractFactory;
import com.x.processplatform.assemble.designer.Business;
import com.x.processplatform.core.entity.element.QueryView;
import com.x.processplatform.core.entity.element.QueryView_;
public class QueryViewFactory extends AbstractFactory {
public QueryViewFactory(Business business) throws Exception {
super(business);
}
public List<String> listWithApplication(String application) throws Exception {
EntityManager em = this.entityManagerContainer().get(QueryView.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<QueryView> root = cq.from(QueryView.class);
Predicate p = cb.equal(root.get(QueryView_.application), application);
cq.select(root.get(QueryView_.id)).where(p);
return em.createQuery(cq).getResultList();
}
public List<QueryView> listWithApplicationObject(String application) throws Exception {
EntityManager em = this.entityManagerContainer().get(QueryView.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<QueryView> cq = cb.createQuery(QueryView.class);
Root<QueryView> root = cq.from(QueryView.class);
Predicate p = cb.equal(root.get(QueryView_.application), application);
cq.select(root).where(p);
return em.createQuery(cq).getResultList();
}
public <T extends QueryView> List<T> sort(List<T> list) {
list = list.stream().sorted(Comparator.comparing(QueryView::getName, Comparator.nullsLast(String::compareTo)))
.collect(Collectors.toList());
return list;
}
}
\ No newline at end of file
...@@ -5,8 +5,6 @@ import java.util.List; ...@@ -5,8 +5,6 @@ import java.util.List;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import com.x.processplatform.core.entity.element.*;
import com.x.processplatform.core.entity.element.Process;
import org.apache.commons.collections4.ListUtils; import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -34,6 +32,29 @@ import com.x.processplatform.core.entity.content.TaskCompleted; ...@@ -34,6 +32,29 @@ import com.x.processplatform.core.entity.content.TaskCompleted;
import com.x.processplatform.core.entity.content.Work; import com.x.processplatform.core.entity.content.Work;
import com.x.processplatform.core.entity.content.WorkCompleted; import com.x.processplatform.core.entity.content.WorkCompleted;
import com.x.processplatform.core.entity.content.WorkLog; import com.x.processplatform.core.entity.content.WorkLog;
import com.x.processplatform.core.entity.element.Agent;
import com.x.processplatform.core.entity.element.Application;
import com.x.processplatform.core.entity.element.ApplicationDict;
import com.x.processplatform.core.entity.element.ApplicationDictItem;
import com.x.processplatform.core.entity.element.Begin;
import com.x.processplatform.core.entity.element.Cancel;
import com.x.processplatform.core.entity.element.Choice;
import com.x.processplatform.core.entity.element.Delay;
import com.x.processplatform.core.entity.element.Embed;
import com.x.processplatform.core.entity.element.End;
import com.x.processplatform.core.entity.element.File;
import com.x.processplatform.core.entity.element.Form;
import com.x.processplatform.core.entity.element.FormField;
import com.x.processplatform.core.entity.element.Invoke;
import com.x.processplatform.core.entity.element.Manual;
import com.x.processplatform.core.entity.element.Merge;
import com.x.processplatform.core.entity.element.Parallel;
import com.x.processplatform.core.entity.element.Process;
import com.x.processplatform.core.entity.element.Publish;
import com.x.processplatform.core.entity.element.Route;
import com.x.processplatform.core.entity.element.Script;
import com.x.processplatform.core.entity.element.Service;
import com.x.processplatform.core.entity.element.Split;
import com.x.query.core.entity.Item; import com.x.query.core.entity.Item;
class ActionDelete extends BaseAction { class ActionDelete extends BaseAction {
...@@ -96,8 +117,6 @@ class ActionDelete extends BaseAction { ...@@ -96,8 +117,6 @@ class ActionDelete extends BaseAction {
emc.beginTransaction(Form.class); emc.beginTransaction(Form.class);
emc.beginTransaction(Script.class); emc.beginTransaction(Script.class);
emc.beginTransaction(SerialNumber.class); emc.beginTransaction(SerialNumber.class);
emc.beginTransaction(QueryView.class);
emc.beginTransaction(QueryStat.class);
emc.beginTransaction(File.class); emc.beginTransaction(File.class);
for (String str : business.process().listWithApplication(id, false)) { for (String str : business.process().listWithApplication(id, false)) {
/** 流程 1种 */ /** 流程 1种 */
...@@ -127,8 +146,6 @@ class ActionDelete extends BaseAction { ...@@ -127,8 +146,6 @@ class ActionDelete extends BaseAction {
this.deleteScript(business, application); this.deleteScript(business, application);
this.deleteFile(business, application); this.deleteFile(business, application);
this.deleteSerialNumber(business, application); this.deleteSerialNumber(business, application);
this.deleteQueryView(business, application);
this.deleteQueryStat(business, application);
/** 应用本体 1种 */ /** 应用本体 1种 */
emc.remove(application); emc.remove(application);
emc.commit(); emc.commit();
...@@ -154,8 +171,6 @@ class ActionDelete extends BaseAction { ...@@ -154,8 +171,6 @@ class ActionDelete extends BaseAction {
CacheManager.notify(File.class); CacheManager.notify(File.class);
CacheManager.notify(Script.class); CacheManager.notify(Script.class);
CacheManager.notify(SerialNumber.class); CacheManager.notify(SerialNumber.class);
CacheManager.notify(QueryView.class);
CacheManager.notify(QueryStat.class);
Wo wo = new Wo(); Wo wo = new Wo();
wo.setId(application.getId()); wo.setId(application.getId());
result.setData(wo); result.setData(wo);
...@@ -379,16 +394,6 @@ class ActionDelete extends BaseAction { ...@@ -379,16 +394,6 @@ class ActionDelete extends BaseAction {
this.deleteBatch(business.entityManagerContainer(), SerialNumber.class, ids); this.deleteBatch(business.entityManagerContainer(), SerialNumber.class, ids);
} }
private void deleteQueryView(Business business, Application application) throws Exception {
List<String> ids = business.queryView().listWithApplication(application.getId());
this.deleteBatch(business.entityManagerContainer(), QueryView.class, ids);
}
private void deleteQueryStat(Business business, Application application) throws Exception {
List<String> ids = business.queryStat().listWithApplication(application.getId());
this.deleteBatch(business.entityManagerContainer(), QueryStat.class, ids);
}
private void deleteTask(Business business, Application application) throws Exception { private void deleteTask(Business business, Application application) throws Exception {
List<String> ids = business.task().listWithApplication(application.getId()); List<String> ids = business.task().listWithApplication(application.getId());
this.deleteBatch(business.entityManagerContainer(), Task.class, ids); this.deleteBatch(business.entityManagerContainer(), Task.class, ids);
......
//package com.x.processplatform.assemble.surface.factory.element;
//
//import java.util.List;
//import java.util.Objects;
//
//import javax.persistence.EntityManager;
//import javax.persistence.criteria.CriteriaBuilder;
//import javax.persistence.criteria.CriteriaQuery;
//import javax.persistence.criteria.Predicate;
//import javax.persistence.criteria.Root;
//
//import org.apache.commons.lang3.StringUtils;
//
//import com.x.base.core.project.cache.ApplicationCache;
//import com.x.base.core.project.exception.ExceptionWhen;
//import com.x.base.core.project.http.EffectivePerson;
//import com.x.base.core.project.tools.ListTools;
//import com.x.processplatform.assemble.surface.Business;
//import com.x.processplatform.core.entity.element.Application;
//import com.x.processplatform.core.entity.element.QueryStat;
//import com.x.processplatform.core.entity.element.QueryStat_;
//
//import net.sf.ehcache.Ehcache;
//import net.sf.ehcache.Element;
//
//public class QueryStatFactory extends ElementFactory {
//
// public QueryStatFactory(Business abstractBusiness) throws Exception {
// super(abstractBusiness);
// }
//
// public QueryStat pick(String flag, Application application) throws Exception {
// return this.pick(flag, application, ExceptionWhen.none);
// }
//
// public QueryStat pick(String flag, Application application, ExceptionWhen exceptionWhen) throws Exception {
// Ehcache cache = ApplicationCache.instance().getCache(QueryStat.class);
// String cacheKey = flag + "#" + application.getId();
// Element element = cache.get(cacheKey);
// QueryStat o = null;
// if (null != element) {
// if (null != element.getObjectValue()) {
// o = (QueryStat) element.getObjectValue();
// }
// } else {
// EntityManager em = this.entityManagerContainer().get(QueryStat.class);
// CriteriaBuilder cb = em.getCriteriaBuilder();
// CriteriaQuery<QueryStat> cq = cb.createQuery(QueryStat.class);
// Root<QueryStat> root = cq.from(QueryStat.class);
// Predicate p = cb.equal(root.get(QueryStat_.application), application.getId());
// p = cb.and(p, cb.or(cb.equal(root.get(QueryStat_.id), flag), cb.equal(root.get(QueryStat_.alias), flag),
// cb.equal(root.get(QueryStat_.name), flag)));
// cq.select(root).where(p);
// List<QueryStat> list = em.createQuery(cq).getResultList();
// if (list.isEmpty()) {
// cache.put(new Element(cacheKey, o));
// } else if (list.size() == 1) {
// o = list.get(0);
// em.detach(o);
// cache.put(new Element(cacheKey, o));
// } else {
// throw new Exception("multiple queryStat with flag:" + flag + ".");
// }
// }
// if (o == null && Objects.equals(ExceptionWhen.not_found, exceptionWhen)) {
// throw new Exception("can not find queryStat with flag:" + flag + ".");
// }
// return o;
// }
//
// public Boolean allowRead(EffectivePerson effectivePerson, QueryStat queryStat, Application application)
// throws Exception {
// if (!StringUtils.equals(queryStat.getApplication(), application.getId())) {
// throw new Exception(
// "queryStat:{id:" + queryStat.getId() + "} not in application{id:" + application.getId() + "}");
// }
// /* 全部为空,没有设置范围 */
// if (ListTools.isEmpty(queryStat.getAvailableUnitList())
// && ListTools.isEmpty(queryStat.getAvailableIdentityList())
// && ListTools.isEmpty(queryStat.getAvailablePersonList())) {
// return true;
// }
// if (effectivePerson.isPerson(queryStat.getCreatorPerson())) {
// return true;
// }
// if (effectivePerson.isManager()) {
// return true;
// }
// if (effectivePerson.isPerson(application.getControllerList())) {
// return true;
// }
// if (effectivePerson.isPerson(queryStat.getControllerList())) {
// return true;
// }
// if (ListTools.isNotEmpty(queryStat.getAvailablePersonList())) {
// if (ListTools.contains(queryStat.getAvailableIdentityList(), effectivePerson.getDistinguishedName())) {
// return true;
// }
// }
// if (ListTools.isNotEmpty(queryStat.getAvailableIdentityList())) {
// List<String> list = this.business().organization().identity()
// .listWithPerson(effectivePerson.getDistinguishedName());
// if (ListTools.containsAny(list, queryStat.getAvailableIdentityList())) {
// return true;
// }
// }
// if (ListTools.isNotEmpty(queryStat.getAvailableUnitList())) {
// List<String> list = this.business().organization().unit().listWithPerson(effectivePerson);
// if (ListTools.containsAny(list, queryStat.getAvailableUnitList())) {
// return true;
// }
// }
// return false;
// }
//
//}
\ No newline at end of file
//package com.x.processplatform.assemble.surface.factory.element;
//
//import java.util.List;
//import java.util.Objects;
//
//import javax.persistence.EntityManager;
//import javax.persistence.criteria.CriteriaBuilder;
//import javax.persistence.criteria.CriteriaQuery;
//import javax.persistence.criteria.Predicate;
//import javax.persistence.criteria.Root;
//
//import org.apache.commons.lang3.StringUtils;
//
//import com.x.base.core.project.cache.ApplicationCache;
//import com.x.base.core.project.exception.ExceptionWhen;
//import com.x.base.core.project.http.EffectivePerson;
//import com.x.base.core.project.tools.ListTools;
//import com.x.processplatform.assemble.surface.Business;
//import com.x.processplatform.core.entity.element.Application;
//import com.x.processplatform.core.entity.element.QueryView;
//import com.x.processplatform.core.entity.element.QueryView_;
//
//import net.sf.ehcache.Ehcache;
//import net.sf.ehcache.Element;
//
//public class QueryViewFactory extends ElementFactory {
//
// public QueryViewFactory(Business abstractBusiness) throws Exception {
// super(abstractBusiness);
// }
//
// public QueryView pick(String flag, Application application) throws Exception {
// return this.pick(flag, application, ExceptionWhen.none);
// }
//
// public QueryView pick(String flag, Application application, ExceptionWhen exceptionWhen) throws Exception {
// Ehcache cache = ApplicationCache.instance().getCache(QueryView.class);
// String cacheKey = flag + "#" + application.getId();
// Element element = cache.get(cacheKey);
// QueryView o = null;
// if (null != element) {
// if (null != element.getObjectValue()) {
// o = (QueryView) element.getObjectValue();
// }
// } else {
// EntityManager em = this.entityManagerContainer().get(QueryView.class);
// CriteriaBuilder cb = em.getCriteriaBuilder();
// CriteriaQuery<QueryView> cq = cb.createQuery(QueryView.class);
// Root<QueryView> root = cq.from(QueryView.class);
// Predicate p = cb.equal(root.get(QueryView_.application), application.getId());
// p = cb.and(p, cb.or(cb.equal(root.get(QueryView_.id), flag), cb.equal(root.get(QueryView_.alias), flag),
// cb.equal(root.get(QueryView_.name), flag)));
// cq.select(root).where(p);
// List<QueryView> list = em.createQuery(cq).getResultList();
// if (list.isEmpty()) {
// cache.put(new Element(cacheKey, o));
// } else if (list.size() == 1) {
// o = list.get(0);
// em.detach(o);
// cache.put(new Element(cacheKey, o));
// } else {
// throw new Exception("multiple queryView with flag:" + flag + ".");
// }
// }
// if (o == null && Objects.equals(ExceptionWhen.not_found, exceptionWhen)) {
// throw new Exception("can not find queryView with flag:" + flag + ".");
// }
// return o;
// }
//
// public Boolean allowRead(EffectivePerson effectivePerson, QueryView queryView, Application application)
// throws Exception {
// if (!StringUtils.equals(queryView.getApplication(), application.getId())) {
// throw new Exception(
// "queryView:{id:" + queryView.getId() + "} not in application{id:" + application.getId() + "}");
// }
// /* 全部为空,没有设置范围 */
// if (ListTools.isEmpty(queryView.getAvailableUnitList())
// && ListTools.isEmpty(queryView.getAvailableIdentityList())
// && ListTools.isEmpty(queryView.getAvailablePersonList())) {
// return true;
// }
// if (effectivePerson.isPerson(queryView.getCreatorPerson())) {
// return true;
// }
// if (effectivePerson.isManager()) {
// return true;
// }
// if (effectivePerson.isPerson(application.getControllerList())) {
// return true;
// }
// if (effectivePerson.isPerson(queryView.getControllerList())) {
// return true;
// }
// if (ListTools.isNotEmpty(queryView.getAvailablePersonList())) {
// if (ListTools.contains(queryView.getAvailableIdentityList(), effectivePerson.getDistinguishedName())) {
// return true;
// }
// }
// if (ListTools.isNotEmpty(queryView.getAvailableIdentityList())) {
// List<String> list = this.business().organization().identity()
// .listWithPerson(effectivePerson.getDistinguishedName());
// if (ListTools.containsAny(list, queryView.getAvailableIdentityList())) {
// return true;
// }
// }
// if (ListTools.isNotEmpty(queryView.getAvailableUnitList())) {
// List<String> list = this.business().organization().unit()
// .listWithPerson(effectivePerson.getDistinguishedName());
// if (ListTools.containsAny(list, queryView.getAvailableUnitList())) {
// return true;
// }
// }
// return false;
// }
//
//}
\ No newline at end of file
package com.x.processplatform.assemble.surface.jaxrs;
import javax.servlet.annotation.WebFilter;
import com.x.base.core.project.jaxrs.CipherManagerUserJaxrsFilter;
@WebFilter(urlPatterns = "/jaxrs/querystat/*", asyncSupported = true)
public class QueryStatJaxrsFilter extends CipherManagerUserJaxrsFilter {
}
package com.x.processplatform.assemble.surface.jaxrs;
import javax.servlet.annotation.WebFilter;
import com.x.base.core.project.jaxrs.CipherManagerUserJaxrsFilter;
@WebFilter(urlPatterns = "/jaxrs/queryview/*", asyncSupported = true)
public class QueryViewJaxrsFilter extends CipherManagerUserJaxrsFilter {
}
...@@ -10,8 +10,6 @@ import javax.persistence.criteria.CriteriaQuery; ...@@ -10,8 +10,6 @@ import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root; import javax.persistence.criteria.Root;
import com.x.processplatform.core.entity.element.Application;
import com.x.processplatform.core.entity.element.Process;
import org.apache.commons.collections4.ListUtils; import org.apache.commons.collections4.ListUtils;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.BooleanUtils;
...@@ -20,8 +18,6 @@ import org.apache.commons.lang3.StringUtils; ...@@ -20,8 +18,6 @@ import org.apache.commons.lang3.StringUtils;
import com.x.base.core.container.EntityManagerContainer; import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory; import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.project.config.Config; import com.x.base.core.project.config.Config;
import com.x.base.core.project.config.ProcessPlatform;
import com.x.base.core.project.exception.ExceptionEntityNotExist;
import com.x.base.core.project.gson.GsonPropertyObject; import com.x.base.core.project.gson.GsonPropertyObject;
import com.x.base.core.project.http.EffectivePerson; import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.StandardJaxrsAction; import com.x.base.core.project.jaxrs.StandardJaxrsAction;
...@@ -309,28 +305,27 @@ abstract class BaseAction extends StandardJaxrsAction { ...@@ -309,28 +305,27 @@ abstract class BaseAction extends StandardJaxrsAction {
* @throws Exception * @throws Exception
*/ */
protected void verifyConstraint(long size, String fileName, String callback) throws Exception { protected void verifyConstraint(long size, String fileName, String callback) throws Exception {
ProcessPlatform.AttachmentConfig attConfig = Config.processPlatform().getAttachmentConfig(); if (Config.general().getAttachmentConfig().getFileSize() != null && Config.general().getAttachmentConfig().getFileSize() > 0) {
if (attConfig.getFileSize() != null && attConfig.getFileSize() > 0) {
size = size / (1024 * 1024); size = size / (1024 * 1024);
if (size > attConfig.getFileSize()) { if (size > Config.general().getAttachmentConfig().getFileSize()) {
if (StringUtils.isNotEmpty(callback)) { if (StringUtils.isNotEmpty(callback)) {
throw new ExceptionAttachmentInvalidCallback(callback, fileName, attConfig.getFileSize()); throw new ExceptionAttachmentInvalidCallback(callback, fileName, Config.general().getAttachmentConfig().getFileSize());
} else { } else {
throw new ExceptionAttachmentInvalid(fileName, attConfig.getFileSize()); throw new ExceptionAttachmentInvalid(fileName, Config.general().getAttachmentConfig().getFileSize());
} }
} }
} }
String fileType = FilenameUtils.getExtension(fileName).toLowerCase(); String fileType = FilenameUtils.getExtension(fileName).toLowerCase();
if ((attConfig.getFileTypeIncludes() != null && !attConfig.getFileTypeIncludes().isEmpty()) if ((Config.general().getAttachmentConfig().getFileTypeIncludes() != null && !Config.general().getAttachmentConfig().getFileTypeIncludes().isEmpty())
&& (!ListTools.contains(attConfig.getFileTypeIncludes(), fileType))) { && (!ListTools.contains(Config.general().getAttachmentConfig().getFileTypeIncludes(), fileType))) {
if (StringUtils.isNotEmpty(callback)) { if (StringUtils.isNotEmpty(callback)) {
throw new ExceptionAttachmentInvalidCallback(callback, fileName); throw new ExceptionAttachmentInvalidCallback(callback, fileName);
} else { } else {
throw new ExceptionAttachmentInvalid(fileName); throw new ExceptionAttachmentInvalid(fileName);
} }
} }
if ((attConfig.getFileTypeExcludes() != null && !attConfig.getFileTypeExcludes().isEmpty()) if ((Config.general().getAttachmentConfig().getFileTypeExcludes() != null && !Config.general().getAttachmentConfig().getFileTypeExcludes().isEmpty())
&& (ListTools.contains(attConfig.getFileTypeExcludes(), fileType))) { && (ListTools.contains(Config.general().getAttachmentConfig().getFileTypeExcludes(), fileType))) {
if (StringUtils.isNotEmpty(callback)) { if (StringUtils.isNotEmpty(callback)) {
throw new ExceptionAttachmentInvalidCallback(callback, fileName); throw new ExceptionAttachmentInvalidCallback(callback, fileName);
} else { } else {
......
...@@ -208,14 +208,6 @@ public final class PersistenceProperties extends AbstractPersistenceProperties { ...@@ -208,14 +208,6 @@ public final class PersistenceProperties extends AbstractPersistenceProperties {
public static final String table = "PP_E_APPLICATIONDICTLOBITEM"; public static final String table = "PP_E_APPLICATIONDICTLOBITEM";
} }
public static class QueryView {
public static final String table = "PP_E_QUERYVIEW";
}
public static class QueryStat {
public static final String table = "PP_E_QUERYSTAT";
}
public static class QueryStatTimed { public static class QueryStatTimed {
public static final String table = "PP_E_QUERYSTATTIMED"; public static final String table = "PP_E_QUERYSTATTIMED";
} }
...@@ -256,10 +248,6 @@ public final class PersistenceProperties extends AbstractPersistenceProperties { ...@@ -256,10 +248,6 @@ public final class PersistenceProperties extends AbstractPersistenceProperties {
} }
public static class Temporary { public static class Temporary {
public static class TriggerWorkRecord {
public static final String table = "PP_T_TRIGGERWORKRECORD";
}
public static class ServiceValue { public static class ServiceValue {
public static final String table = "PP_T_SERVICEVALUE"; public static final String table = "PP_T_SERVICEVALUE";
} }
......
package com.x.processplatform.core.entity.element;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Lob;
import javax.persistence.OrderColumn;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.apache.openjpa.persistence.PersistentCollection;
import org.apache.openjpa.persistence.jdbc.ContainerTable;
import org.apache.openjpa.persistence.jdbc.ElementColumn;
import org.apache.openjpa.persistence.jdbc.ElementIndex;
import org.apache.openjpa.persistence.jdbc.Index;
import com.x.base.core.entity.AbstractPersistenceProperties;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.entity.SliceJpaObject;
import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.CitationExist;
import com.x.base.core.entity.annotation.CitationNotExist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.entity.annotation.Equal;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.processplatform.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Deprecated(forRemoval = true)
@Schema(name = "QueryStat", description = "流程平台查询统计.")
@Entity
@ContainerEntity(dumpSize = 5, type = ContainerEntity.Type.element, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Element.QueryStat.table, uniqueConstraints = {
@UniqueConstraint(name = PersistenceProperties.Element.QueryStat.table + JpaObject.IndexNameMiddle
+ JpaObject.DefaultUniqueConstraintSuffix, columnNames = { JpaObject.IDCOLUMN,
JpaObject.CREATETIMECOLUMN, JpaObject.UPDATETIMECOLUMN, JpaObject.SEQUENCECOLUMN }) })
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class QueryStat extends SliceJpaObject {
private static final long serialVersionUID = -1926258273469924948L;
private static final String TABLE = PersistenceProperties.Element.QueryStat.table;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@FieldDescribe("数据库主键,自动生成.")
@Id
@Column(length = length_id, name = ColumnNamePrefix + id_FIELDNAME)
private String id = createId();
/* 以上为 JpaObject 默认字段 */
public void onPersist() throws Exception {
// nothing
}
/* 更新运行方法 */
// public static String[] FLA GS = new String[] { "id" };
/* flag标志位 */
/* Entity 默认字段结束 */
public static final String name_FIELDNAME = "name";
@FieldDescribe("名称.")
@Column(length = AbstractPersistenceProperties.processPlatform_name_length, name = ColumnNamePrefix
+ name_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + name_FIELDNAME)
@CheckPersist(allowEmpty = false, simplyString = false, citationNotExists =
/* 验证不可重名 */
@CitationNotExist(fields = { "name", "id",
"alias" }, type = QueryStat.class, equals = @Equal(field = "application", property = "application")))
private String name;
public static final String alias_FIELDNAME = "alias";
@FieldDescribe("别名.")
@Column(length = length_255B, name = ColumnNamePrefix + alias_FIELDNAME)
@CheckPersist(allowEmpty = true, simplyString = false, citationNotExists =
/* 验证不可重名 */
@CitationNotExist(fields = { "name", "id",
"alias" }, type = QueryStat.class, equals = @Equal(field = "application", property = "application")))
private String alias;
public static final String description_FIELDNAME = "description";
@FieldDescribe("描述.")
@Column(length = JpaObject.length_255B, name = ColumnNamePrefix + description_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String description;
public static final String application_FIELDNAME = "application";
@FieldDescribe("所属应用.")
@Column(length = JpaObject.length_id, name = ColumnNamePrefix + application_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + application_FIELDNAME)
@CheckPersist(allowEmpty = false, citationExists = { @CitationExist(type = Application.class) })
private String application;
public static final String queryView_FIELDNAME = "queryView";
@FieldDescribe("所关联的queryView.")
@Column(length = JpaObject.length_id, name = ColumnNamePrefix + queryView_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + queryView_FIELDNAME)
@CheckPersist(allowEmpty = false, citationExists = { @CitationExist(type = QueryView.class) })
private String queryView;
public static final String queryViewName_FIELDNAME = "queryViewName";
@FieldDescribe("所关联的queryView的name.")
@Column(length = JpaObject.length_255B, name = ColumnNamePrefix + queryViewName_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + queryViewName_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String queryViewName;
public static final String queryViewAlias_FIELDNAME = "queryViewAlias";
@FieldDescribe("所关联的queryView的alias.")
@Column(length = JpaObject.length_255B, name = ColumnNamePrefix + queryViewAlias_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + queryViewAlias_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String queryViewAlias;
public static final String timingEnable_FIELDNAME = "timingEnable";
@FieldDescribe("是否是定时任务.")
@CheckPersist(allowEmpty = true)
@Column(name = ColumnNamePrefix + timingEnable_FIELDNAME)
private Boolean timingEnable;
public static final String timingInterval_FIELDNAME = "timingInterval";
@FieldDescribe("运行间隔,分钟.")
@CheckPersist(allowEmpty = true)
@Column(name = ColumnNamePrefix + timingInterval_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + timingInterval_FIELDNAME)
private Integer timingInterval;
public static final String availablePersonList_FIELDNAME = "availablePersonList";
@FieldDescribe("可使用的人.")
@PersistentCollection(fetch = FetchType.EAGER)
@ContainerTable(name = TABLE + ContainerTableNameMiddle
+ availablePersonList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle
+ availablePersonList_FIELDNAME + JoinIndexNameSuffix))
@OrderColumn(name = ORDERCOLUMNCOLUMN)
@ElementColumn(length = length_255B, name = ColumnNamePrefix + availablePersonList_FIELDNAME)
@ElementIndex(name = TABLE + IndexNameMiddle + availablePersonList_FIELDNAME + ElementIndexNameSuffix)
@CheckPersist(allowEmpty = true)
private List<String> availablePersonList;
public static final String availableIdentityList_FIELDNAME = "availableIdentityList";
@FieldDescribe("可使用的身份.")
@PersistentCollection(fetch = FetchType.EAGER)
@ContainerTable(name = TABLE + ContainerTableNameMiddle
+ availableIdentityList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle
+ availableIdentityList_FIELDNAME + JoinIndexNameSuffix))
@OrderColumn(name = ORDERCOLUMNCOLUMN)
@ElementColumn(length = length_255B, name = ColumnNamePrefix + availableIdentityList_FIELDNAME)
@ElementIndex(name = TABLE + IndexNameMiddle + availableIdentityList_FIELDNAME + ElementIndexNameSuffix)
@CheckPersist(allowEmpty = true)
private List<String> availableIdentityList;
public static final String availableUnitList_FIELDNAME = "availableUnitList";
@FieldDescribe("在指定启动时候,允许新建的组织.")
@PersistentCollection(fetch = FetchType.EAGER)
@ContainerTable(name = TABLE + ContainerTableNameMiddle
+ availableUnitList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle
+ availableUnitList_FIELDNAME + JoinIndexNameSuffix))
@OrderColumn(name = ORDERCOLUMNCOLUMN)
@ElementColumn(length = length_255B, name = ColumnNamePrefix + availableUnitList_FIELDNAME)
@ElementIndex(name = TABLE + IndexNameMiddle + availableUnitList_FIELDNAME + ElementIndexNameSuffix)
@CheckPersist(allowEmpty = true)
private List<String> availableUnitList;
public static final String icon_FIELDNAME = "icon";
@FieldDescribe("icon Base64编码后的文本.")
@Lob
@Basic(fetch = FetchType.EAGER)
@Column(length = JpaObject.length_128K, name = ColumnNamePrefix + icon_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String icon;
public static final String controllerList_FIELDNAME = "controllerList";
@FieldDescribe("应用管理者。")
@PersistentCollection(fetch = FetchType.EAGER)
@OrderColumn(name = ORDERCOLUMNCOLUMN)
@ContainerTable(name = TABLE + ContainerTableNameMiddle
+ controllerList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle + controllerList_FIELDNAME
+ JoinIndexNameSuffix))
@ElementColumn(length = length_255B, name = ColumnNamePrefix + controllerList_FIELDNAME)
@ElementIndex(name = TABLE + IndexNameMiddle + controllerList_FIELDNAME + ElementIndexNameSuffix)
@CheckPersist(allowEmpty = true)
private List<String> controllerList;
public static final String creatorPerson_FIELDNAME = "creatorPerson";
@FieldDescribe("应用的创建者。")
@CheckPersist(allowEmpty = false)
@Column(length = length_255B, name = ColumnNamePrefix + creatorPerson_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + creatorPerson_FIELDNAME)
private String creatorPerson;
public static final String lastUpdateTime_FIELDNAME = "lastUpdateTime";
@FieldDescribe("应用的最后修改时间。")
@CheckPersist(allowEmpty = false)
@Column(name = ColumnNamePrefix + lastUpdateTime_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + lastUpdateTime_FIELDNAME)
private Date lastUpdateTime;
public static final String lastUpdatePerson_FIELDNAME = "lastUpdatePerson";
@FieldDescribe("应用的最后修改者")
@CheckPersist(allowEmpty = false)
@Column(length = length_255B, name = ColumnNamePrefix + lastUpdatePerson_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + lastUpdatePerson_FIELDNAME)
private String lastUpdatePerson;
public static final String layout_FIELDNAME = "layout";
@FieldDescribe("显示布局.")
@Lob
@Basic(fetch = FetchType.EAGER)
@Column(length = JpaObject.length_10M, name = ColumnNamePrefix + layout_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String layout;
public static final String data_FIELDNAME = "data";
@FieldDescribe("方案文本.")
@Lob
@Basic(fetch = FetchType.EAGER)
@Column(length = JpaObject.length_10M, name = ColumnNamePrefix + data_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String data;
public static final String result_FIELDNAME = "result";
@FieldDescribe("缓存结果.")
@Lob
@Basic(fetch = FetchType.EAGER)
@Column(length = JpaObject.length_10M, name = ColumnNamePrefix + result_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String result;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAlias() {
return alias;
}
public void setAlias(String alias) {
this.alias = alias;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getApplication() {
return application;
}
public void setApplication(String application) {
this.application = application;
}
public String getQueryView() {
return queryView;
}
public void setQueryView(String queryView) {
this.queryView = queryView;
}
public String getQueryViewName() {
return queryViewName;
}
public void setQueryViewName(String queryViewName) {
this.queryViewName = queryViewName;
}
public String getQueryViewAlias() {
return queryViewAlias;
}
public void setQueryViewAlias(String queryViewAlias) {
this.queryViewAlias = queryViewAlias;
}
public Boolean getTimingEnable() {
return timingEnable;
}
public void setTimingEnable(Boolean timingEnable) {
this.timingEnable = timingEnable;
}
public Integer getTimingInterval() {
return timingInterval;
}
public void setTimingInterval(Integer timingInterval) {
this.timingInterval = timingInterval;
}
public List<String> getAvailablePersonList() {
return availablePersonList;
}
public void setAvailablePersonList(List<String> availablePersonList) {
this.availablePersonList = availablePersonList;
}
public List<String> getAvailableIdentityList() {
return availableIdentityList;
}
public void setAvailableIdentityList(List<String> availableIdentityList) {
this.availableIdentityList = availableIdentityList;
}
public List<String> getAvailableUnitList() {
return availableUnitList;
}
public void setAvailableUnitList(List<String> availableUnitList) {
this.availableUnitList = availableUnitList;
}
public String getIcon() {
return icon;
}
public void setIcon(String icon) {
this.icon = icon;
}
public List<String> getControllerList() {
return controllerList;
}
public void setControllerList(List<String> controllerList) {
this.controllerList = controllerList;
}
public String getCreatorPerson() {
return creatorPerson;
}
public void setCreatorPerson(String creatorPerson) {
this.creatorPerson = creatorPerson;
}
public Date getLastUpdateTime() {
return lastUpdateTime;
}
public void setLastUpdateTime(Date lastUpdateTime) {
this.lastUpdateTime = lastUpdateTime;
}
public String getLastUpdatePerson() {
return lastUpdatePerson;
}
public void setLastUpdatePerson(String lastUpdatePerson) {
this.lastUpdatePerson = lastUpdatePerson;
}
public String getLayout() {
return layout;
}
public void setLayout(String layout) {
this.layout = layout;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
// public Boolean getDataSaveGrid() {
// return dataSaveGrid;
// }
//
// public void setDataSaveGrid(Boolean dataSaveGrid) {
// this.dataSaveGrid = dataSaveGrid;
// }
//
// public Boolean getDataSaveGroupGrid() {
// return dataSaveGroupGrid;
// }
//
// public void setDataSaveGroupGrid(Boolean dataSaveGroupGrid) {
// this.dataSaveGroupGrid = dataSaveGroupGrid;
// }
//
// public Boolean getDataSaveCalculateGrid() {
// return dataSaveCalculateGrid;
// }
//
// public void setDataSaveCalculateGrid(Boolean dataSaveCalculateGrid) {
// this.dataSaveCalculateGrid = dataSaveCalculateGrid;
// }
//
// public Boolean getDataSaveColumnGrid() {
// return dataSaveColumnGrid;
// }
//
// public void setDataSaveColumnGrid(Boolean dataSaveColumnGrid) {
// this.dataSaveColumnGrid = dataSaveColumnGrid;
// }
}
\ No newline at end of file
package com.x.processplatform.core.entity.element;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.openjpa.persistence.jdbc.Index;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.entity.SliceJpaObject;
import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.processplatform.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema;
@Deprecated(forRemoval = true)
@Schema(name = "QueryStatTimed", description = "流程平台定时查询统计.")
@Entity
@ContainerEntity(dumpSize = 5, type = ContainerEntity.Type.element, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Element.QueryStatTimed.table, uniqueConstraints = {
@UniqueConstraint(name = PersistenceProperties.Element.QueryStatTimed.table + JpaObject.IndexNameMiddle
+ JpaObject.DefaultUniqueConstraintSuffix, columnNames = { JpaObject.IDCOLUMN,
JpaObject.CREATETIMECOLUMN, JpaObject.UPDATETIMECOLUMN, JpaObject.SEQUENCECOLUMN }) })
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class QueryStatTimed extends SliceJpaObject {
private static final long serialVersionUID = -1926258273469924948L;
private static final String TABLE = PersistenceProperties.Element.QueryStatTimed.table;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@FieldDescribe("数据库主键,自动生成.")
@Id
@Column(length = length_id, name = ColumnNamePrefix + id_FIELDNAME)
private String id = createId();
/* 以上为 JpaObject 默认字段 */
public void onPersist() throws Exception {
//nothing
}
/* 更新运行方法 */
/* flag标志位 */
/* Entity 默认字段结束 */
public static final String queryStat_FIELDNAME = "queryStat";
@FieldDescribe("运行统计的queryStat.")
@Column(length = JpaObject.length_id, name = ColumnNamePrefix + queryStat_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + queryStat_FIELDNAME)
@CheckPersist(allowEmpty = false)
private String queryStat;
public static final String project_FIELDNAME = "project";
@FieldDescribe("运行在应用服务上.")
@Column(length = JpaObject.length_id, name = ColumnNamePrefix + project_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + project_FIELDNAME)
@CheckPersist(allowEmpty = false)
private String project;
public static final String scheduleTime_FIELDNAME = "scheduleTime";
@FieldDescribe("预约的运行时间.")
@Temporal(TemporalType.TIMESTAMP)
@Column(length = JpaObject.length_255B, name = ColumnNamePrefix + scheduleTime_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + scheduleTime_FIELDNAME)
@CheckPersist(allowEmpty = false)
private Date scheduleTime;
public static final String expiredTime_FIELDNAME = "expiredTime";
@FieldDescribe("过期时间.")
@Temporal(TemporalType.TIMESTAMP)
@Column(length = JpaObject.length_255B, name = ColumnNamePrefix + expiredTime_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + expiredTime_FIELDNAME)
@CheckPersist(allowEmpty = false)
private Date expiredTime;
public static final String timingInterval_FIELDNAME = "timingInterval";
@FieldDescribe("运行间隔,分钟.")
@CheckPersist(allowEmpty = true)
@Column(name = ColumnNamePrefix + timingInterval_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + timingInterval_FIELDNAME)
private Integer timingInterval;
public Date getScheduleTime() {
return scheduleTime;
}
public void setScheduleTime(Date scheduleTime) {
this.scheduleTime = scheduleTime;
}
public Integer getTimingInterval() {
return timingInterval;
}
public void setTimingInterval(Integer timingInterval) {
this.timingInterval = timingInterval;
}
public String getQueryStat() {
return queryStat;
}
public void setQueryStat(String queryStat) {
this.queryStat = queryStat;
}
public String getProject() {
return project;
}
public void setProject(String project) {
this.project = project;
}
public Date getExpiredTime() {
return expiredTime;
}
public void setExpiredTime(Date expiredTime) {
this.expiredTime = expiredTime;
}
}
\ No newline at end of file
...@@ -19,7 +19,6 @@ import com.x.processplatform.core.entity.PersistenceProperties; ...@@ -19,7 +19,6 @@ import com.x.processplatform.core.entity.PersistenceProperties;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
@Deprecated(forRemoval = true)
@Schema(name = "Event", description = "流程平台流转事件.") @Schema(name = "Event", description = "流程平台流转事件.")
@Entity @Entity
@ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.log, reference = ContainerEntity.Reference.soft) @ContainerEntity(dumpSize = 1000, type = ContainerEntity.Type.log, reference = ContainerEntity.Reference.soft)
......
...@@ -59,7 +59,7 @@ public class Business { ...@@ -59,7 +59,7 @@ public class Business {
private EntityManagerContainer emc; private EntityManagerContainer emc;
public Business(EntityManagerContainer emc) throws Exception { public Business(EntityManagerContainer emc) {
this.emc = emc; this.emc = emc;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册