Search in sources :

Example 6 with ParsedAssignmentsInfo

use of org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.ParsedAssignmentsInfo in project kie-wb-common by kiegroup.

the class ThrowEventPropertyWriter method setAssignmentsInfo.

@Override
public void setAssignmentsInfo(AssignmentsInfo info) {
    ParsedAssignmentsInfo assignmentsInfo = ParsedAssignmentsInfo.of(info);
    List<InitializedInputVariable> inputs = assignmentsInfo.createInitializedInputVariables(getId(), variableScope, dataObjects);
    if (inputs.isEmpty()) {
        return;
    }
    if (inputs.size() > 1) {
        throw new IllegalArgumentException("Input Associations should be at most 1 in Throw Events");
    }
    InitializedInputVariable input = inputs.get(0);
    if (isReservedIdentifier(input.getIdentifier())) {
        return;
    }
    DataInput dataInput = input.getDataInput();
    throwEvent.getDataInputs().add(dataInput);
    getInputSet().getDataInputRefs().add(dataInput);
    this.addItemDefinition(input.getItemDefinition());
    DataInputAssociation dataInputAssociation = input.getDataInputAssociation();
    if (dataInputAssociation != null) {
        throwEvent.getDataInputAssociation().add(dataInputAssociation);
    }
}
Also used : DataInput(org.eclipse.bpmn2.DataInput) ParsedAssignmentsInfo(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.ParsedAssignmentsInfo) InitializedInputVariable(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.InitializedVariable.InitializedInputVariable) DataInputAssociation(org.eclipse.bpmn2.DataInputAssociation)

Example 7 with ParsedAssignmentsInfo

use of org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.ParsedAssignmentsInfo in project kie-wb-common by kiegroup.

the class CatchEventPropertyWriter method setAssignmentsInfo.

public void setAssignmentsInfo(AssignmentsInfo info) {
    ParsedAssignmentsInfo assignmentsInfo = ParsedAssignmentsInfo.of(info);
    List<InitializedOutputVariable> outputs = assignmentsInfo.createInitializedOutputVariables(getId(), variableScope, dataObjects);
    if (outputs.isEmpty()) {
        return;
    }
    if (outputs.size() > 1) {
        throw new IllegalArgumentException("Output Associations should be at most 1 in Catch Events");
    }
    InitializedOutputVariable output = outputs.get(0);
    DataOutput dataOutput = output.getDataOutput();
    event.getDataOutputs().add(dataOutput);
    getOutputSet().getDataOutputRefs().add(dataOutput);
    this.addItemDefinition(dataOutput.getItemSubjectRef());
    DataOutputAssociation dataOutputAssociation = output.getDataOutputAssociation();
    if (dataOutputAssociation != null) {
        event.getDataOutputAssociation().add(dataOutputAssociation);
    }
}
Also used : InitializedOutputVariable(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.InitializedVariable.InitializedOutputVariable) DataOutput(org.eclipse.bpmn2.DataOutput) ParsedAssignmentsInfo(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.ParsedAssignmentsInfo) DataOutputAssociation(org.eclipse.bpmn2.DataOutputAssociation)

Example 8 with ParsedAssignmentsInfo

use of org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.ParsedAssignmentsInfo in project kie-wb-common by kiegroup.

the class DataTypeCacheServer method processAssignments.

protected List<String> processAssignments(AssignmentsInfo info) {
    List<String> dataTypes = new ArrayList<>();
    ParsedAssignmentsInfo assignments = ParsedAssignmentsInfo.of(info);
    assignments.getInputs().getDeclarations().forEach(declaration -> {
        dataTypes.add(declaration.getType());
    });
    assignments.getOutputs().getDeclarations().forEach(declaration -> {
        dataTypes.add(declaration.getType());
    });
    return dataTypes;
}
Also used : ArrayList(java.util.ArrayList) ParsedAssignmentsInfo(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.ParsedAssignmentsInfo)

Example 9 with ParsedAssignmentsInfo

use of org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.ParsedAssignmentsInfo in project kie-wb-common by kiegroup.

the class ActivityPropertyWriter method setAssignmentsInfo.

