public void setProcess(final Process process) { this.processId = process.getId(); this.process = ( Process ) process; }
public String toString() { final StringBuilder b = new StringBuilder( "ProcessInstance " ); b.append( getId() ); b.append( " [processId=" ); b.append( this.process.getId() ); b.append( ",state=" ); b.append( this.state ); b.append( "]" ); return b.toString(); }
public static String findLatestProcessByName(Collection<Process> processes, final String processName, Comparator<Process> comparator) { if (processes == null || processName == null) { return null; } Process highestVersionProcess = Collections.max(processes, comparator); if (highestVersionProcess != null && processName.equals(highestVersionProcess.getName())) { return highestVersionProcess.getId(); } return null; }
private String createActivationRule(Process process, Node node) { return "rule \"RuleFlow-Activate-" + process.getId() + "-" + node.getMetaData().get("UniqueId") + "\" \n" + " \n" + " when \n" + " org.kie.api.runtime.process.CaseData(definitionId == \"" + process.getId() + "\") \n" + " " + node.getMetaData().get("customActivationExpression") + "\n" + " then \n" + " org.jbpm.casemgmt.api.CaseService caseService = (org.jbpm.casemgmt.api.CaseService) org.jbpm.services.api.service.ServiceRegistry.get().service(org.jbpm.services.api.service.ServiceRegistry.CASE_SERVICE); \n" + " caseService.triggerAdHocFragment(org.jbpm.casemgmt.api.CaseUtils.getCaseId(kcontext.getKieRuntime()), \"" + node.getMetaData().get("customActivationFragmentName") +"\", null); \n" + "end \n\n"; }
public void setContextContainer(ContextContainer contextContainer) { assert contextContainer instanceof NodeContainer : "CompensationScope context container instance is NOT an instance of a node container! " + "(" + contextContainer.getClass().getSimpleName() + ")"; super.setContextContainer(contextContainer); if( contextContainer instanceof NodeImpl ) { containerId = (String) ((NodeImpl) contextContainer).getMetaData("UniqueId"); } else if( contextContainer instanceof RuleFlowProcess ) { containerId = (String) ((Process) contextContainer).getId(); } }
private String createEventSubprocessStateRule(Process process, CompositeNode compositeNode, ConstraintTrigger trigger) { String condition = trigger.getConstraint(); if (condition == null || condition.trim().length() == 0) { return ""; } else { return "rule \"RuleFlowStateEventSubProcess-Event-" + process.getId() + "-" + compositeNode.getUniqueId() + "\" @Propagation(EAGER) \n" + " ruleflow-group \"DROOLS_SYSTEM\" \n" + " when \n" + " " + condition + "\n" + " then \n" + "end \n\n"; } }
private String createAdHocCompletionRule(Process process, DynamicNode dynamicNode) { return "rule \"RuleFlow-AdHocComplete-" + process.getId() + "-" + dynamicNode.getUniqueId() + "\" @Propagation(EAGER) \n" + " ruleflow-group \"DROOLS_SYSTEM\" \n" + " when \n" + " " + dynamicNode.getCompletionExpression() + "\n" + " then \n" + "end \n\n"; }
private String createMilestoneRule(Process process, MilestoneNode milestone) { return "rule \"RuleFlow-Milestone-" + process.getId() + "-" + milestone.getUniqueId() + "\" @Propagation(EAGER) \n" + " ruleflow-group \"DROOLS_SYSTEM\" \n" + " when \n" + " " + milestone.getConstraint() + "\n" + " then \n" + "end \n\n"; }
private String createAdHocActivationRule(Process process, DynamicNode dynamicNode) { return "rule \"RuleFlow-AdHocActivate-" + process.getId() + "-" + dynamicNode.getUniqueId() + "\" @Propagation(EAGER) \n" + " ruleflow-group \"DROOLS_SYSTEM\" \n" + " when \n" + " " + dynamicNode.getActivationExpression() + "\n" + " then \n" + "end \n\n"; }
private String createStartConstraintRule(Process process, NodeContainer nodeContainer, ConstraintTrigger trigger) { if (nodeContainer instanceof EventSubProcessNode) { return createEventSubprocessStateRule(process, (EventSubProcessNode) nodeContainer, trigger); } String result = "rule \"RuleFlow-Start-" + process.getId() + "\" @Propagation(EAGER) \n" + (trigger.getHeader() == null ? "" : " " + trigger.getHeader() + " \n") + " when\n" + " " + trigger.getConstraint() + "\n" + " then\n"; Map<String, String> inMappings = trigger.getInMappings(); if ( inMappings != null && !inMappings.isEmpty() ) { result += " java.util.Map params = new java.util.HashMap();\n"; for ( Map.Entry<String, String> entry : inMappings.entrySet() ) { result += " params.put(\"" + entry.getKey() + "\", " + entry.getValue() + ");\n"; } result += " ((org.jbpm.process.instance.ProcessRuntimeImpl)((org.drools.core.common.InternalWorkingMemory)kcontext.getKnowledgeRuntime()).getProcessRuntime()).startProcess(\"" + process.getId() + "\", params, \"conditional\");\n" + "end\n\n"; } else { result += " ((org.jbpm.process.instance.ProcessRuntimeImpl)((org.drools.core.common.InternalWorkingMemory)kcontext.getKnowledgeRuntime()).getProcessRuntime()).startProcess(\"" + process.getId() + "\", null, \"conditional\");\n" + "end\n\n"; } return result; }
public String toString() { return "Process '" + process.getName() + "' [" + process.getId() + "]: " + getMessage(); }
private String createEventStateRule(Process process, EventNode event) { String condition = (String) event.getMetaData("Condition"); String attachedTo = (String) event.getMetaData("AttachedTo"); if (condition == null || condition.trim().length() == 0) { return ""; } else { return "rule \"RuleFlowStateEvent-" + process.getId() + "-" + event.getUniqueId() + "-" + attachedTo + "\" @Propagation(EAGER) \n" + " ruleflow-group \"DROOLS_SYSTEM\" \n" + " when \n" + " " + condition + "\n" + " then \n" + "end \n\n"; } }
public int compare(Process o1, Process o2) { // first match by process name if (o1.getName().equals(processName) && o2.getName().equals(processName)) { // then match on version try { if( o1.getVersion() != null && o2.getVersion() != null ) { if ((Double.valueOf(o1.getVersion()) > Double.valueOf(o2.getVersion()))) { return 1; } else { return -1; } } else if( o1.getVersion() != null ) { return 1; } else { return o1.getId().compareTo(o2.getId()); } } catch (NumberFormatException e) { throw new IllegalArgumentException("Could not parse version: " + o1.getVersion() + " " + o2.getVersion(), e); } } else if (o1.getName().equals(processName)) { return 1; } return -1; } }
private String createStateRule(Process process, StateNode state, ConnectionRef key, Constraint constraint) { if (constraint.getConstraint() == null || constraint.getConstraint().trim().length() == 0) { return ""; } else { return "rule \"RuleFlowStateNode-" + process.getId() + "-" + state.getUniqueId() + "-" + key.getNodeId() + "-" + key.getToType() + "\" @Propagation(EAGER) \n" + " ruleflow-group \"DROOLS_SYSTEM\" \n" + " when \n" + " " + state.getConstraints().get(key).getConstraint() + "\n" + " then \n" + "end \n\n"; } }
private String createSplitRule(Process process, Connection connection, String constraint) { return "rule \"RuleFlow-Split-" + process.getId() + "-" + ((org.jbpm.workflow.core.Node) connection.getFrom()).getUniqueId() + "-" + ((org.jbpm.workflow.core.Node) connection.getTo()).getUniqueId() + "-" + connection.getToType() + "\" @Propagation(EAGER) \n" + " ruleflow-group \"DROOLS_SYSTEM\" \n" + " when \n" + " " + constraint + "\n" + " then \n" + "end \n\n"; }
public Object end(final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException { parser.endElementBuilder(); ProcessInfo processInfo = (ProcessInfo) parser.getCurrent(); List<Process> processes = ((ProcessBuildData) parser.getData()).getProcesses(); RuleFlowProcess process = null; for (Process p : processes) { if (p.getId() != null && p.getId().equals(processInfo.getProcessRef())) { process = (RuleFlowProcess) p; break; } } if (process != null) { for (NodeInfo nodeInfo: processInfo.getNodeInfos()) { processNodeInfo(nodeInfo, process.getNodes()); } postProcessNodeOffset(process.getNodes(), 0, 0); for (ConnectionInfo connectionInfo: processInfo.getConnectionInfos()) { if (connectionInfo.getBendpoints() != null) { processConnectionInfo(connectionInfo, process.getNodes()); } } } return processInfo; }
StartProcessEventListener listener = new StartProcessEventListener( process.getId(), filters, trigger.getInMappings(),
@Test public void testProcessWithBrokenItemDefinitionUri() throws Exception { InputStream inputBpmn = getClass().getResourceAsStream("/BPMN2-BrokenStructureRef.bpmn2"); XmlProcessDumper dumper = XmlProcessDumperFactory.getXmlProcessDumperFactoryService().newXmlProcessDumper(); Assert.assertNotNull(dumper); String processXml = new String(IoUtils.readBytesFromInputStream(inputBpmn), "UTF-8"); Assert.assertNotNull(processXml); org.kie.api.definition.process.Process proc = dumper.readProcess(processXml); Assert.assertNotNull(proc); Assert.assertEquals("BrokenStructureRef", proc.getId()); } }
if (validator == null) { logger.warn("Could not find validator for process {}.", ((Process)process).getType()); logger.warn("Continuing without validation of the process {} [{}]", process.getName(), process.getId()); } else { ProcessValidationError[] errors = validator.validateProcess( (WorkflowProcess) process ); processDescr.setName(process.getPackageName() + "." + process.getName()); processDescr.setResource( resource ); processDescr.setProcessId( process.getId() ); DialectCompiletimeRegistry dialectRegistry = pkgRegistry.getDialectCompiletimeRegistry(); Dialect dialect = dialectRegistry.getDialect( "java" ); Process duplicateProcess = rpkg.getRuleFlows().get(process.getId()); if (duplicateProcess != null) { Resource duplicatedResource = duplicateProcess.getResource(); } else { this.errors.add( new ParserError( resource, "Process with same id already exists: " + process.getId(), -1, -1 ) );
if (session != null) { if (session.getProcessInstance(workItem.getProcessInstanceId()) != null) { taskData.setProcessId(session.getProcessInstance(workItem.getProcessInstanceId()).getProcess().getId()); String deploymentId = ((WorkItemImpl) workItem).getDeploymentId(); taskData.setDeploymentId(deploymentId);