use of org.eclipse.bpmn2.DataOutput in project kie-wb-common by kiegroup.
the class MultipleInstanceActivityPropertyWriter method setCollectionOutput.
public void setCollectionOutput(String collectionOutput) {
if (isEmpty(collectionOutput)) {
return;
}
setUpLoopCharacteristics();
String suffix = "OUT_COLLECTION";
String id = Ids.dataOutput(activity.getId(), suffix);
DataOutput dataOutputElement = createDataOutput(id, suffix);
addSafe(ioSpec.getDataOutputs(), dataOutputElement);
Optional<Property> property = findPropertyById(collectionOutput);
Optional<DataObject> dataObject = findDataObjectById(collectionOutput);
if (property.isPresent()) {
processDataOutput(dataOutputElement, property.get());
} else if (dataObject.isPresent()) {
processDataOutput(dataOutputElement, dataObject.get());
}
}
use of org.eclipse.bpmn2.DataOutput in project kie-wb-common by kiegroup.
the class MultipleInstanceActivityPropertyWriter method processDataOutput.
private void processDataOutput(DataOutput dataOutputElement, ItemAwareElement prop) {
dataOutputElement.setItemSubjectRef(prop.getItemSubjectRef());
miloop.setLoopDataOutputRef(dataOutputElement);
addSafe(outputSet.getDataOutputRefs(), dataOutputElement);
DataOutputAssociation doa = Bpmn2Factory.eINSTANCE.createDataOutputAssociation();
doa.getSourceRef().add(dataOutputElement);
doa.setTargetRef(prop);
addSafe(activity.getDataOutputAssociations(), doa);
}
use of org.eclipse.bpmn2.DataOutput in project kie-wb-common by kiegroup.
the class MultipleInstanceActivityPropertyReader method getDataOutputIdForDataOutputVariable.
protected String getDataOutputIdForDataOutputVariable() {
String dataOutputVariableId = null;
DataOutput variableDataOutput = getMultiInstanceLoopCharacteristics().map(MultiInstanceLoopCharacteristics::getOutputDataItem).orElse(null);
if (variableDataOutput != null) {
String itemSubjectRef = getItemSubjectRef(variableDataOutput);
String variableId = ItemNameReader.from(variableDataOutput).getName();
dataOutputVariableId = super.getDataOutputs().stream().filter(output -> Objects.equals(variableId, output.getName())).filter(output -> hasItemSubjectRef(output, itemSubjectRef)).map(BaseElement::getId).findFirst().orElse(null);
}
return dataOutputVariableId;
}
use of org.eclipse.bpmn2.DataOutput in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method testMarshallUserTaskAssignments.
@Test
public void testMarshallUserTaskAssignments() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_USERTASKASSIGNMENTS);
// JBPMBpmn2ResourceImpl resource = tested.marshallToBpmn2Resource(diagram);
String result = tested.marshall(diagram);
assertDiagram(result, 1, 7, 7);
DefinitionsConverter definitionsConverter = new DefinitionsConverter(diagram.getGraph());
Definitions definitions = definitionsConverter.toDefinitions();
assertNotNull(definitions);
Process process = getProcess(definitions);
assertNotNull(process);
org.eclipse.bpmn2.UserTask userTask = (org.eclipse.bpmn2.UserTask) getNamedFlowElement(process, org.eclipse.bpmn2.UserTask.class, "Self Evaluation");
assertNotNull(userTask);
DataInput dataInput = getDataInput(userTask, "reason");
// this fails because of type
validateDataInputOrOutput(dataInput, "_reasonInputX", "com.test.Reason", "_reasonInputXItem");
DataOutput dataOutput = getDataOutput(userTask, "performance");
validateDataInputOrOutput(dataOutput, "_performanceOutputX", "Object", "_performanceOutputXItem");
ItemAwareElement sourceRef = getDataInputAssociationSourceRef(userTask, "reason");
assertNotNull(sourceRef);
ItemAwareElement targetRef = getDataInputAssociationTargetRef(userTask, "_reasonInputX");
assertNotNull(targetRef);
sourceRef = getDataOutputAssociationSourceRef(userTask, "_performanceOutputX");
assertNotNull(sourceRef);
targetRef = getDataOutputAssociationTargetRef(userTask, "performance");
assertNotNull(targetRef);
}
use of org.eclipse.bpmn2.DataOutput in project kie-wb-common by kiegroup.
the class ParsedAssignmentsInfoTest method testCreateInitializedOutputVariables.
@Test
public void testCreateInitializedOutputVariables() {
final String DATA_OUTPUT_ID = "_Data-TestOutputX";
final String DATA_OUTPUT_NAME = "Data Test";
final String DATA_OUTPUT_ASSOCIATION_ID = "Data Test";
final String DATA_OUTPUT_ASSOCIATION_VALUE = "BooleanTest";
final String INIT_OUTPUT_VAR_ID = "Data-Test";
final String INIT_OUTPUT_VAR_TYPE = "Boolean";
VariableScope variableScope = new FlatVariableScope();
variableScope.declare("", "BooleanTest", "Boolean");
List<InitializedVariable.InitializedOutputVariable> initializedOutputVariables = tested.createInitializedOutputVariables("", variableScope, new HashSet<>());
assertEquals(1, initializedOutputVariables.size());
InitializedVariable.InitializedOutputVariable initializedOutputVariable = initializedOutputVariables.get(0);
DataOutput dataOutput = initializedOutputVariable.getDataOutput();
DataOutputAssociation dataOutputAssociation = initializedOutputVariable.getDataOutputAssociation();
List<ItemAwareElement> sourceRef = dataOutputAssociation.getSourceRef();
DataOutput source = (DataOutput) sourceRef.get(0);
PropertyImpl target = (PropertyImpl) dataOutputAssociation.getTargetRef();
String dataOutputID = dataOutput.getId();
String dataOutputName = dataOutput.getName();
String dataOutputAssociationID = source.getName();
String dataOutputAssociationValue = target.getId();
String initVarID = initializedOutputVariable.getIdentifier();
String initVarType = initializedOutputVariable.getType();
assertEquals(dataOutputID, DATA_OUTPUT_ID);
assertEquals(dataOutputName, DATA_OUTPUT_NAME);
assertEquals(dataOutputAssociationID, DATA_OUTPUT_ASSOCIATION_ID);
assertEquals(dataOutputAssociationValue, DATA_OUTPUT_ASSOCIATION_VALUE);
assertEquals(initVarID, INIT_OUTPUT_VAR_ID);
assertEquals(initVarType, INIT_OUTPUT_VAR_TYPE);
}
Aggregations