public void setAssignmentsInfo(AssignmentsInfo info) {
    final ParsedAssignmentsInfo assignmentsInfo = ParsedAssignmentsInfo.of(info);
    final List<InitializedInputVariable> inputs = assignmentsInfo.createInitializedInputVariables(getId(), variableScope, dataObjects);
    if (!inputs.isEmpty()) {
        final InputOutputSpecification ioSpec = getIoSpecification();
        for (InitializedInputVariable input : inputs) {
            if (isReservedIdentifier(input.getIdentifier())) {
                continue;
            }
            DataInput dataInput = input.getDataInput();
            getInputSet(ioSpec).getDataInputRefs().add(dataInput);
            ioSpec.getDataInputs().add(dataInput);
            this.addItemDefinition(input.getItemDefinition());
            DataInputAssociation dataInputAssociation = input.getDataInputAssociation();
            if (dataInputAssociation != null) {
                activity.getDataInputAssociations().add(dataInputAssociation);
            }
        }
    }
    final List<InitializedOutputVariable> outputs = assignmentsInfo.createInitializedOutputVariables(getId(), variableScope, dataObjects);
    if (!outputs.isEmpty()) {
        final InputOutputSpecification ioSpec = getIoSpecification();
        for (InitializedOutputVariable output : outputs) {
            DataOutput dataOutput = output.getDataOutput();
            getOutputSet(ioSpec).getDataOutputRefs().add(dataOutput);
            ioSpec.getDataOutputs().add(dataOutput);
            this.addItemDefinition(output.getItemDefinition());
            DataOutputAssociation dataOutputAssociation = output.getDataOutputAssociation();
            if (dataOutputAssociation != null) {
                activity.getDataOutputAssociations().add(dataOutputAssociation);
            }
        }
    }
}
Also used : DataInput(org.eclipse.bpmn2.DataInput) InitializedOutputVariable(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.InitializedVariable.InitializedOutputVariable) DataOutput(org.eclipse.bpmn2.DataOutput) InputOutputSpecification(org.eclipse.bpmn2.InputOutputSpecification) ParsedAssignmentsInfo(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.ParsedAssignmentsInfo) InitializedInputVariable(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.InitializedVariable.InitializedInputVariable) DataOutputAssociation(org.eclipse.bpmn2.DataOutputAssociation) DataInputAssociation(org.eclipse.bpmn2.DataInputAssociation)

Example 10 with ParsedAssignmentsInfo

use of org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.ParsedAssignmentsInfo in project kie-wb-common by kiegroup.

the class AssignmentsInfosTest method JBPM_7447_shouldNotFilterOutDataOutputsWithEmptyType.

@Test
public void JBPM_7447_shouldNotFilterOutDataOutputsWithEmptyType() {
    DataInput dataInput = bpmn2.createDataInput();
    dataInput.setName("InputName");
    dataInput.setId("InputID");
    DataOutput dataOutput = bpmn2.createDataOutput();
    dataOutput.setName("OutputName");
    dataOutput.setId("OutputID");
    ParsedAssignmentsInfo result = AssignmentsInfos.parsed(Collections.singletonList(dataInput), Collections.emptyList(), Collections.singletonList(dataOutput), Collections.emptyList(), false);
    assertThat(result.getOutputs().getDeclarations()).isNotEmpty();
}
Also used : DataInput(org.eclipse.bpmn2.DataInput) DataOutput(org.eclipse.bpmn2.DataOutput) ParsedAssignmentsInfo(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.ParsedAssignmentsInfo) Test(org.junit.Test)

Aggregations

ParsedAssignmentsInfo (org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.ParsedAssignmentsInfo)10 DataInput (org.eclipse.bpmn2.DataInput)3 DataOutput (org.eclipse.bpmn2.DataOutput)3 DataInputAssociation (org.eclipse.bpmn2.DataInputAssociation)2 DataOutputAssociation (org.eclipse.bpmn2.DataOutputAssociation)2 Test (org.junit.Test)2 AssociationList (org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.AssociationList)2 DeclarationList (org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.DeclarationList)2 InitializedInputVariable (org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.InitializedVariable.InitializedInputVariable)2 InitializedOutputVariable (org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.InitializedVariable.InitializedOutputVariable)2 ArrayList (java.util.ArrayList)1 InputOutputSpecification (org.eclipse.bpmn2.InputOutputSpecification)1 BusinessRuleTask (org.kie.workbench.common.stunner.bpmn.definition.BusinessRuleTask)1 UserTask (org.kie.workbench.common.stunner.bpmn.definition.UserTask)1 AssignmentsInfo (org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo)1 Metadata (org.kie.workbench.common.stunner.core.diagram.Metadata)1 Graph (org.kie.workbench.common.stunner.core.graph.Graph)1