public AssignmentsInfo getAssignmentsInfo() { Optional<InputOutputSpecification> ioSpecification = Optional.ofNullable(task.getIoSpecification()); return AssignmentsInfos.of( ioSpecification.map(InputOutputSpecification::getDataInputs) .orElse(Collections.emptyList()), task.getDataInputAssociations(), ioSpecification.map(InputOutputSpecification::getDataOutputs) .orElse(Collections.emptyList()), task.getDataOutputAssociations(), ioSpecification.isPresent() ); }
String name = task.getName(); if (name == null || name.length() == 0) { LastUserTaskID++; String newName = DEFAULT_USERTASK_NAME_PREFIX + LastUserTaskID; task.setName(newName); if (task.getExtensionValues() != null && task.getExtensionValues().size() > 0) { for (ExtensionAttributeValue extattrval : task.getExtensionValues()) { FeatureMap extensionElements = extattrval.getValue(); List<MetaDataType> metadataExtensions = (List<MetaDataType>) extensionElements
List<DataInputAssociation> dataInputAssociations = userTask.getDataInputAssociations(); List<DataOutputAssociation> dataOutputAssociations = userTask.getDataOutputAssociations(); result.registerTaskFormVariables(userTask.getId(), formVariables); } else { logger.warn("Cannot generate a form for task '{}' since it has no form name.", userTask.getName());
rae.setExpression(fe); po.setResourceAssignmentExpression(rae); task.getResources().add(po); SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(scriptLanguageElement, scriptLanguage); task.getAnyAttribute().add(extensionEntry); if (task.getIoSpecification() == null) { InputOutputSpecification iospec = Bpmn2Factory.eINSTANCE.createInputOutputSpecification(); task.setIoSpecification(iospec); List<DataInput> dataInputs = task.getIoSpecification().getDataInputs(); boolean foundGroupIdInput = false; DataInput foundInput = null; d.setId(task.getId() + "_" + "GroupId" + "InputX"); d.setName("GroupId"); task.getIoSpecification().getDataInputs().add(d); foundInput = d; 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(d); List<DataInputAssociation> inputAssociations = task.getDataInputAssociations(); for (DataInputAssociation da : inputAssociations) { if (da.getTargetRef() != null && da.getTargetRef().getId().equals(foundInput.getId())) {
if ( fe instanceof UserTask && fe.getId().equals( resourceId ) ) { UserTask utask = (UserTask) fe; List<DataInputAssociation> dataInputAssociations = utask.getDataInputAssociations(); List<DataOutputAssociation> dataOutputAssociations = utask.getDataOutputAssociations(); if ( dataOutputAssociations != null ) { for ( DataOutputAssociation outputAssociation : dataOutputAssociations ) {
private void readUserTask(UserTask userTask, Consumer<TaskFormModel> consumer) { userTask.getDataInputAssociations() .stream() .filter(inputAssociation -> inputAssociation.getTargetRef() != null && FormsMigrationConstants.TASK_FORM_VARIABLE.equals(((DataInput)inputAssociation.getTargetRef()).getName())) .findAny() .ifPresent(inputAssociation -> consumer.accept(new TaskFormModel("", readTaskFormName(inputAssociation), new ArrayList<>()))); }
protected void setLastUserTaskID(UserTask task) { String name = task.getName(); if (name != null && name.length() > 0) { int i = name.indexOf(DEFAULT_USERTASK_NAME_PREFIX); if (i == 0) { String numStr = name.substring(5); try { int num = Integer.parseInt(numStr); if (num >= LastUserTaskID) { LastUserTaskID = num; } } catch (NumberFormatException nfe) { // do nothing } } } }
private BpmnNode userTask(org.eclipse.bpmn2.UserTask task) { Node<View<UserTask>, Edge> node = factoryManager.newNode(task.getId(), UserTask.class);
@Test public void marshallAssociations() throws Exception { Diagram<Graph, Metadata> d = unmarshall(newMarshaller, BPMN_FILE_PATH); Node<View<UserTask>, ?> node = d.getGraph().getNode(TASK_ID); UserTask definition = node.getContent().getDefinition(); DefinitionsConverter definitionsConverter = new DefinitionsConverter(d.getGraph()); Definitions definitions = definitionsConverter.toDefinitions(); Process p = (Process) definitions.getRootElements().get(0); org.eclipse.bpmn2.UserTask flowElement = (org.eclipse.bpmn2.UserTask) p.getFlowElements().stream().filter(e -> e.getId().equals(TASK_ID)).findFirst().get(); List<DataInputAssociation> associations = flowElement.getDataInputAssociations(); assertEquals("myprocvar", findVar(associations, "From")); assertEquals("<![CDATA[HELLO]]>", findAssignment(associations, "Body")); }
public void addVariable(Optional<UserTask> userTask, Variable variable) { Variable existingVariable = variables.get(variable.getName()); if (existingVariable != null) { if (!existingVariable.getType().equals(variable.getType())) { valid = false; StringBuffer message = new StringBuffer("Type conflict on task variable '").append(variable.getName()).append("': The variable type defined by task '").append(this.userTask.getName()).append("' (").append(existingVariable.getType()).append(") doesn't match the "); if (userTask.isPresent()) { message.append("variable type defined by task '").append(userTask.get().getName()).append("' "); } else { message.append("variable type received "); } message.append("(").append(variable.getType()).append(")."); errors.add(message.toString()); } else { if (variable.isInput()) { existingVariable.setInput(variable.isInput()); } if (variable.isOutput()) { existingVariable.setOutput(variable.isOutput()); } } } else { variables.put(variable.getName(), variable); } }