static Definitions makeDefinitions() { Definitions d = bpmn2.createDefinitions(); BPMNPlane bpmnPlane = di.createBPMNPlane(); BPMNDiagram bpmnDiagram = di.createBPMNDiagram(); bpmnDiagram.setPlane(bpmnPlane); d.getDiagrams().add(bpmnDiagram); d.getRootElements().add(bpmn2.createProcess()); return d; } }
public Definitions createAndInitResource(URI uri) { Resource resource = createResource(uri); Bpmn2Factory factory = Bpmn2Factory.eINSTANCE; Definitions definitions = factory.createDefinitions(); DocumentRoot docummentRoot = factory.createDocumentRoot(); docummentRoot.setDefinitions(definitions); resource.getContents().add(docummentRoot); return definitions; } }
public DataInputAssociation getDataInputAssociation() { DataInputAssociation dataInputAssociation = bpmn2.createDataInputAssociation(); Assignment assignment = bpmn2.createAssignment(); String id = getDataInput().getId(); FormalExpression toExpr = bpmn2.createFormalExpression(); toExpr.setBody(id); assignment.setTo(toExpr); FormalExpression fromExpr = bpmn2.createFormalExpression(); // this should be handled **outside** the marshallers! String decodedExpression = decode(expression); String cdataExpression = asCData(decodedExpression); fromExpr.setBody(cdataExpression); assignment.setFrom(fromExpr); dataInputAssociation .getAssignment().add(assignment); dataInputAssociation .setTargetRef(getDataInput()); return dataInputAssociation; }
private CatchEventPropertyWriter createCatchEventPropertyWriter(Node n) { return isDocked(n) ? propertyWriterFactory.of(bpmn2.createBoundaryEvent()) : propertyWriterFactory.of(bpmn2.createIntermediateCatchEvent()); }
private Assignment assignment(String from, String to) { Assignment assignment = bpmn2.createAssignment(); FormalExpression fromExpr = bpmn2.createFormalExpression(); fromExpr.setBody(asCData(from)); assignment.setFrom(fromExpr); FormalExpression toExpr = bpmn2.createFormalExpression(); toExpr.setBody(to); assignment.setTo(toExpr); return assignment; }
InputOutputSpecification iospec = Bpmn2Factory.eINSTANCE.createInputOutputSpecification(); sp.setIoSpecification(iospec); DataInputAssociation dia = Bpmn2Factory.eINSTANCE.createDataInputAssociation(); if (sp.getIoSpecification() != null && sp.getIoSpecification().getDataOutputs() != null) { List<DataInput> dataInputs = sp.getIoSpecification().getDataInputs(); Assignment a = Bpmn2Factory.eINSTANCE.createAssignment(); FormalExpression fromExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); if (assignmentParts.length > 1) { String replacer = decodeAssociationValue(assignmentParts[1]); FormalExpression toExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); toExpression.setBody(dia.getTargetRef().getId()); a.setFrom(fromExpression); DataOutputAssociation doa = Bpmn2Factory.eINSTANCE.createDataOutputAssociation(); for (DataOutput dout : dataOutputs) { if (dout.getId().equals(sp.getId() + "_" + fromPart + "OutputX")) { ItemAwareElement ie = Bpmn2Factory.eINSTANCE.createItemAwareElement(); ie.setId(assignmentParts[1]); doa.setTargetRef(ie); sp.getDataOutputAssociations().add(doa); } else if (isDataInput) { DataInputAssociation dia = Bpmn2Factory.eINSTANCE.createDataInputAssociation(); ItemAwareElement ie = Bpmn2Factory.eINSTANCE.createItemAwareElement(); ie.setId(fromPart);
String[] allActors = properties.get("actors").split(",\\s*"); for (String actor : allActors) { PotentialOwner po = Bpmn2Factory.eINSTANCE.createPotentialOwner(); ResourceAssignmentExpression rae = Bpmn2Factory.eINSTANCE.createResourceAssignmentExpression(); FormalExpression fe = Bpmn2Factory.eINSTANCE.createFormalExpression(); fe.setBody(actor); rae.setExpression(fe); InputOutputSpecification iospec = Bpmn2Factory.eINSTANCE.createInputOutputSpecification(); task.setIoSpecification(iospec); DataInput d = Bpmn2Factory.eINSTANCE.createDataInput(); d.setId(task.getId() + "_" + "GroupId" + "InputX"); d.setName("GroupId"); foundInput = d; if (task.getIoSpecification().getInputSets() == null || task.getIoSpecification().getInputSets().size() < 1) { InputSet inset = Bpmn2Factory.eINSTANCE.createInputSet(); task.getIoSpecification().getInputSets().add(inset); DataInputAssociation dia = Bpmn2Factory.eINSTANCE.createDataInputAssociation(); dia.setTargetRef(foundInput); Assignment a = Bpmn2Factory.eINSTANCE.createAssignment(); FormalExpression groupFromExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); groupFromExpression.setBody(wrapInCDATABlock(properties.get("groupid"))); FormalExpression groupToExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); groupToExpression.setBody(foundInput.getId()); a.setFrom(groupFromExpression);
String miDataOutput = (multiValueParts[3].equals(" ") ? "" : multiValueParts[3]); String miCompletionCondition = (multiValueParts[4].equals(" ") ? "" : multiValueParts[4]); MultiInstanceLoopCharacteristics loopCharacteristics = Bpmn2Factory.eINSTANCE.createMultiInstanceLoopCharacteristics(); if (miCollectionInput != null && miCollectionInput.length() > 0) { List<Property> properties = process.getProperties(); for (Property prop : properties) { if (prop.getId() != null && prop.getId().equals(miCollectionInput)) { DataInput miCollectionInputDI = Bpmn2Factory.eINSTANCE.createDataInput(); miCollectionInputDI.setName("miinputCollection"); ItemDefinition miCollectionInputDIItemDefinition = this.getMessageItemDefinition(def.getRootElements(), task.getIoSpecification().getDataInputs().add(miCollectionInputDI); if (task.getIoSpecification().getInputSets() == null || task.getIoSpecification().getInputSets().size() < 1) { InputSet inset = Bpmn2Factory.eINSTANCE.createInputSet(); task.getIoSpecification().getInputSets().add(inset); DataInputAssociation miCollectionInputDataInputAssociation = Bpmn2Factory.eINSTANCE.createDataInputAssociation(); miCollectionInputDataInputAssociation.getSourceRef().add(prop); miCollectionInputDataInputAssociation.setTargetRef(miCollectionInputDI); for (Property prop : properties) { if (prop.getId() != null && prop.getId().equals(miCollectionOutput)) { DataOutput miCollectionOutputDI = Bpmn2Factory.eINSTANCE.createDataOutput(); miCollectionOutputDI.setName("mioutputCollection"); ItemDefinition miCollectionOutputDIItemDefinition = this.getMessageItemDefinition(def.getRootElements(), task.getIoSpecification().getDataOutputs().add(miCollectionOutputDI); if (task.getIoSpecification().getOutputSets() == null || task.getIoSpecification().getOutputSets().size() < 1) { OutputSet outset = Bpmn2Factory.eINSTANCE.createOutputSet();
taskNameDataInput = Bpmn2Factory.eINSTANCE.createDataInput(); taskNameDataInput.setId(task.getId() + "_TaskNameInputX"); taskNameDataInput.setName("TaskName"); taskNameDataInput.getAnyAttribute().add(extensionEntry); if (task.getIoSpecification() == null) { InputOutputSpecification iospec = Bpmn2Factory.eINSTANCE.createInputOutputSpecification(); task.setIoSpecification(iospec); DataInputAssociation taskNameDataInputAssociation = Bpmn2Factory.eINSTANCE.createDataInputAssociation(); taskNameDataInputAssociation.setTargetRef(taskNameDataInput); Assignment taskNameAssignment = Bpmn2Factory.eINSTANCE.createAssignment(); FormalExpression fromExp = Bpmn2Factory.eINSTANCE.createFormalExpression(); fromExp.setBody(properties.get("taskname").replaceAll("&", "").replaceAll(" ", "")); taskNameAssignment.setFrom(fromExp); FormalExpression toExp = Bpmn2Factory.eINSTANCE.createFormalExpression(); toExp.setBody(task.getId() + "_TaskNameInputX"); taskNameAssignment.setTo(toExp); DataInputAssociation dia = Bpmn2Factory.eINSTANCE.createDataInputAssociation(); boolean foundTaskName = false; if (task.getIoSpecification() != null && task.getIoSpecification().getDataOutputs() != null) { DataInput assignmentTaskNameDataInput = Bpmn2Factory.eINSTANCE.createDataInput(); assignmentTaskNameDataInput.setId(task.getId() + "_TaskNameInputX"); assignmentTaskNameDataInput.setName("TaskName"); if (task.getIoSpecification() == null) {
if (fe instanceof DataObject) { DataObject da = (DataObject) fe; ItemDefinition itemdef = Bpmn2Factory.eINSTANCE.createItemDefinition(); itemdef.setId("_" + da.getId() + "Item"); Iterator<FeatureMap.Entry> iter = da.getAnyAttribute().iterator(); Task task = (Task) as.getTargetRef(); if (task.getIoSpecification() == null) { InputOutputSpecification iospec = Bpmn2Factory.eINSTANCE.createInputOutputSpecification(); task.setIoSpecification(iospec); InputSet inset = Bpmn2Factory.eINSTANCE.createInputSet(); task.getIoSpecification().getInputSets().add(inset); DataInput d = Bpmn2Factory.eINSTANCE.createDataInput(); d.setId(task.getId() + "_" + da.getId() + "InputX"); d.setName(da.getId() + "InputX"); task.getIoSpecification().getDataInputs().add(d); task.getIoSpecification().getInputSets().get(0).getDataInputRefs().add(d); DataInputAssociation dia = Bpmn2Factory.eINSTANCE.createDataInputAssociation(); dia.setTargetRef(d); dia.getSourceRef().add(da); DataInput datain = Bpmn2Factory.eINSTANCE.createDataInput(); datain.setId(te.getId() + "_" + da.getId() + "InputX"); datain.setName(da.getId() + "InputX"); te.getDataInputs().add(datain); if (te.getInputSet() == null) { InputSet inset = Bpmn2Factory.eINSTANCE.createInputSet();
if (properties.get("datainput") != null && properties.get("datainput").trim().length() > 0) { String[] allDataInputs = properties.get("datainput").split(",\\s*"); InputSet inset = Bpmn2Factory.eINSTANCE.createInputSet(); for (String dataInput : allDataInputs) { if (dataInput.trim().length() > 0) { DataInput nextInput = Bpmn2Factory.eINSTANCE.createDataInput(); String[] dataInputParts = dataInput.split(":\\s*"); if (dataInputParts.length == 2) { DataInputAssociation dia = Bpmn2Factory.eINSTANCE.createDataInputAssociation(); if (event.getInputSet() != null) { List<DataInput> dataInputs = event.getInputSet().getDataInputRefs(); Assignment a = Bpmn2Factory.eINSTANCE.createAssignment(); FormalExpression fromExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); if (assignmentParts.length > 1) { String replacer = decodeAssociationValue(assignmentParts[1]); FormalExpression toExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); toExpression.setBody(dia.getTargetRef().getId()); a.setFrom(fromExpression); DataInputAssociation dia = Bpmn2Factory.eINSTANCE.createDataInputAssociation(); ItemAwareElement ie = Bpmn2Factory.eINSTANCE.createItemAwareElement(); ie.setId(fromPart); dia.getSourceRef().add(ie);
if (assignment.contains("=")) { String[] assignmentParts = assignment.split("=\\s*"); DataInputAssociation dia = Bpmn2Factory.eINSTANCE.createDataInputAssociation(); String fromPart = assignmentParts[0]; if (fromPart.startsWith("[din]")) { Assignment a = Bpmn2Factory.eINSTANCE.createAssignment(); FormalExpression fromExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); if (assignmentParts.length > 1) { String replacer = decodeAssociationValue(assignmentParts[1]); FormalExpression toExpression = Bpmn2Factory.eINSTANCE.createFormalExpression(); toExpression.setBody(dia.getTargetRef().getId()); a.setFrom(fromExpression); DataOutputAssociation doa = Bpmn2Factory.eINSTANCE.createDataOutputAssociation(); for (DataOutput dout : dataOutputs) { if (dout.getId().equals(callActivity.getId() + "_" + fromPart + "OutputX")) { ItemAwareElement ie = Bpmn2Factory.eINSTANCE.createItemAwareElement(); ie.setId(assignmentParts[1]); doa.setTargetRef(ie); DataInputAssociation dia = Bpmn2Factory.eINSTANCE.createDataInputAssociation(); ItemAwareElement ie = Bpmn2Factory.eINSTANCE.createItemAwareElement(); ie.setId(fromPart); dia.getSourceRef().add(ie);
if (childElements == null || childElements.size() < 1) { if (rootLevelProcess == null) { rootLevelProcess = Bpmn2Factory.eINSTANCE.createProcess(); Property prop = Bpmn2Factory.eINSTANCE.createProperty(); ItemDefinition itemdef = Bpmn2Factory.eINSTANCE.createItemDefinition(); || child instanceof Lane || child instanceof CallActivity || child instanceof TextAnnotation) { if (rootLevelProcess == null) { rootLevelProcess = Bpmn2Factory.eINSTANCE.createProcess(); Property prop = Bpmn2Factory.eINSTANCE.createProperty(); ItemDefinition itemdef = Bpmn2Factory.eINSTANCE.createItemDefinition(); if (child instanceof Lane) { if (((Process) baseElt).getLaneSets().isEmpty()) { ((Process) baseElt).getLaneSets().add(Bpmn2Factory.eINSTANCE.createLaneSet());
@Before public void before() { this.variableScope = new FlatVariableScope(); this.p = new ProcessPropertyWriter( bpmn2.createProcess(), variableScope); }
@Test public void testOf() throws Exception { final CallActivityPropertyWriter propertyWriter = tested.of(bpmn2.createCallActivity()); assertTrue(propertyWriter instanceof CaseManagementCallActivityPropertyWriter); } }
if (properties.get("dataoutput") != null && !"".equals(properties.get("dataoutput"))) { String[] allDataOutputs = properties.get("dataoutput").split(",\\s*"); OutputSet outSet = Bpmn2Factory.eINSTANCE.createOutputSet(); for (String dataOutput : allDataOutputs) { if (dataOutput.trim().length() > 0) { DataOutput nextOutput = Bpmn2Factory.eINSTANCE.createDataOutput(); String[] doutputParts = dataOutput.split(":\\s*"); if (doutputParts.length == 2) { fromPart.length()); DataOutputAssociation doa = Bpmn2Factory.eINSTANCE.createDataOutputAssociation(); ItemAwareElement e = Bpmn2Factory.eINSTANCE.createItemAwareElement(); e.setId(associationParts[1]); doa.setTargetRef(e);
public void setCompletionCondition(String expression) { FormalExpression formalExpression = bpmn2.createFormalExpression(); formalExpression.setBody(asCData(expression)); this.miloop.setCompletionCondition(formalExpression); } }
@Test public void addChildElement() { SubProcess process = (SubProcess) p.getElement(); BoundaryEventPropertyWriter boundaryEventPropertyWriter = new BoundaryEventPropertyWriter(bpmn2.createBoundaryEvent(), variableScope); UserTaskPropertyWriter userTaskPropertyWriter = new UserTaskPropertyWriter(bpmn2.createUserTask(), variableScope); p.addChildElement(boundaryEventPropertyWriter); p.addChildElement(userTaskPropertyWriter); // boundary event should always occur after other nodes (compat with old marshallers) assertThat(process.getFlowElements().get(0)).isEqualTo(userTaskPropertyWriter.getFlowElement()); assertThat(process.getFlowElements().get(1)).isEqualTo(boundaryEventPropertyWriter.getFlowElement()); }
public void setActors(Actors actors) { for (String actor : fromActorString(actors.getValue())) { PotentialOwner potentialOwner = bpmn2.createPotentialOwner(); potentialOwner.setId(UUID.randomUUID().toString()); FormalExpression formalExpression = bpmn2.createFormalExpression(); formalExpression.setBody(actor); ResourceAssignmentExpression resourceAssignmentExpression = bpmn2.createResourceAssignmentExpression(); resourceAssignmentExpression.setExpression(formalExpression); potentialOwner.setResourceAssignmentExpression(resourceAssignmentExpression); task.getResources().add(potentialOwner); } }
public Definitions toDefinitions() { Definitions definitions = bpmn2.createDefinitions(); DefinitionsPropertyWriter p = propertyWriterFactory.of(definitions); ProcessPropertyWriter pp = processConverter.convertProcess(); p.setExporter("jBPM Process Modeler"); p.setExporterVersion("2.0"); p.setProcess(pp.getProcess()); p.setDiagram(pp.getBpmnDiagram()); p.setRelationship(pp.getRelationship()); p.addAllRootElements(pp.getItemDefinitions()); p.addAllRootElements(pp.getRootElements()); return definitions; } }