Просмотр исходного кода

Merge branch 'fix/设计搜索优化' into 'wrdp'

[平台]设计搜索内存优化,减少对象创建,减少数据输出

See merge request o2oa/o2oa!2672
胡起 5 лет назад
Родитель
Сommit
49447d8ec5
11 измененных файлов с 499 добавлено и 283 удалено
  1. 14 3
      o2server/x_base_core_project/src/main/java/com/x/base/core/project/jaxrs/WrapDesigner.java
  2. 4 2
      o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/designer/ActionSearch.java
  3. 6 3
      o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/jaxrs/designer/ActionSearch.java
  4. 165 251
      o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/jaxrs/designer/ActionSearch.java
  5. 44 0
      o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/jaxrs/process/ActionGetProcess.java
  6. 138 0
      o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/jaxrs/process/ActionGetProcessElementList.java
  7. 37 1
      o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/jaxrs/process/ProcessAction.java
  8. 2 0
      o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/designer/ActionSearch.java
  9. 7 4
      o2server/x_query_assemble_designer/src/main/java/com/x/query/assemble/designer/jaxrs/designer/ActionSearch.java
  10. 48 2
      o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/Business.java
  11. 34 17
      o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/design/ActionSearch.java

+ 14 - 3
o2server/x_base_core_project/src/main/java/com/x/base/core/project/jaxrs/WrapDesigner.java

@@ -86,7 +86,6 @@ public class WrapDesigner extends GsonPropertyObject {
 
 	public void setPatternList(Map<String, String> map) {
 		if(map!=null && !map.isEmpty()){
-			List<DesignerPattern> patternList = new ArrayList<>();
 			for (String key : map.keySet()){
 				DesignerPattern pattern = new DesignerPattern();
 				pattern.setProperty(key);
@@ -97,9 +96,10 @@ public class WrapDesigner extends GsonPropertyObject {
 					}
 				}
 				pattern.setPropertyValue(propertyValue);
-				patternList.add(pattern);
+				this.patternList.add(pattern);
 			}
-			this.patternList = patternList;
+			map.clear();
+			map = null;
 		}
 	}
 
@@ -118,6 +118,8 @@ public class WrapDesigner extends GsonPropertyObject {
 				pattern.setPropertyValue(propertyValue);
 				this.patternList.add(pattern);
 			}
+			map.clear();
+			map = null;
 		}
 	}
 
@@ -138,6 +140,14 @@ public class WrapDesigner extends GsonPropertyObject {
 				pattern.setPropertyValue(propertyValue);
 				this.patternList.add(pattern);
 			}
+			map.clear();
+			map = null;
+		}else{
+			DesignerPattern pattern = new DesignerPattern();
+			pattern.setElementType(elementType);
+			pattern.setElementId(elementId);
+			pattern.setElementName(elementName);
+			this.patternList.add(pattern);
 		}
 	}
 
@@ -190,6 +200,7 @@ public class WrapDesigner extends GsonPropertyObject {
 				}
 				this.lines = lines;
 				map.clear();
+				map = null;
 			}
 		}
 

+ 4 - 2
o2server/x_cms_assemble_control/src/main/java/com/x/cms/assemble/control/jaxrs/designer/ActionSearch.java

