private void setAdHocSubProcessProperties(final AdHocSubProcess subProcess, final Map<String, Object> properties) { if (subProcess.getOrdering().equals(AdHocOrdering.PARALLEL)) { properties.put(ADHOCORDERING, "Parallel"); } else if (subProcess.getOrdering().equals(AdHocOrdering.SEQUENTIAL)) { properties.put(ADHOCORDERING, "Sequential"); } else { // default to parallel properties.put(ADHOCORDERING, "Parallel"); } if (subProcess.getCompletionCondition() != null) { final FormalExpression expression = (FormalExpression) subProcess.getCompletionCondition(); final String language = Utils.getScriptLanguage(expression.getLanguage()); final String script = expression.getBody().replaceAll("\n", "\\\\n"); final ScriptTypeValue value = new ScriptTypeValue(language, script); properties.put(ADHOCCOMPLETIONCONDITION, new ScriptTypeTypeSerializer().serialize(value)); } }
protected void applyAdHocSubProcessProperties(AdHocSubProcess ahsp, Map<String, String> properties) { if (properties.get("adhocordering") != null) { if (properties.get("adhocordering").equals("Parallel")) { ahsp.setOrdering(AdHocOrdering.PARALLEL); } else { ahsp.setOrdering(AdHocOrdering.SEQUENTIAL); } } String adHocCompletionCondition = properties.get("adhoccompletioncondition"); if (adHocCompletionCondition != null) { ScriptTypeValue value = new ScriptTypeTypeSerializer().parse(adHocCompletionCondition); FormalExpression completionConditionExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); String completionExpression = value.getScript(); if (completionExpression == null || completionExpression.isEmpty()) { //default to autocomplete completionExpression = "autocomplete"; } completionConditionExpression.setBody(wrapInCDATABlock(completionExpression)); String languageFormat = Utils.getScriptLanguageFormat(value.getLanguage()); if (languageFormat == null) { //default to mvel languageFormat = "mvel"; } completionConditionExpression.setLanguage(languageFormat); ahsp.setCompletionCondition(completionConditionExpression); } }
@Override public boolean handle(FlowElement element, PathContextManager manager) { AdHocSubProcess adHoc = (AdHocSubProcess) element; List<FlowElement> flowElements = adHoc.getFlowElements(); for (FlowElement fElement : flowElements) { if (fElement instanceof Activity) { if (((Activity) fElement).getIncoming().isEmpty()) { manager.cloneGiven(manager.getContextFromStack()); boolean canBeFinsihed = manager.getContextFromStack().isCanBeFinished(); manager.getContextFromStack().setCanBeFinished(false); super.handle(fElement, manager); manager.getContextFromStack().setCanBeFinished(canBeFinsihed); List<SequenceFlow> out = getOutgoing(element); for (SequenceFlow flow : out) { manager.addToPath(flow, manager.getContextFromStack()); super.handle(flow.getTargetRef(), manager); } } } } return true; }
private BpmnNode convertAdHocSubProcess(org.eclipse.bpmn2.AdHocSubProcess subProcess) { Node<View<A>, Edge> node = delegate.factoryManager.newNode(subProcess.getId(), getAdhocSubprocessClass()); A definition = node.getContent().getDefinition(); AdHocSubProcessPropertyReader p = delegate.propertyReaderFactory.of(subProcess); definition.setGeneral(new BPMNGeneralSet(new Name(subProcess.getName()), new Documentation(p.getDocumentation()) )); definition.setProcessData(new ProcessData(new ProcessVariables(p.getProcessVariables()))); definition.setExecutionSet(new AdHocSubprocessTaskExecutionSet(new AdHocCompletionCondition(p.getAdHocCompletionCondition()), new AdHocOrdering(p.getAdHocOrdering()), new OnEntryAction(p.getOnEntryAction()), new OnExitAction(p.getOnExitAction()) )); definition.setSimulationSet(p.getSimulationSet()); node.getContent().setBounds(p.getBounds()); definition.setDimensionsSet(p.getRectangleDimensionsSet()); definition.setFontSet(p.getFontSet()); definition.setBackgroundSet(p.getBackgroundSet()); return BpmnNode.of(node); }
public String getAdHocOrdering() { return process.getOrdering().toString(); } }
public void setAdHocOrdering(org.kie.workbench.common.stunner.bpmn.definition.property.task.AdHocOrdering value) { process.setOrdering(AdHocOrdering.getByName(value.getValue())); }
public ScriptTypeValue getAdHocCompletionCondition() { FormalExpression completionCondition = (FormalExpression) process.getCompletionCondition(); return new ScriptTypeValue( Scripts.scriptLanguageFromUri(completionCondition.getLanguage()), completionCondition.getBody() ); }
public void setAdHocCompletionCondition(AdHocCompletionCondition adHocCompletionCondition) { FormalExpression e = bpmn2.createFormalExpression(); ScriptTypeValue s = adHocCompletionCondition.getValue(); e.setLanguage(scriptLanguageToUri(s.getLanguage())); e.setBody(asCData(s.getScript())); process.setCompletionCondition(e); } }
private SubProcessPropertyWriter convertAdHocSubprocessNode(Node<View<A>, ?> n) { org.eclipse.bpmn2.AdHocSubProcess process = bpmn2.createAdHocSubProcess(); process.setId(n.getUUID()); AdHocSubProcessPropertyWriter p = propertyWriterFactory.of(process); A definition = n.getContent().getDefinition(); BPMNGeneralSet general = definition.getGeneral(); p.setName(general.getName().getValue()); p.setDocumentation(general.getDocumentation().getValue()); ProcessData processData = definition.getProcessData(); p.setProcessVariables(processData.getProcessVariables()); AdHocSubprocessTaskExecutionSet executionSet = definition.getExecutionSet(); p.setAdHocCompletionCondition(executionSet.getAdHocCompletionCondition()); p.setAdHocOrdering(executionSet.getAdHocOrdering()); p.setOnEntryAction(executionSet.getOnEntryAction()); p.setOnExitAction(executionSet.getOnExitAction()); p.setSimulationSet(definition.getSimulationSet()); p.setBounds(n.getContent().getBounds()); return p; }
@Override public boolean handle(FlowElement element, PathContextManager manager) { AdHocSubProcess adHoc = (AdHocSubProcess) element; List<FlowElement> flowElements = adHoc.getFlowElements(); for (FlowElement fElement : flowElements) { if (fElement instanceof Activity) { if (((Activity) fElement).getIncoming().isEmpty()) { manager.cloneGiven(manager.getContextFromStack()); boolean canBeFinsihed = manager.getContextFromStack().isCanBeFinished(); manager.getContextFromStack().setCanBeFinished(false); super.handle(fElement, manager); manager.getContextFromStack().setCanBeFinished(canBeFinsihed); List<SequenceFlow> out = getOutgoing(element); for (SequenceFlow flow : out) { manager.addToPath(flow, manager.getContextFromStack()); super.handle(flow.getTargetRef(), manager); } } } } return true; }
@Override public boolean handle(FlowElement element, PathContextManager manager) { AdHocSubProcess adHoc = (AdHocSubProcess) element; List<FlowElement> flowElements = adHoc.getFlowElements(); for (FlowElement fElement : flowElements) { if (fElement instanceof Activity) { if (((Activity) fElement).getIncoming().size() == 0) { manager.cloneGiven(manager.getContextFromStack()); boolean canBeFinsihed = manager.getContextFromStack().isCanBeFinished(); manager.getContextFromStack().setCanBeFinished(false); super.handle(fElement, manager); manager.getContextFromStack().setCanBeFinished(canBeFinsihed); List<SequenceFlow> out = getOutgoing(element); for (SequenceFlow flow : out) { manager.addToPath(flow, manager.getContextFromStack()); super.handle(flow.getTargetRef(), manager); } } } } return true; }