String beanName = activity.getBeanName(); if (beanName!=null) { bean = activityInstance.getConfiguration().get(beanName); method = Reflection.findMethod(bean.getClass(), activity.getMethodName(), args);
/** * Starts the subworkflow instance. */ protected void startWorkflowInstance(ActivityInstanceImpl activityInstance, TriggerInstance triggerInstance) { Configuration configuration = activityInstance.getConfiguration(); WorkflowEngineImpl workflowEngine = configuration.get(WorkflowEngineImpl.class); WorkflowInstanceImpl calledWorkflowInstance = workflowEngine.startInitialize(triggerInstance); calledWorkflowInstance.addLockedWorkflowInstance(activityInstance.workflowInstance); activityInstance.setCalledWorkflowInstanceId(calledWorkflowInstance.getId()); workflowEngine.startExecute(calledWorkflowInstance); }
@Override public void execute(ActivityInstanceImpl activityInstance) { Configuration configuration = activityInstance.getConfiguration(); WorkflowId actualSubWorkflowId = null; if (this.subWorkflowId != null) { actualSubWorkflowId = this.subWorkflowId; } else if (subWorkflowSourceId != null) { WorkflowStore workflowStore = configuration.get(WorkflowStore.class); actualSubWorkflowId = workflowStore.findLatestWorkflowIdBySource(subWorkflowSourceId); } if (actualSubWorkflowId != null) { TriggerInstance triggerInstance = new TriggerInstance() .sourceWorkflowId(subWorkflowSourceId) .workflowId(actualSubWorkflowId); triggerInstance.setCallingWorkflowInstanceId(activityInstance.workflowInstance.id); triggerInstance.setCallingActivityInstanceId(activityInstance.id); if (inputBindings != null) { for (String subWorkflowVariableId: inputBindings.keySet()) { BindingImpl<?> subWorkflowBinding = inputBindings.get(subWorkflowVariableId); Object value = activityInstance.getValue(subWorkflowBinding); triggerInstance.data(subWorkflowVariableId, value); } } startWorkflowInstance(activityInstance, triggerInstance); } else { reportError(activityInstance, "Cannot execute sub-process action because no sub-process was configured."); activityInstance.onwards(); } }