1 25 package org.ofbiz.workflow.impl; 26 27 import java.util.Map ; 28 29 import org.ofbiz.entity.GenericEntityException; 30 import org.ofbiz.entity.GenericValue; 31 import org.ofbiz.service.GenericResultWaiter; 32 import org.ofbiz.service.ModelService; 33 import org.ofbiz.workflow.WfException; 34 35 43 public class WfActivitySubFlowImplementation extends WfActivityAbstractImplementation { 44 45 public static final String module = WfActivitySubFlowImplementation.class.getName(); 46 47 public WfActivitySubFlowImplementation(WfActivityImpl wfActivity) { 48 super(wfActivity); 49 } 50 51 54 public void run() throws WfException { 55 GenericValue subFlow = null; 56 try { 57 subFlow = getActivity().getDefinitionObject().getRelatedOne("WorkflowActivitySubFlow"); 58 } catch (GenericEntityException e) { 59 throw new WfException(e.getMessage(), e); 60 } 61 if (subFlow == null) 62 return; 63 64 String type = "WSE_SYNCHR"; 65 if (subFlow.get("executionEnumId") != null) 66 type = subFlow.getString("executionEnumId"); 67 68 ModelService service = new ModelService(); 70 service.name = service.toString(); 71 service.engineName = "workflow"; 72 service.location = subFlow.getString("packageId"); 73 service.invoke = subFlow.getString("subFlowProcessId"); 74 service.validate = false; 75 76 String actualParameters = subFlow.getString("actualParameters"); 79 GenericResultWaiter waiter = runService(service, actualParameters, null); 80 if (type.equals("WSE_SYNCHR")) { 81 Map subResult = waiter.waitForResult(); 82 this.setResult(subResult); 83 } 84 setComplete(true); 85 } 86 } 87 | Popular Tags |