@@ -88,7 +88,7 @@ class ActionSearch extends BaseAction {
 							wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
 					if (!map.isEmpty()) {
 						Wo wo = new Wo();
-						AppInfo appInfo = emc.find( woScript.getAppId(), AppInfo.class );
+						AppInfo appInfo = emc.fetch(woScript.getAppId(), AppInfo.class, ListTools.toList(AppInfo.id_FIELDNAME, AppInfo.appName_FIELDNAME));
 						if(appInfo != null){
 							wo.setAppId(appInfo.getId());
 							wo.setAppName(appInfo.getAppName());
@@ -102,6 +102,7 @@ class ActionSearch extends BaseAction {
 					}
 				}
 				woScripts.clear();
+				woScripts = null;
 			}catch (Exception e){
 				logger.error(e);
 			}
@@ -126,7 +127,7 @@ class ActionSearch extends BaseAction {
 								wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
 						if (!map.isEmpty()) {
 							Wo wo = new Wo();
-							AppInfo appInfo = emc.find( woForm.getAppId(), AppInfo.class );
+							AppInfo appInfo = emc.fetch(woForm.getAppId(), AppInfo.class, ListTools.toList(AppInfo.id_FIELDNAME, AppInfo.appName_FIELDNAME));
 							if(appInfo != null){
 								wo.setAppId(appInfo.getId());
 								wo.setAppName(appInfo.getAppName());
@@ -140,6 +141,7 @@ class ActionSearch extends BaseAction {
 						}
 					}
 					woForms.clear();
+					woForms = null;
 				}
 
 			}catch (Exception e){

+ 6 - 3
o2server/x_portal_assemble_designer/src/main/java/com/x/portal/assemble/designer/jaxrs/designer/ActionSearch.java

@@ -91,7 +91,7 @@ class ActionSearch extends BaseAction {
 							wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
 					if (!map.isEmpty()) {
 						Wo wo = new Wo();
-						Portal portal = emc.find(woScript.getPortal(), Portal.class);
+						Portal portal = emc.fetch(woScript.getPortal(), Portal.class, ListTools.toList(Portal.id_FIELDNAME, Portal.name_FIELDNAME));
 						if(portal != null){
 							wo.setAppId(portal.getId());
 							wo.setAppName(portal.getName());
@@ -105,6 +105,7 @@ class ActionSearch extends BaseAction {
 					}
 				}
 				woScripts.clear();
+				woScripts = null;
 			}catch (Exception e){
 				logger.error(e);
 			}
@@ -129,7 +130,7 @@ class ActionSearch extends BaseAction {
 								wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
 						if (!map.isEmpty()) {
 							Wo wo = new Wo();
-							Portal portal = emc.find(wopage.getPortal(), Portal.class);
+							Portal portal = emc.fetch(wopage.getPortal(), Portal.class, ListTools.toList(Portal.id_FIELDNAME, Portal.name_FIELDNAME));
 							if(portal != null){
 								wo.setAppId(portal.getId());
 								wo.setAppName(portal.getName());
@@ -143,6 +144,7 @@ class ActionSearch extends BaseAction {
 						}
 					}
 					wos.clear();
+					wos = null;
 				}
 
 			}catch (Exception e){
@@ -169,7 +171,7 @@ class ActionSearch extends BaseAction {
 								wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
 						if (!map.isEmpty()) {
 							Wo wo = new Wo();
-							Portal portal = emc.find(woWidget.getPortal(), Portal.class);
+							Portal portal = emc.fetch(woWidget.getPortal(), Portal.class, ListTools.toList(Portal.id_FIELDNAME, Portal.name_FIELDNAME));
 							if(portal != null){
 								wo.setAppId(portal.getId());
 								wo.setAppName(portal.getName());
@@ -183,6 +185,7 @@ class ActionSearch extends BaseAction {
 						}
 					}
 					wos.clear();
+					wos = null;
 				}
 
 			}catch (Exception e){

+ 165 - 251
o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/jaxrs/designer/ActionSearch.java

@@ -25,6 +25,7 @@ import com.x.processplatform.core.entity.element.wrap.*;
 import org.apache.commons.lang3.StringUtils;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.*;
@@ -32,7 +33,7 @@ import java.util.concurrent.*;
 class ActionSearch extends BaseAction {
 
 	private static Logger logger = LoggerFactory.getLogger(ActionSearch.class);
-	private final static String DESIGN_PROCESS_ACTIVITY = "activity";
+	private final static String DESIGN_PROCESS_ROUTE = "route";
 
 	ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
 		if(!effectivePerson.isManager()){
@@ -91,7 +92,8 @@ class ActionSearch extends BaseAction {
 							wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
 					if (!map.isEmpty()) {
 						Wo wo = new Wo();
-						Application app = emc.find(woScript.getApplication(), Application.class);
+						Application app = emc.fetch(woScript.getApplication(), Application.class,
+								ListTools.toList(Application.id_FIELDNAME, Application.name_FIELDNAME));
 						if (app != null) {
 							wo.setAppId(app.getId());
 							wo.setAppName(app.getName());
@@ -105,6 +107,7 @@ class ActionSearch extends BaseAction {
 					}
 				}
 				woScripts.clear();
+				woScripts = null;
 			}catch (Exception e){
 				logger.error(e);
 			}
@@ -129,7 +132,8 @@ class ActionSearch extends BaseAction {
 								wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
 						if (!map.isEmpty()) {
 							Wo wo = new Wo();
-							Application app = emc.find(woForm.getApplication(), Application.class);
+							Application app = emc.fetch(woForm.getApplication(), Application.class,
+									ListTools.toList(Application.id_FIELDNAME, Application.name_FIELDNAME));
 							if (app != null) {
 								wo.setAppId(app.getId());
 								wo.setAppName(app.getName());
@@ -143,6 +147,7 @@ class ActionSearch extends BaseAction {
 						}
 					}
 					woForms.clear();
+					woForms = null;
 				}
 
 			}catch (Exception e){
@@ -184,6 +189,7 @@ class ActionSearch extends BaseAction {
 						}
 					}
 					processList.clear();
+					processList = null;
 				}catch (Exception e){
 					logger.error(e);
 				}
@@ -205,313 +211,221 @@ class ActionSearch extends BaseAction {
 
 	private Wo doProcessSearch(Business business, Process process, Wi wi) throws Exception {
 		Wo wo = null;
-		WrapProcess wrap = WrapProcess.outCopier.copy(process);
-		wrap.setAgentList(WrapAgent.outCopier.copy(business.entityManagerContainer().list(Agent.class,
-				business.agent().listWithProcess(process.getId()))));
-		wrap.setBegin(WrapBegin.outCopier.copy(
-				business.entityManagerContainer().find(business.begin().getWithProcess(process.getId()), Begin.class)));
-		wrap.setCancelList(WrapCancel.outCopier.copy(business.entityManagerContainer().list(Cancel.class,
-				business.cancel().listWithProcess(process.getId()))));
-		wrap.setChoiceList(WrapChoice.outCopier.copy(business.entityManagerContainer().list(Choice.class,
-				business.choice().listWithProcess(process.getId()))));
-		wrap.setDelayList(WrapDelay.outCopier.copy(business.entityManagerContainer().list(Delay.class,
-				business.delay().listWithProcess(process.getId()))));
-		wrap.setEmbedList(WrapEmbed.outCopier.copy(business.entityManagerContainer().list(Embed.class,
-				business.embed().listWithProcess(process.getId()))));
-		wrap.setEndList(WrapEnd.outCopier.copy(
-				business.entityManagerContainer().list(End.class, business.end().listWithProcess(process.getId()))));
-		wrap.setInvokeList(WrapInvoke.outCopier.copy(business.entityManagerContainer().list(Invoke.class,
-				business.invoke().listWithProcess(process.getId()))));
-		wrap.setManualList(WrapManual.outCopier.copy(business.entityManagerContainer().list(Manual.class,
-				business.manual().listWithProcess(process.getId()))));
-		wrap.setMergeList(WrapMerge.outCopier.copy(business.entityManagerContainer().list(Merge.class,
-				business.merge().listWithProcess(process.getId()))));
-		wrap.setMessageList(WrapMessage.outCopier.copy(business.entityManagerContainer().list(Message.class,
-				business.message().listWithProcess(process.getId()))));
-		wrap.setParallelList(WrapParallel.outCopier.copy(business.entityManagerContainer().list(Parallel.class,
-				business.parallel().listWithProcess(process.getId()))));
-		wrap.setServiceList(WrapService.outCopier.copy(business.entityManagerContainer().list(Service.class,
-				business.service().listWithProcess(process.getId()))));
-		wrap.setSplitList(WrapSplit.outCopier.copy(business.entityManagerContainer().list(Split.class,
-				business.split().listWithProcess(process.getId()))));
-		wrap.setRouteList(WrapRoute.outCopier.copy(business.entityManagerContainer().list(Route.class,
-				business.route().listWithProcess(process.getId()))));
-
-		if(!StringTools.matchKeyword(wi.getKeyword(), XGsonBuilder.toJson(wrap), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())) {
-			wrap.getManualList().clear();
-			return null;
-		}
-
-		Map<String, String> pmap = PropertyTools.fieldMatchKeyword(WrapProcess.outCopier.getCopyFields(), process, wi.getKeyword(),
-				wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
-		if (!pmap.isEmpty()) {
-			if(wo == null){
-				wo = this.getProcessWo(business, process);
-			}
-			wo.addPatternList(DesignerType.process.toString(), pmap);
-		}
-
-		if(!wrap.getAgentList().isEmpty() && StringTools.matchKeyword(wi.getKeyword(),
-				XGsonBuilder.toJson(wrap.getAgentList()), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())){
-			if(wo == null){
-				wo = this.getProcessWo(business, process);
-			}
-			for (WrapAgent active : wrap.getAgentList()){
-				Map<String, String> map = PropertyTools.fieldMatchKeyword(WrapAgent.outCopier.getCopyFields(), active, wi.getKeyword(),
-						wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
-				if (!map.isEmpty()) {
-					if(wo == null){
-						wo = this.getProcessWo(business, process);
-					}
-					wo.addPatternList(DESIGN_PROCESS_ACTIVITY, active.getId(), active.getName(), map);
-				}
-			}
-		}
 
-		if(wrap.getBegin() != null && StringTools.matchKeyword(wi.getKeyword(),
-				XGsonBuilder.toJson(wrap.getBegin()), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())){
-			if(wo == null){
-				wo = this.getProcessWo(business, process);
-			}
-			WrapBegin active = wrap.getBegin();
-			Map<String, String> map = PropertyTools.fieldMatchKeyword(WrapBegin.outCopier.getCopyFields(), active, wi.getKeyword(),
+		if(StringTools.matchKeyword(wi.getKeyword(), XGsonBuilder.toJson(process), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())) {
+			Map<String, String> map = PropertyTools.fieldMatchKeyword(WrapProcess.outCopier.getCopyFields(), process, wi.getKeyword(),
 					wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
 			if (!map.isEmpty()) {
 				if(wo == null){
 					wo = this.getProcessWo(business, process);
 				}
-				wo.addPatternList(DESIGN_PROCESS_ACTIVITY, active.getId(), active.getName(), map);
+				wo.addPatternList(DesignerType.process.toString(), map);
 			}
 		}
 
-		if(!wrap.getCancelList().isEmpty() && StringTools.matchKeyword(wi.getKeyword(),
-				XGsonBuilder.toJson(wrap.getCancelList()), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())){
-			if(wo == null){
-				wo = this.getProcessWo(business, process);
-			}
-			for (WrapCancel active : wrap.getCancelList()){
-				Map<String, String> map = PropertyTools.fieldMatchKeyword(WrapCancel.outCopier.getCopyFields(), active, wi.getKeyword(),
-						wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
-				if (!map.isEmpty()) {
-					if(wo == null){
-						wo = this.getProcessWo(business, process);
-					}
-					wo.addPatternList(DESIGN_PROCESS_ACTIVITY, active.getId(), active.getName(), map);
+		List<Agent> agentList = business.entityManagerContainer().list(Agent.class,
+				business.agent().listWithProcess(process.getId()));
+		for (Agent active : agentList){
+			if(StringTools.matchKeyword(wi.getKeyword(),
+					XGsonBuilder.toJson(active), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())) {
+				if (wo == null) {
+					wo = this.getProcessWo(business, process);
 				}
+				wo.addPatternList(ActivityType.agent.toString(), active.getId(), active.getName(), null);
 			}
 		}
+		agentList.clear();
+		agentList = null;
 
-		if(!wrap.getChoiceList().isEmpty() && StringTools.matchKeyword(wi.getKeyword(),
-				XGsonBuilder.toJson(wrap.getChoiceList()), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())){
+		Begin begin = business.entityManagerContainer().find(business.begin().getWithProcess(process.getId()), Begin.class);
+		if(begin != null && StringTools.matchKeyword(wi.getKeyword(),
+				XGsonBuilder.toJson(begin), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())){
 			if(wo == null){
 				wo = this.getProcessWo(business, process);
 			}
-			for (WrapChoice active : wrap.getChoiceList()){
-				Map<String, String> map = PropertyTools.fieldMatchKeyword(WrapChoice.outCopier.getCopyFields(), active, wi.getKeyword(),
-						wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
-				if (!map.isEmpty()) {
-					if(wo == null){
-						wo = this.getProcessWo(business, process);
-					}
-					wo.addPatternList(DESIGN_PROCESS_ACTIVITY, active.getId(), active.getName(), map);
-				}
-			}
+			wo.addPatternList(ActivityType.begin.toString(), begin.getId(), begin.getName(), null);
 		}
 
-		if(!wrap.getDelayList().isEmpty() && StringTools.matchKeyword(wi.getKeyword(),
-				XGsonBuilder.toJson(wrap.getDelayList()), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())){
-			if(wo == null){
-				wo = this.getProcessWo(business, process);
-			}
-			for (WrapDelay active : wrap.getDelayList()){
-				Map<String, String> map = PropertyTools.fieldMatchKeyword(WrapDelay.outCopier.getCopyFields(), active, wi.getKeyword(),
-						wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
-				if (!map.isEmpty()) {
-					if(wo == null){
-						wo = this.getProcessWo(business, process);
-					}
-					wo.addPatternList(DESIGN_PROCESS_ACTIVITY, active.getId(), active.getName(), map);
+		List<Cancel> cancelList =  business.entityManagerContainer().list(Cancel.class,
+				business.cancel().listWithProcess(process.getId()));
+		for (Cancel active : cancelList){
+			if(StringTools.matchKeyword(wi.getKeyword(),
+					XGsonBuilder.toJson(active), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())) {
+				if (wo == null) {
+					wo = this.getProcessWo(business, process);
 				}
+				wo.addPatternList(ActivityType.cancel.toString(), active.getId(), active.getName(), null);
 			}
 		}
-
-		if(!wrap.getEmbedList().isEmpty() && StringTools.matchKeyword(wi.getKeyword(),
-				XGsonBuilder.toJson(wrap.getEmbedList()), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())){
-			if(wo == null){
-				wo = this.getProcessWo(business, process);
-			}
-			for (WrapEmbed active : wrap.getEmbedList()){
-				Map<String, String> map = PropertyTools.fieldMatchKeyword(WrapEmbed.outCopier.getCopyFields(), active, wi.getKeyword(),
-						wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
-				if (!map.isEmpty()) {
-					if(wo == null){
-						wo = this.getProcessWo(business, process);
-					}
-					wo.addPatternList(DESIGN_PROCESS_ACTIVITY, active.getId(), active.getName(), map);
+		cancelList.clear();
+		cancelList = null;
+
+		List<Choice> choiceList =  business.entityManagerContainer().list(Choice.class,
+				business.choice().listWithProcess(process.getId()));
+		for (Choice active : choiceList){
+			if(StringTools.matchKeyword(wi.getKeyword(),
+					XGsonBuilder.toJson(active), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())) {
+				if (wo == null) {
+					wo = this.getProcessWo(business, process);
 				}
+				wo.addPatternList(ActivityType.choice.toString(), active.getId(), active.getName(), null);
 			}
 		}
-
-		if(!wrap.getEndList().isEmpty() && StringTools.matchKeyword(wi.getKeyword(),
-				XGsonBuilder.toJson(wrap.getEndList()), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())){
-			if(wo == null){
-				wo = this.getProcessWo(business, process);
-			}
-			for (WrapEnd active : wrap.getEndList()){
-				Map<String, String> map = PropertyTools.fieldMatchKeyword(WrapEnd.outCopier.getCopyFields(), active, wi.getKeyword(),
-						wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
-				if (!map.isEmpty()) {
-					if(wo == null){
-						wo = this.getProcessWo(business, process);
-					}
-					wo.addPatternList(DESIGN_PROCESS_ACTIVITY, active.getId(), active.getName(), map);
+		choiceList.clear();
+		choiceList = null;
+
+		List<Delay> delayList =  business.entityManagerContainer().list(Delay.class,
+				business.delay().listWithProcess(process.getId()));
+		for (Delay active : delayList){
+			if(StringTools.matchKeyword(wi.getKeyword(),
+					XGsonBuilder.toJson(active), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())) {
+				if (wo == null) {
+					wo = this.getProcessWo(business, process);
 				}
+				wo.addPatternList(ActivityType.delay.toString(), active.getId(), active.getName(), null);
 			}
 		}
-
-		if(!wrap.getInvokeList().isEmpty() && StringTools.matchKeyword(wi.getKeyword(),
-				XGsonBuilder.toJson(wrap.getInvokeList()), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())){
-			if(wo == null){
-				wo = this.getProcessWo(business, process);
-			}
-			for (WrapInvoke active : wrap.getInvokeList()){
-				Map<String, String> map = PropertyTools.fieldMatchKeyword(WrapInvoke.outCopier.getCopyFields(), active, wi.getKeyword(),
-						wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
-				if (!map.isEmpty()) {
-					if(wo == null){
-						wo = this.getProcessWo(business, process);
-					}
-					wo.addPatternList(DESIGN_PROCESS_ACTIVITY, active.getId(), active.getName(), map);
+		delayList.clear();
+		delayList = null;
+
+		List<Embed> embedList = business.entityManagerContainer().list(Embed.class,
+				business.embed().listWithProcess(process.getId()));
+		for (Embed active : embedList){
+			if(StringTools.matchKeyword(wi.getKeyword(),
+					XGsonBuilder.toJson(active), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())) {
+				if (wo == null) {
+					wo = this.getProcessWo(business, process);
 				}
+				wo.addPatternList(ActivityType.embed.toString(), active.getId(), active.getName(), null);
 			}
 		}
-
-		if(!wrap.getManualList().isEmpty() && StringTools.matchKeyword(wi.getKeyword(),
-				XGsonBuilder.toJson(wrap.getManualList()), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())){
-			if(wo == null){
-				wo = this.getProcessWo(business, process);
-			}
-			for (WrapManual active : wrap.getManualList()){
-				Map<String, String> map = PropertyTools.fieldMatchKeyword(WrapManual.outCopier.getCopyFields(), active, wi.getKeyword(),
-						wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
-				if (!map.isEmpty()) {
-					if(wo == null){
-						wo = this.getProcessWo(business, process);
-					}
-					wo.addPatternList(DESIGN_PROCESS_ACTIVITY, active.getId(), active.getName(), map);
+		embedList.clear();
+		embedList = null;
+
+		List<End> endList = business.entityManagerContainer().list(End.class, business.end().listWithProcess(process.getId()));
+		for (End active : endList){
+			if(StringTools.matchKeyword(wi.getKeyword(),
+					XGsonBuilder.toJson(active), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())) {
+				if (wo == null) {
+					wo = this.getProcessWo(business, process);
 				}
+				wo.addPatternList(ActivityType.end.toString(), active.getId(), active.getName(), null);
 			}
 		}
-
-		if(!wrap.getMergeList().isEmpty() && StringTools.matchKeyword(wi.getKeyword(),
-				XGsonBuilder.toJson(wrap.getMergeList()), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())){
-			if(wo == null){
-				wo = this.getProcessWo(business, process);
-			}
-			for (WrapMerge active : wrap.getMergeList()){
-				Map<String, String> map = PropertyTools.fieldMatchKeyword(WrapMerge.outCopier.getCopyFields(), active, wi.getKeyword(),
-						wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
-				if (!map.isEmpty()) {
-					if(wo == null){
-						wo = this.getProcessWo(business, process);
-					}
-					wo.addPatternList(DESIGN_PROCESS_ACTIVITY, active.getId(), active.getName(), map);
+		endList.clear();
+		endList = null;
+
+		List<Invoke> invokeList = business.entityManagerContainer().list(Invoke.class, business.invoke().listWithProcess(process.getId()));
+		for (Invoke active : invokeList){
+			if(StringTools.matchKeyword(wi.getKeyword(),
+					XGsonBuilder.toJson(active), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())) {
+				if (wo == null) {
+					wo = this.getProcessWo(business, process);
 				}
+				wo.addPatternList(ActivityType.invoke.toString(), active.getId(), active.getName(), null);
 			}
 		}
-
-		if(!wrap.getMessageList().isEmpty() && StringTools.matchKeyword(wi.getKeyword(),
-				XGsonBuilder.toJson(wrap.getMessageList()), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())){
-			if(wo == null){
-				wo = this.getProcessWo(business, process);
-			}
-			for (WrapMessage active : wrap.getMessageList()){
-				Map<String, String> map = PropertyTools.fieldMatchKeyword(WrapMessage.outCopier.getCopyFields(), active, wi.getKeyword(),
-						wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
-				if (!map.isEmpty()) {
-					if(wo == null){
-						wo = this.getProcessWo(business, process);
-					}
-					wo.addPatternList(DESIGN_PROCESS_ACTIVITY, active.getId(), active.getName(), map);
+		invokeList.clear();
+		invokeList = null;
+
+		List<Manual> manualList = business.entityManagerContainer().list(Manual.class, business.manual().listWithProcess(process.getId()));
+		for (Manual active : manualList){
+			if(StringTools.matchKeyword(wi.getKeyword(),
+					XGsonBuilder.toJson(active), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())) {
+				if (wo == null) {
+					wo = this.getProcessWo(business, process);
 				}
+				wo.addPatternList(ActivityType.manual.toString(), active.getId(), active.getName(), null);
 			}
 		}
-
-		if(!wrap.getParallelList().isEmpty() && StringTools.matchKeyword(wi.getKeyword(),
-				XGsonBuilder.toJson(wrap.getParallelList()), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())){
-			if(wo == null){
-				wo = this.getProcessWo(business, process);
-			}
-			for (WrapParallel active : wrap.getParallelList()){
-				Map<String, String> map = PropertyTools.fieldMatchKeyword(WrapParallel.outCopier.getCopyFields(), active, wi.getKeyword(),
-						wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
-				if (!map.isEmpty()) {
-					if(wo == null){
-						wo = this.getProcessWo(business, process);
-					}
-					wo.addPatternList(DESIGN_PROCESS_ACTIVITY, active.getId(), active.getName(), map);
+		manualList.clear();
+		manualList = null;
+
+		List<Merge> mergeList = business.entityManagerContainer().list(Merge.class, business.merge().listWithProcess(process.getId()));
+		for (Merge active : mergeList){
+			if(StringTools.matchKeyword(wi.getKeyword(),
+					XGsonBuilder.toJson(active), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())) {
+				if (wo == null) {
+					wo = this.getProcessWo(business, process);
 				}
+				wo.addPatternList(ActivityType.merge.toString(), active.getId(), active.getName(), null);
 			}
 		}
-
-		if(!wrap.getServiceList().isEmpty() && StringTools.matchKeyword(wi.getKeyword(),
-				XGsonBuilder.toJson(wrap.getServiceList()), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())){
-			if(wo == null){
-				wo = this.getProcessWo(business, process);
-			}
-			for (WrapService active : wrap.getServiceList()){
-				Map<String, String> map = PropertyTools.fieldMatchKeyword(WrapService.outCopier.getCopyFields(), active, wi.getKeyword(),
-						wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
-				if (!map.isEmpty()) {
-					if(wo == null){
-						wo = this.getProcessWo(business, process);
-					}
-					wo.addPatternList(DESIGN_PROCESS_ACTIVITY, active.getId(), active.getName(), map);
+		mergeList.clear();
+		mergeList = null;
+
+		List<Message> messageList = business.entityManagerContainer().list(Message.class, business.message().listWithProcess(process.getId()));
+		for (Message active : messageList){
+			if(StringTools.matchKeyword(wi.getKeyword(),
+					XGsonBuilder.toJson(active), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())) {
+				if (wo == null) {
+					wo = this.getProcessWo(business, process);
 				}
+				wo.addPatternList(ActivityType.message.toString(), active.getId(), active.getName(), null);
 			}
 		}
-
-		if(!wrap.getSplitList().isEmpty() && StringTools.matchKeyword(wi.getKeyword(),
-				XGsonBuilder.toJson(wrap.getSplitList()), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())){
-			if(wo == null){
-				wo = this.getProcessWo(business, process);
+		messageList.clear();
+		messageList = null;
+
+		List<Parallel> parallelList = business.entityManagerContainer().list(Parallel.class, business.parallel().listWithProcess(process.getId()));
+		for (Parallel active : parallelList){
+			if(StringTools.matchKeyword(wi.getKeyword(),
+					XGsonBuilder.toJson(active), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())) {
+				if (wo == null) {
+					wo = this.getProcessWo(business, process);
+				}
+				wo.addPatternList(ActivityType.parallel.toString(), active.getId(), active.getName(), null);
 			}
-			for (WrapSplit active : wrap.getSplitList()){
-				Map<String, String> map = PropertyTools.fieldMatchKeyword(WrapSplit.outCopier.getCopyFields(), active, wi.getKeyword(),
-						wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
-				if (!map.isEmpty()) {
-					if(wo == null){
-						wo = this.getProcessWo(business, process);
-					}
-					wo.addPatternList(DESIGN_PROCESS_ACTIVITY, active.getId(), active.getName(), map);
+		}
+		parallelList.clear();
+		parallelList = null;
+
+		List<Service> serviceList = business.entityManagerContainer().list(Service.class, business.service().listWithProcess(process.getId()));
+		for (Service active : serviceList){
+			if(StringTools.matchKeyword(wi.getKeyword(),
+					XGsonBuilder.toJson(active), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())) {
+				if (wo == null) {
+					wo = this.getProcessWo(business, process);
 				}
+				wo.addPatternList(ActivityType.service.toString(), active.getId(), active.getName(), null);
 			}
 		}
-
-		if(!wrap.getRouteList().isEmpty() && StringTools.matchKeyword(wi.getKeyword(),
-				XGsonBuilder.toJson(wrap.getRouteList()), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())){
-			if(wo == null){
-				wo = this.getProcessWo(business, process);
+		serviceList.clear();
+		serviceList = null;
+
+		List<Split> splitList = business.entityManagerContainer().list(Split.class, business.split().listWithProcess(process.getId()));
+		for (Split active : splitList){
+			if(StringTools.matchKeyword(wi.getKeyword(),
+					XGsonBuilder.toJson(active), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())) {
+				if (wo == null) {
+					wo = this.getProcessWo(business, process);
+				}
+				wo.addPatternList(ActivityType.split.toString(), active.getId(), active.getName(), null);
 			}
-			for (WrapRoute active : wrap.getRouteList()){
-				Map<String, String> map = PropertyTools.fieldMatchKeyword(WrapRoute.outCopier.getCopyFields(), active, wi.getKeyword(),
-						wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
-				if (!map.isEmpty()) {
-					if(wo == null){
-						wo = this.getProcessWo(business, process);
-					}
-					wo.addPatternList(DESIGN_PROCESS_ACTIVITY, active.getId(), active.getName(), map);
+		}
+		splitList.clear();
+		splitList = null;
+
+		List<Route> routeList = business.entityManagerContainer().list(Route.class, business.route().listWithProcess(process.getId()));
+		for (Route active : routeList){
+			if(StringTools.matchKeyword(wi.getKeyword(),
+					XGsonBuilder.toJson(active), wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp())) {
+				if (wo == null) {
+					wo = this.getProcessWo(business, process);
 				}
+				wo.addPatternList(DESIGN_PROCESS_ROUTE, active.getId(), active.getName(), null);
 			}
 		}
+		routeList.clear();
+		routeList = null;
 
-		wrap.getManualList().clear();
 		return wo;
 	}
 
 	private Wo getProcessWo(Business business, Process process) throws Exception {
 		Wo wo = new Wo();
-		Application app = business.entityManagerContainer().find(process.getApplication(), Application.class);
+		Application app = business.entityManagerContainer().fetch(process.getApplication(), Application.class,
+				ListTools.toList(Application.id_FIELDNAME, Application.name_FIELDNAME));
 		if (app != null) {
 			wo.setAppId(app.getId());
 			wo.setAppName(app.getName());

+ 44 - 0
o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/jaxrs/process/ActionGetProcess.java

@@ -0,0 +1,44 @@
+package com.x.processplatform.assemble.designer.jaxrs.process;
+
+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.processplatform.assemble.designer.Business;
+import com.x.processplatform.core.entity.element.Process;
+import com.x.processplatform.core.entity.element.*;
+
+class ActionGetProcess extends BaseAction {
+
+	ActionResult<Wo> execute(EffectivePerson effectivePerson, String id) throws Exception {
+		ActionResult<Wo> result = new ActionResult<>();
+		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+			Business business = new Business(emc);
+			Process process = emc.fetch(id, Process.class);
+			if (null == process) {
+				throw new ExceptionProcessNotExisted(id);
+			}
+			Application application = emc.find(process.getApplication(), Application.class);
+			if (null == application) {
+				throw new ExceptionApplicationNotExist(process.getApplication());
+			}
+			if (!business.editable(effectivePerson, application)) {
+				throw new ExceptionApplicationAccessDenied(effectivePerson.getDistinguishedName(),
+						application.getName(), application.getId());
+			}
+			result.setData(Wo.outCopier.copy(process));
+			return result;
+		}
+	}
+
+	public static class Wo extends Process {
+
+		private static final long serialVersionUID = 1683913161529174561L;
+
+		public static WrapCopier<Process, Wo> outCopier = WrapCopierFactory.wo(Process.class, Wo.class,
+				null, JpaObject.FieldsInvisible);
+	}
+}

+ 138 - 0
o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/jaxrs/process/ActionGetProcessElementList.java

@@ -0,0 +1,138 @@
+package com.x.processplatform.assemble.designer.jaxrs.process;
+
+import com.google.gson.JsonElement;
+import com.x.base.core.container.EntityManagerContainer;
+import com.x.base.core.container.factory.EntityManagerContainerFactory;
+import com.x.base.core.project.annotation.FieldDescribe;
+import com.x.base.core.project.annotation.FieldTypeDescribe;
+import com.x.base.core.project.gson.GsonPropertyObject;
+import com.x.base.core.project.http.ActionResult;
+import com.x.base.core.project.http.EffectivePerson;
+import com.x.base.core.project.logger.Logger;
+import com.x.base.core.project.logger.LoggerFactory;
+import com.x.base.core.project.tools.ListTools;
+import com.x.processplatform.assemble.designer.Business;
+import com.x.processplatform.core.entity.element.*;
+import com.x.processplatform.core.entity.element.Process;
+
+import java.util.*;
+
+class ActionGetProcessElementList extends BaseAction {
+
+	private static Logger logger = LoggerFactory.getLogger(ActionGetProcessElementList.class);
+
+	ActionResult<Wo> execute(EffectivePerson effectivePerson, String id, JsonElement jsonElement) throws Exception {
+		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+			ActionResult<Wo> result = new ActionResult<>();
+			Business business = new Business(emc);
+			Process process = emc.fetch(id, Process.class, ListTools.toList(Process.application_FIELDNAME));
+			if (null == process) {
+				throw new ExceptionProcessNotExisted(id);
+			}
+			Application application = emc.find(process.getApplication(), Application.class);
+			if (null == application) {
+				throw new ExceptionApplicationNotExist(process.getApplication());
+			}
+			if (!business.editable(effectivePerson, application)) {
+				throw new ExceptionApplicationAccessDenied(effectivePerson.getDistinguishedName(),
+						application.getName(), application.getId());
+			}
+			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
+			final Map<String, Set<String>> map = new HashMap<>();
+			if(ListTools.isNotEmpty(wi.getElementWiList())){
+				wi.getElementWiList().stream().forEach(elementWi -> {
+					if (map.containsKey(elementWi.getElementType())){
+						map.get(elementWi.getElementType()).add(elementWi.getElementId());
+					}else{
+						Set<String> set = new HashSet<>();
+						set.add(elementWi.getElementId());
+						map.put(elementWi.getElementType(), set);
+					}
+				});
+			}
+			//logger.print("查询的元素信息:{}", map);
+			Wo wo = new Wo();
+			for (String key : map.keySet()){
+				if("route".equals(key)){
+					List<Route> routeList = emc.listEqualAndIn(Route.class, Route.process_FIELDNAME, id,Route.id_FIELDNAME, map.get(key));
+					wo.setRouteList(routeList);
+				}else{
+					List<Activity> list = (List<Activity>)emc.listEqualAndIn(ActivityType.getClassOfActivityType(ActivityType.valueOf(key)),
+							Route.process_FIELDNAME, id, Activity.id_FIELDNAME, map.get(key));
+					if(wo.getActivityList()==null){
+						wo.setActivityList(list);
+					}else{
+						wo.getActivityList().addAll(list);
+					}
+				}
+			}
+
+			result.setData(wo);
+			return result;
+		}
+	}
+
+	public static class Wo extends GsonPropertyObject {
+
+		@FieldDescribe("节点信息.")
+		private List<Activity> activityList;
+
+		@FieldDescribe("路由信息.")
+		private List<Route> routeList;
+
+		public List<Activity> getActivityList() {
+			return activityList;
+		}
+
+		public void setActivityList(List<Activity> activityList) {
+			this.activityList = activityList;
+		}
+
+		public List<Route> getRouteList() {
+			return routeList;
+		}
+
+		public void setRouteList(List<Route> routeList) {
+			this.routeList = routeList;
+		}
+	}
+
+	public static class Wi extends GsonPropertyObject {
+
+		@FieldDescribe("查询元素列表(元素类型:route|begin|agent|...)")
+		@FieldTypeDescribe(fieldType = "class", fieldTypeName = "ElementWi", fieldValue = "{\"elementType\": \"元素类型\", \"elementId\": \"元素ID\"}")
+		private List<ElementWi> elementWiList;
+
+		public List<ElementWi> getElementWiList() {
+			return elementWiList;
+		}
+
+		public void setElementWiList(List<ElementWi> elementWiList) {
+			this.elementWiList = elementWiList;
+		}
+	}
+
+	public static class ElementWi extends GsonPropertyObject {
+
+		@FieldDescribe("元素类型(route|begin|agent|...).")
+		private String elementType;
+		@FieldDescribe("元素ID.")
+		private String elementId;
+
+		public String getElementType() {
+			return elementType;
+		}
+
+		public void setElementType(String elementType) {
+			this.elementType = elementType;
+		}
+
+		public String getElementId() {
+			return elementId;
+		}
+
+		public void setElementId(String elementId) {
+			this.elementId = elementId;
+		}
+	}
+}

+ 37 - 1
o2server/x_processplatform_assemble_designer/src/main/java/com/x/processplatform/assemble/designer/jaxrs/process/ProcessAction.java

@@ -305,4 +305,40 @@ public class ProcessAction extends StandardJaxrsAction {
 		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
 	}
 
-}
+	@JaxrsMethodDescribe(value = "仅获取流程内容,不包含节点和路由信息", action = ActionGetProcess.class)
+	@GET
+	@Path("{id}/process")
+	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+	@Consumes(MediaType.APPLICATION_JSON)
+	public void getProcess(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
+					@JaxrsParameterDescribe("标识") @PathParam("id") String id) {
+		ActionResult<ActionGetProcess.Wo> result = new ActionResult<>();
+		EffectivePerson effectivePerson = this.effectivePerson(request);
+		try {
+			result = new ActionGetProcess().execute(effectivePerson, id);
+		} catch (Exception e) {
+			logger.error(e, effectivePerson, request, null);
+			result.error(e);
+		}
+		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+	}
+
+	@JaxrsMethodDescribe(value = "查询流程的指定节点或路由信息.", action = ActionGetProcessElementList.class)
+	@POST
+	@Path("{id}/list/element")
+	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+	@Consumes(MediaType.APPLICATION_JSON)
+	public void getProcessElementList(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
+								  @JaxrsParameterDescribe("标识") @PathParam("id") String id, JsonElement jsonElement) {
+		ActionResult<ActionGetProcessElementList.Wo> result = new ActionResult<>();
+		EffectivePerson effectivePerson = this.effectivePerson(request);
+		try {
+			result = new ActionGetProcessElementList().execute(effectivePerson, id, jsonElement);
+		} catch (Exception e) {
+			logger.error(e, effectivePerson, request, jsonElement);
+			result.error(e);
+		}
+		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+	}
+
+}

+ 2 - 0
o2server/x_program_center/src/main/java/com/x/program/center/jaxrs/designer/ActionSearch.java

@@ -93,6 +93,7 @@ class ActionSearch extends BaseAction {
 					}
 				}
 				woAgents.clear();
+				woAgents = null;
 			}catch (Exception e){
 				logger.error(e);
 			}
@@ -127,6 +128,7 @@ class ActionSearch extends BaseAction {
 					}
 				}
 				woInvokes.clear();
+				woInvokes = null;
 			}catch (Exception e){
 				logger.error(e);
 			}

+ 7 - 4
o2server/x_query_assemble_designer/src/main/java/com/x/query/assemble/designer/jaxrs/designer/ActionSearch.java

@@ -96,7 +96,7 @@ class ActionSearch extends BaseAction {
 							wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
 					if (!map.isEmpty()) {
 						Wo wo = new Wo();
-						Query query = emc.find(woView.getQuery(), Query.class);
+						Query query = emc.fetch(woView.getQuery(), Query.class, ListTools.toList(Query.id_FIELDNAME, Query.name_FIELDNAME));
 						if (query != null) {
 							wo.setAppId(query.getId());
 							wo.setAppName(query.getName());
@@ -135,7 +135,7 @@ class ActionSearch extends BaseAction {
 							wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
 					if (!map.isEmpty()) {
 						Wo wo = new Wo();
-						Query query = emc.find(woTable.getQuery(), Query.class);
+						Query query = emc.fetch(woTable.getQuery(), Query.class, ListTools.toList(Query.id_FIELDNAME, Query.name_FIELDNAME));
 						if (query != null) {
 							wo.setAppId(query.getId());
 							wo.setAppName(query.getName());
@@ -149,6 +149,7 @@ class ActionSearch extends BaseAction {
 					}
 				}
 				woTables.clear();
+				woTables = null;
 			}catch (Exception e){
 				logger.error(e);
 			}
@@ -174,7 +175,7 @@ class ActionSearch extends BaseAction {
 							wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
 					if (!map.isEmpty()) {
 						Wo wo = new Wo();
-						Query query = emc.find(woStat.getQuery(), Query.class);
+						Query query = emc.fetch(woStat.getQuery(), Query.class, ListTools.toList(Query.id_FIELDNAME, Query.name_FIELDNAME));
 						if (query != null) {
 							wo.setAppId(query.getId());
 							wo.setAppName(query.getName());
@@ -188,6 +189,7 @@ class ActionSearch extends BaseAction {
 					}
 				}
 				woStats.clear();
+				woStats = null;
 			}catch (Exception e){
 				logger.error(e);
 			}
@@ -213,7 +215,7 @@ class ActionSearch extends BaseAction {
 							wi.getCaseSensitive(), wi.getMatchWholeWord(), wi.getMatchRegExp());
 					if (!map.isEmpty()) {
 						Wo wo = new Wo();
-						Query query = emc.find(woStatement.getQuery(), Query.class);
+						Query query = emc.fetch(woStatement.getQuery(), Query.class, ListTools.toList(Query.id_FIELDNAME, Query.name_FIELDNAME));
 						if (query != null) {
 							wo.setAppId(query.getId());
 							wo.setAppName(query.getName());
@@ -227,6 +229,7 @@ class ActionSearch extends BaseAction {
 					}
 				}
 				woStatements.clear();
+				woStatements = null;
 			}catch (Exception e){
 				logger.error(e);
 			}

+ 48 - 2
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/Business.java

@@ -24,6 +24,8 @@ public class Business {
 
 	private EntityManagerContainer emc;
 
+	public Business(){}
+
 	public Business(EntityManagerContainer emc) throws Exception {
 		this.emc = emc;
 	}
@@ -54,11 +56,55 @@ public class Business {
 		if (effectivePerson.isManager()) {
 			return true;
 		}
-		if (this.organization.person().hasRole(effectivePerson, OrganizationDefinition.QueryManager,
+		if (this.organization().person().hasRole(effectivePerson, OrganizationDefinition.QueryManager,
+				OrganizationDefinition.Manager)) {
+			return true;
+		}
+		return false;
+	}
+
+	public boolean isProcessManager(EffectivePerson effectivePerson) throws Exception {
+		if (effectivePerson.isManager()) {
+			return true;
+		}
+		if (this.organization().person().hasRole(effectivePerson, OrganizationDefinition.ProcessPlatformManager,
+				OrganizationDefinition.Manager)) {
+			return true;
+		}
+		return false;
+	}
+
+	public boolean isServiceManager(EffectivePerson effectivePerson) throws Exception {
+		if (effectivePerson.isManager()) {
+			return true;
+		}
+		if (this.organization().person().hasRole(effectivePerson, OrganizationDefinition.ServiceManager,
+				OrganizationDefinition.Manager)) {
+			return true;
+		}
+		return false;
+	}
+
+	public boolean isCmsManager(EffectivePerson effectivePerson) throws Exception {
+		if (effectivePerson.isManager()) {
+			return true;
+		}
+		if (this.organization().person().hasRole(effectivePerson, OrganizationDefinition.CMSManager,
+				OrganizationDefinition.Manager)) {
+			return true;
+		}
+		return false;
+	}
+
+	public boolean isPortalManager(EffectivePerson effectivePerson) throws Exception {
+		if (effectivePerson.isManager()) {
+			return true;
+		}
+		if (this.organization().person().hasRole(effectivePerson, OrganizationDefinition.PortalManager,
 				OrganizationDefinition.Manager)) {
 			return true;
 		}
 		return false;
 	}
 
-}
+}

+ 34 - 17
o2server/x_query_service_processing/src/main/java/com/x/query/service/processing/jaxrs/design/ActionSearch.java

@@ -13,6 +13,7 @@ import com.x.base.core.project.logger.Logger;
 import com.x.base.core.project.logger.LoggerFactory;
 import com.x.base.core.project.tools.ListTools;
 import com.x.base.core.project.tools.SortTools;
+import com.x.query.service.processing.Business;
 import com.x.query.service.processing.ThisApplication;
 import org.apache.commons.beanutils.BeanUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -33,13 +34,13 @@ class ActionSearch extends BaseAction {
 		if(StringUtils.isBlank(wi.getKeyword())){
 			throw new ExceptionFieldEmpty("keyword");
 		}
-		logger.info("{}搜索全局设计:{}", effectivePerson.getDistinguishedName(), wi);
-		if (ListTools.isEmpty(wi.getModuleList())) {
-			result.setData(search(wi));
+		logger.info("{}搜索设计:{}的关键字:{}", effectivePerson.getDistinguishedName(), wi.getModuleList(), wi.getKeyword());
+		if (ListTools.isNotEmpty(wi.getModuleList())) {
+			result.setData(search(wi, effectivePerson));
 		}else{
 			lock.lock();
 			try {
-				result.setData(search(wi));
+				result.setData(search(wi, effectivePerson));
 			} finally {
 				lock.unlock();
 			}
@@ -47,33 +48,49 @@ class ActionSearch extends BaseAction {
 		return result;
 	}
 
-	private Wo search(final Wi wi) {
+	private Wo search(final Wi wi, EffectivePerson effectivePerson) throws Exception{
+		Business business = new Business();
 		final Map<String, List<WiDesigner.ModuleApp>> moduleMap = new HashMap<>();
 		if(!ListTools.isEmpty(wi.getModuleList())){
 			for (Module module: wi.getModuleList()){
-				if(module.getModuleType().equalsIgnoreCase(ModuleType.cms.toString())){
+				if(module.getModuleType().equalsIgnoreCase(ModuleType.cms.toString())
+						&& business.isCmsManager(effectivePerson)){
 					moduleMap.put(ModuleType.cms.toString(), module.getModuleAppList());
 				}
-				if(module.getModuleType().equalsIgnoreCase(ModuleType.portal.toString())){
+				if(module.getModuleType().equalsIgnoreCase(ModuleType.portal.toString())
+						&& business.isPortalManager(effectivePerson)){
 					moduleMap.put(ModuleType.portal.toString(), module.getModuleAppList());
 				}
-				if(module.getModuleType().equalsIgnoreCase(ModuleType.processPlatform.toString())){
+				if(module.getModuleType().equalsIgnoreCase(ModuleType.processPlatform.toString())
+						&& business.isProcessManager(effectivePerson)){
 					moduleMap.put(ModuleType.processPlatform.toString(), module.getModuleAppList());
 				}
-				if(module.getModuleType().equalsIgnoreCase(ModuleType.query.toString())){
+				if(module.getModuleType().equalsIgnoreCase(ModuleType.query.toString())
+						&& business.isManager(effectivePerson)){
 					moduleMap.put(ModuleType.query.toString(), module.getModuleAppList());
 				}
-				if(module.getModuleType().equalsIgnoreCase(ModuleType.service.toString())){
+				if(module.getModuleType().equalsIgnoreCase(ModuleType.service.toString())
+						&& business.isServiceManager(effectivePerson)){
 					moduleMap.put(ModuleType.service.toString(), module.getModuleAppList());
 				}
 			}
 		}else{
 			List<WiDesigner.ModuleApp> list = new ArrayList<>();
-			moduleMap.put(ModuleType.cms.toString(), list);
-			moduleMap.put(ModuleType.portal.toString(), list);
-			moduleMap.put(ModuleType.processPlatform.toString(), list);
-			moduleMap.put(ModuleType.query.toString(), list);
-			moduleMap.put(ModuleType.service.toString(), list);
+			if(business.isCmsManager(effectivePerson)) {
+				moduleMap.put(ModuleType.cms.toString(), list);
+			}
+			if(business.isPortalManager(effectivePerson)) {
+				moduleMap.put(ModuleType.portal.toString(), list);
+			}
+			if(business.isProcessManager(effectivePerson)) {
+				moduleMap.put(ModuleType.processPlatform.toString(), list);
+			}
+			if(business.isManager(effectivePerson)) {
+				moduleMap.put(ModuleType.query.toString(), list);
+			}
+			if(business.isServiceManager(effectivePerson)) {
+				moduleMap.put(ModuleType.service.toString(), list);
+			}
 		}
 		Executor executor = Executors.newFixedThreadPool(5);
 		CompletableFuture<List<WrapDesigner>> processPlatformCf = searchAsync(wi, moduleMap, ModuleType.processPlatform.toString(), x_processplatform_assemble_designer.class, executor);
@@ -112,7 +129,7 @@ class ActionSearch extends BaseAction {
 
 	private CompletableFuture<List<WrapDesigner>> searchAsync(final Wi wi, final Map<String, List<WiDesigner.ModuleApp>> moduleMap, final String moduleType, final Class<?> applicationClass, Executor executor){
 		CompletableFuture<List<WrapDesigner>> cf = CompletableFuture.supplyAsync(() -> {
-			List<WrapDesigner> swList = new ArrayList<>();
+			List<WrapDesigner> swList = null;
 			if(moduleMap.containsKey(moduleType)) {
 				try {
 					WiDesigner wiDesigner = new WiDesigner();
@@ -126,7 +143,7 @@ class ActionSearch extends BaseAction {
 				} catch (Exception e) {
 					logger.error(e);
 				}
-				if (swList.size() > 2) {
+				if (swList!=null && swList.size() > 2) {
 					try {
 						SortTools.desc(swList, "designerType","appId");
 					} catch (Exception e) {