@Override public String getDocumentation() { return task.getDocumentation() .stream() .findFirst() .map(Documentation::getText) .orElse(""); }
public AssignmentsInfo getAssignmentsInfo() { Optional<InputOutputSpecification> ioSpecification = Optional.ofNullable(task.getIoSpecification()); AssignmentsInfo info = AssignmentsInfos.of( ioSpecification.map(InputOutputSpecification::getDataInputs) .orElse(Collections.emptyList()), task.getDataInputAssociations(), ioSpecification.map(InputOutputSpecification::getDataOutputs) .orElse(Collections.emptyList()), task.getDataOutputAssociations(), ioSpecification.isPresent() ); // do not break compatibility with old marshallers: return // empty delimited fields instead of empty string if (info.getValue().isEmpty()) { info.setValue("||||"); } return info; }
public static OnEntryAction onEntry(Task task) { return new OnEntryAction(onEntry(task.getExtensionValues())); }
private InputOutputSpecification getIoSpecification(Task element) { InputOutputSpecification ioSpecification = element.getIoSpecification(); if (ioSpecification == null) { ioSpecification = bpmn2.createInputOutputSpecification(); element.setIoSpecification(ioSpecification); } List<InputSet> inputSets = ioSpecification.getInputSets(); if (inputSets.isEmpty()) { inputSets.add(bpmn2.createInputSet()); } return ioSpecification; }
if (task instanceof BusinessRuleTask) { taskType = "Business Rule"; Iterator<FeatureMap.Entry> iter = task.getAnyAttribute().iterator(); while (iter.hasNext()) { FeatureMap.Entry entry = iter.next(); List<ResourceRole> roles = task.getResources(); StringBuilder sb = new StringBuilder(); for (ResourceRole role : roles) { String customAsyncMetaData = Utils.getMetaDataValue(task.getExtensionValues(), "customAsync"); String customAsync = (customAsyncMetaData != null && customAsyncMetaData.length() > 0) ? customAsyncMetaData : "false"; String customAutoStartMetaData = Utils.getMetaDataValue(task.getExtensionValues(), "customAutoStart"); String customAutoStart = (customAutoStartMetaData != null && customAutoStartMetaData.length() > 0) ? customAutoStartMetaData : "false"; if (task instanceof UserTask && task.getIoSpecification() != null && task.getIoSpecification().getDataInputs() != null) { List<DataInput> taskDataInputs = task.getIoSpecification().getDataInputs(); for (DataInput din : taskDataInputs) { if (din.getName() != null && din.getName().equals("TaskName")) { List<DataInputAssociation> taskDataInputAssociations = task.getDataInputAssociations(); for (DataInputAssociation dia : taskDataInputAssociations) { if (dia.getTargetRef() != null && dia.getTargetRef().getId().equals(din.getId()) && Iterator<FeatureMap.Entry> iter = task.getAnyAttribute().iterator(); while (iter.hasNext()) { FeatureMap.Entry entry = iter.next();
String preProcessingData) { if (properties.get("name") != null) { task.setName(StringEscapeUtils.escapeXml(properties.get("name")).replaceAll("\\r\\n|\\r|\\n", " ")); } else { task.setName(""); "").replaceAll(" ", "")); task.getAnyAttribute().add(extensionEntry); taskNameDataInput.setId(task.getId() + "_TaskNameInputX"); taskNameDataInput.setName("TaskName"); "String"); taskNameDataInput.getAnyAttribute().add(extensionEntry); if (task.getIoSpecification() == null) { InputOutputSpecification iospec = Bpmn2Factory.eINSTANCE.createInputOutputSpecification(); task.setIoSpecification(iospec); task.getIoSpecification().getDataInputs().add(taskNameDataInput); taskNameAssignment.setFrom(fromExp); FormalExpression toExp = Bpmn2Factory.eINSTANCE.createFormalExpression(); toExp.setBody(task.getId() + "_TaskNameInputX"); taskNameAssignment.setTo(toExp); taskNameDataInputAssociation.getAssignment().add(taskNameAssignment); task.getDataInputAssociations().add(taskNameDataInputAssociation);
if (fe instanceof Task) { Task task = (Task) fe; Iterator<FeatureMap.Entry> iter = task.getAnyAttribute().iterator(); while (iter.hasNext()) { FeatureMap.Entry entry = iter.next(); prop.getId()); miCollectionInputDI.setItemSubjectRef(miCollectionInputDIItemDefinition); 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); task.getIoSpecification().getInputSets().get(0).getDataInputRefs().add(miCollectionInputDI); loopCharacteristics.setLoopDataInputRef(miCollectionInputDI); DataInputAssociation miCollectionInputDataInputAssociation = Bpmn2Factory.eINSTANCE.createDataInputAssociation(); miCollectionInputDataInputAssociation.getSourceRef().add(prop); miCollectionInputDataInputAssociation.setTargetRef(miCollectionInputDI); task.getDataInputAssociations().add(miCollectionInputDataInputAssociation); break; prop.getId()); miCollectionOutputDI.setItemSubjectRef(miCollectionOutputDIItemDefinition); task.getIoSpecification().getDataOutputs().add(miCollectionOutputDI); if (task.getIoSpecification().getOutputSets() == null || task.getIoSpecification().getOutputSets().size() < 1) { OutputSet outset = Bpmn2Factory.eINSTANCE.createOutputSet(); task.getIoSpecification().getOutputSets().add(outset); task.getIoSpecification().getOutputSets().get(0).getDataOutputRefs().add(miCollectionOutputDI);
if (as.getTargetRef() instanceof Task) { Task task = (Task) as.getTargetRef(); if (task.getIoSpecification() == null) { InputOutputSpecification iospec = Bpmn2Factory.eINSTANCE.createInputOutputSpecification(); task.setIoSpecification(iospec); if (task.getIoSpecification().getInputSets() == null || task.getIoSpecification().getInputSets().size() < 1) { InputSet inset = Bpmn2Factory.eINSTANCE.createInputSet(); task.getIoSpecification().getInputSets().add(inset); InputSet inSet = task.getIoSpecification().getInputSets().get(0); boolean foundDataInput = false; for (DataInput dataInput : inSet.getDataInputRefs()) { if (dataInput.getId().equals(task.getId() + "_" + da.getId() + "InputX")) { foundDataInput = true; 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); task.getDataInputAssociations().add(dia); if (as.getSourceRef() instanceof Task) { Task task = (Task) as.getSourceRef(); if (task.getIoSpecification() == null) { InputOutputSpecification iospec = Bpmn2Factory.eINSTANCE.createInputOutputSpecification();
public FlowNode mockNode(String id, Bounds bounds) { Task node = bpmn2.createTask(); node.setId(id); BPMNShape shape = di.createBPMNShape(); shape.setBounds(bounds); shape.setBpmnElement(node); definitionResolver.getPlane().getPlaneElement().add(shape); return node; }
@Test public void testBasicMarshall() throws Exception { Diagram<Graph, Metadata> d = unmarshall(newMarshaller, BPMN_SERVICE_TASK_PROPERTIES_FILE_PATH); Definitions definitions = convertToDefinitions(d); org.eclipse.bpmn2.Task serviceTask = ((Process) definitions.getRootElements().get(0)) .getFlowElements() .stream() .filter(org.eclipse.bpmn2.Task.class::isInstance) .map(org.eclipse.bpmn2.Task.class::cast) .findFirst().get(); assertEquals("Custom Email", serviceTask.getName()); assertEquals("<![CDATA[This is an email task]]>", serviceTask.getDocumentation().get(0).getText()); }
@Test public void shouldCreateOneInputSet() { Task task = bpmn2.createTask(); ActivityPropertyWriter activityPropertyWriter = new ActivityPropertyWriter(task, new FlatVariableScope()); activityPropertyWriter.setAssignmentsInfo(new AssignmentsInfo( "|A:String|||" )); List<InputSet> inputSets = task.getIoSpecification().getInputSets(); assertEquals(1, inputSets.size()); } }
public SimulationSet getSimulationSet() { return definitionResolver.resolveSimulationParameters(task.getId()) .map(SimulationSets::of) .orElse(new SimulationSet()); } }
Optional<String> getStringValue(Task element) { for (DataInputAssociation din : element.getDataInputAssociations()) { DataInput targetRef = (DataInput) (din.getTargetRef()); if (targetRef.getName().equalsIgnoreCase(name) && !din.getAssignment().isEmpty()) { Assignment assignment = din.getAssignment().get(0); return Optional.of(evaluate(assignment).toString()); } } return Optional.empty(); }
private PropertyWriter noneTask(Node<View<NoneTask>, ?> n) { Task task = bpmn2.createTask(); task.setId(n.getUUID()); NoneTask definition = n.getContent().getDefinition(); ActivityPropertyWriter p = propertyWriterFactory.of(task); TaskGeneralSet general = definition.getGeneral(); p.setName(general.getName().getValue()); p.setDocumentation(general.getDocumentation().getValue()); p.setBounds(n.getContent().getBounds()); p.setSimulationSet(definition.getSimulationSet()); return p; } }
@Test public void shouldReuseInputSet() { Task task = bpmn2.createTask(); StringInput stringInput = new StringInput("BLAH", "ATYPE", "DEFAULTVAL"); stringInput.of(task).set("VALUE"); StringInput stringInput2 = new StringInput("BLAH2", "ATYPE", "DEFAULTVAL"); stringInput.of(task).set("VALUE"); InputOutputSpecification ioSpecification = task.getIoSpecification(); List<InputSet> inputSets = ioSpecification.getInputSets(); assertEquals(1, inputSets.size()); } }
public TaskPropertyReader(Task task, BPMNDiagram diagram, DefinitionResolver definitionResolver) { super(task, diagram, definitionResolver.getShape(task.getId()), definitionResolver.getResolutionFactor()); this.task = task; this.definitionResolver = definitionResolver; }
private void setStringValue(String value) { if (value == null || value.isEmpty()) { return; } DataInputAssociation input = input(value); DataInput targetRef = (DataInput) input.getTargetRef(); getIoSpecification(element).getDataInputs().add(targetRef); getIoSpecification(element).getInputSets().get(0).getDataInputRefs().add(targetRef); element.getDataInputAssociations().add(input); }
if (fe instanceof Task) { Task t = (Task) fe; if (t.getDataInputAssociations() != null) { List<DataInputAssociation> inputList = t.getDataInputAssociations(); if (inputList != null) { for (DataInputAssociation input : inputList) { if (t.getDataOutputAssociations() != null) { List<DataOutputAssociation> outputList = t.getDataOutputAssociations(); if (outputList != null) { for (DataOutputAssociation output : outputList) { if (t.getIoSpecification() != null) { InputOutputSpecification ios = t.getIoSpecification(); if (ios.getInputSets() == null || ios.getInputSets().size() < 1) { InputSet inset = Bpmn2Factory.eINSTANCE.createInputSet();
private PropertyWriter serviceTask(Node<View<ServiceTask>, ?> n) { org.eclipse.bpmn2.Task task = bpmn2.createTask(); task.setId(n.getUUID()); ServiceTask definition = n.getContent().getDefinition(); ServiceTaskPropertyWriter p = propertyWriterFactory.of(task); p.setServiceTaskName(definition.getName()); TaskGeneralSet general = definition.getGeneral(); p.setName(general.getName().getValue()); p.setDocumentation(general.getDocumentation().getValue()); p.setAssignmentsInfo( definition.getDataIOSet().getAssignmentsinfo()); ServiceTaskExecutionSet executionSet = definition.getExecutionSet(); p.setTaskName(executionSet.getTaskName().getValue()); p.setAsync(executionSet.getIsAsync().getValue()); p.setOnEntryAction(executionSet.getOnEntryAction()); p.setOnExitAction(executionSet.getOnExitAction()); p.setAdHocAutostart(executionSet.getAdHocAutostart().getValue()); p.setSimulationSet(definition.getSimulationSet()); p.setBounds(n.getContent().getBounds()); return p; }
private ItemDefinition typedefInput(String name, String type) { ItemDefinition typeDef = bpmn2.createItemDefinition(); typeDef.setId(Ids.dataInputItem(element.getId(), name)); typeDef.setStructureRef(type); return typeDef; } }