@Override public AuditEvent buildEvent(ProcessNodeTriggeredEvent pnte, Object log) { NodeInstanceImpl nodeInstance = (NodeInstanceImpl) pnte.getNodeInstance(); NodeInstanceLog logEvent =null; if (log != null) { logEvent = (NodeInstanceLog) log; if (nodeInstance instanceof WorkItemNodeInstance && ((WorkItemNodeInstance) nodeInstance).getWorkItem() != null) { logEvent.setWorkItemId(((WorkItemNodeInstance) nodeInstance).getWorkItem().getId()); } if (nodeInstance instanceof SubProcessNodeInstance) { logEvent.setReferenceId(((SubProcessNodeInstance) nodeInstance).getProcessInstanceId()); } return logEvent; } return null; }
nodeInstance = new SubProcessNodeInstance(); ((SubProcessNodeInstance) nodeInstance).internalSetProcessInstanceId(stream.readLong()); nbTimerInstances = stream.readInt(); if (nbTimerInstances > 0) { timerInstances.add(stream.readLong()); ((SubProcessNodeInstance) nodeInstance).internalSetTimerInstances(timerInstances);
subProcessNodeInstance.internalSetProcessInstanceId(subProcessInstance.getId()); subProcessNodeInstance.triggerCompleted(); } else { subProcessNodeInstance.addEventListeners();
public void processInstanceCompleted(ProcessInstance processInstance) { removeEventListeners(); handleOutMappings(processInstance); if (processInstance.getState() == ProcessInstance.STATE_ABORTED) { String faultName = processInstance.getOutcome()==null?"":processInstance.getOutcome(); // handle exception as sub process failed with error code ExceptionScopeInstance exceptionScopeInstance = (ExceptionScopeInstance) resolveContextInstance(ExceptionScope.EXCEPTION_SCOPE, faultName); if (exceptionScopeInstance != null) { exceptionScopeInstance.handleException(faultName, processInstance.getFaultData()); if (getSubProcessNode() != null && !getSubProcessNode().isIndependent() && getSubProcessNode().isAbortParent()){ cancel(); } return; } else if (getSubProcessNode() != null && !getSubProcessNode().isIndependent() && getSubProcessNode().isAbortParent()){ ((ProcessInstance) getProcessInstance()).setState(ProcessInstance.STATE_ABORTED, faultName); return; } } // handle dynamic subprocess if (getNode() == null) { setMetaData("NodeType", "SubProcessNode"); } // if there were no exception proceed normally triggerCompleted(); }
final String processId, final Map<String, Object> parameters) { final SubProcessNodeInstance subProcessNodeInstance = new SubProcessNodeInstance(); subProcessNodeInstance.setNodeInstanceContainer(dynamicContext == null ? processInstance : dynamicContext); subProcessNodeInstance.setProcessInstance(processInstance); subProcessNodeInstance.setMetaData("NodeType", "SubProcessNode"); if (ksession instanceof StatefulKnowledgeSessionImpl) {
stream.writeLong(((SubProcessNodeInstance) nodeInstance).getProcessInstanceId()); List<Long> timerInstances = ((SubProcessNodeInstance) nodeInstance).getTimerInstances(); if (timerInstances != null) { stream.writeInt(timerInstances.size());
if (getNodeInstanceContainer().getNodeInstance(getId()) == null) { return; for (Iterator<DataAssociation> iterator = getSubProcessNode().getInAssociations().iterator(); iterator.hasNext(); ) { DataAssociation mapping = iterator.next(); Object parameterValue = null; DataTransformer transformer = DataTransformerRegistry.get().find(transformation.getLanguage()); if (transformer != null) { parameterValue = transformer.transform(transformation.getCompiledExpression(), getSourceParameters(mapping)); resolveContextInstance(VariableScope.VARIABLE_SCOPE, mapping.getSources().get(0)); if (variableScopeInstance != null) { parameterValue = variableScopeInstance.getVariable(mapping.getSources().get(0)); } else { logger.error("Could not find variable scope for variable {}", mapping.getSources().get(0)); logger.error("when trying to execute SubProcess node {}", getSubProcessNode().getName()); logger.error("Continuing without setting parameter."); String processId = getSubProcessNode().getProcessId(); if (processId == null) { processId = getSubProcessNode().getProcessName(); if (replacements.get(paramName) == null) { VariableScopeInstance variableScopeInstance = (VariableScopeInstance) resolveContextInstance(VariableScope.VARIABLE_SCOPE, paramName); if (variableScopeInstance != null) {
public void addEventListeners() { super.addEventListeners(); addProcessListener(); }
} else if ( nodeInstance instanceof SubProcessNodeInstance ) { JBPMMessages.ProcessInstance.NodeInstanceContent.SubProcessNode.Builder _sp = JBPMMessages.ProcessInstance.NodeInstanceContent.SubProcessNode.newBuilder() .setProcessInstanceId( ((SubProcessNodeInstance) nodeInstance).getProcessInstanceId() ); List<Long> timerInstances = ((SubProcessNodeInstance) nodeInstance).getTimerInstances(); if ( timerInstances != null ) { for ( Long id : timerInstances ) {
if (getNodeInstanceContainer().getNodeInstance(getId()) == null) { return; for (Iterator<DataAssociation> iterator = getSubProcessNode().getInAssociations().iterator(); iterator.hasNext(); ) { DataAssociation mapping = iterator.next(); Object parameterValue = null; DataTransformer transformer = DataTransformerRegistry.get().find(transformation.getLanguage()); if (transformer != null) { parameterValue = transformer.transform(transformation.getCompiledExpression(), getSourceParameters(mapping)); resolveContextInstance(VariableScope.VARIABLE_SCOPE, mapping.getSources().get(0)); if (variableScopeInstance != null) { parameterValue = variableScopeInstance.getVariable(mapping.getSources().get(0)); } else { logger.error("Could not find variable scope for variable {}", mapping.getSources().get(0)); logger.error("when trying to execute SubProcess node {}", getSubProcessNode().getName()); logger.error("Continuing without setting parameter."); String processId = getSubProcessNode().getProcessId(); if (processId == null) { processId = getSubProcessNode().getProcessName(); if (replacements.get(paramName) == null) { VariableScopeInstance variableScopeInstance = (VariableScopeInstance) resolveContextInstance(VariableScope.VARIABLE_SCOPE, paramName); if (variableScopeInstance != null) {
public void processInstanceCompleted(ProcessInstance processInstance) { removeEventListeners(); handleOutMappings(processInstance); if (processInstance.getState() == ProcessInstance.STATE_ABORTED) { String faultName = processInstance.getOutcome()==null?"":processInstance.getOutcome(); // handle exception as sub process failed with error code ExceptionScopeInstance exceptionScopeInstance = (ExceptionScopeInstance) resolveContextInstance(ExceptionScope.EXCEPTION_SCOPE, faultName); if (exceptionScopeInstance != null) { exceptionScopeInstance.handleException(faultName, processInstance.getFaultData()); if (getSubProcessNode() != null && !getSubProcessNode().isIndependent() && getSubProcessNode().isAbortParent()){ cancel(); } return; } else if (getSubProcessNode() != null && !getSubProcessNode().isIndependent() && getSubProcessNode().isAbortParent()){ ((ProcessInstance) getProcessInstance()).setState(ProcessInstance.STATE_ABORTED, faultName); return; } } // handle dynamic subprocess if (getNode() == null) { setMetaData("NodeType", "SubProcessNode"); } // if there were no exception proceed normally triggerCompleted(); }
final String processId, final Map<String, Object> parameters) { final SubProcessNodeInstance subProcessNodeInstance = new SubProcessNodeInstance(); subProcessNodeInstance.setNodeInstanceContainer(dynamicContext == null ? processInstance : dynamicContext); subProcessNodeInstance.setProcessInstance(processInstance); subProcessNodeInstance.setMetaData("NodeType", "SubProcessNode"); if (ksession instanceof StatefulKnowledgeSessionImpl) {
public void addEventListeners() { super.addEventListeners(); addProcessListener(); }
log.setReferenceId(((SubProcessNodeInstance) nodeInstance).getProcessInstanceId());
stream.writeLong(((SubProcessNodeInstance) nodeInstance).getProcessInstanceId()); List<Long> timerInstances = ((SubProcessNodeInstance) nodeInstance).getTimerInstances(); if (timerInstances != null) { stream.writeInt(timerInstances.size());
break; case SUBPROCESS_NODE : nodeInstance = new SubProcessNodeInstance(); ((SubProcessNodeInstance) nodeInstance).internalSetProcessInstanceId( _content.getSubProcess().getProcessInstanceId() ); if ( _content.getSubProcess().getTimerInstanceIdCount() > 0 ) { List<Long> timerInstances = new ArrayList<Long>(); timerInstances.add( _timerId ); ((SubProcessNodeInstance) nodeInstance).internalSetTimerInstances( timerInstances );
subProcessNodeInstance.internalSetProcessInstanceId(subProcessInstance.getId()); subProcessNodeInstance.triggerCompleted(); } else { subProcessNodeInstance.addEventListeners();
logEvent.setReferenceId(((SubProcessNodeInstance) nodeInstance).getProcessInstanceId());
} else if ( nodeInstance instanceof SubProcessNodeInstance ) { JBPMMessages.ProcessInstance.NodeInstanceContent.SubProcessNode.Builder _sp = JBPMMessages.ProcessInstance.NodeInstanceContent.SubProcessNode.newBuilder() .setProcessInstanceId( ((SubProcessNodeInstance) nodeInstance).getProcessInstanceId() ); List<Long> timerInstances = ((SubProcessNodeInstance) nodeInstance).getTimerInstances(); if ( timerInstances != null ) { for ( Long id : timerInstances ) {
nodeInstance = new SubProcessNodeInstance(); ((SubProcessNodeInstance) nodeInstance).internalSetProcessInstanceId(stream.readLong()); nbTimerInstances = stream.readInt(); if (nbTimerInstances > 0) { timerInstances.add(stream.readLong()); ((SubProcessNodeInstance) nodeInstance).internalSetTimerInstances(timerInstances);