Search in sources :

Example 16 with Association

use of org.eclipse.bpmn2.Association in project kie-wb-common by kiegroup.

the class Bpmn2JsonMarshaller method writeAssociations.

private void writeAssociations(Process process, String elementId, JsonGenerator generator) throws IOException {
    for (Artifact artifact : process.getArtifacts()) {
        if (artifact instanceof Association) {
            Association association = (Association) artifact;
            if (association.getSourceRef().getId().equals(elementId)) {
                generator.writeStartObject();
                generator.writeObjectField("resourceId", association.getId());
                generator.writeEndObject();
            }
        }
    }
}
Also used : Association(org.eclipse.bpmn2.Association) DataOutputAssociation(org.eclipse.bpmn2.DataOutputAssociation) DataInputAssociation(org.eclipse.bpmn2.DataInputAssociation) Artifact(org.eclipse.bpmn2.Artifact)

Example 17 with Association

use of org.eclipse.bpmn2.Association in project kie-wb-common by kiegroup.

the class CustomInput method input.

private DataInputAssociation input(Object value) {
    // first we declare the type of this assignment
    // // then we declare the input that will provide
    // // the value that we assign to `source`
    // // e.g. myInput
    DataInput target = readInputFrom(inputDefinition.name(), typeDef);
    Assignment assignment = assignment(value.toString(), target.getId());
    // then we create the actual association between the two
    // e.g. foo := myInput (or, to put it differently, myInput -> foo)
    DataInputAssociation association = associationOf(assignment, target);
    return association;
}
Also used : DataInput(org.eclipse.bpmn2.DataInput) Assignment(org.eclipse.bpmn2.Assignment) DataInputAssociation(org.eclipse.bpmn2.DataInputAssociation)

Example 18 with Association

use of org.eclipse.bpmn2.Association in project kie-wb-common by kiegroup.

the class DMNMarshallerTest method checkAssociationsGraph.

private void checkAssociationsGraph(Graph<?, Node<?, ?>> g) {
    Node<?, ?> inputData = g.getNode("BD168F8B-4398-4478-8BEA-E67AA5F90FAF");
    assertNodeContentDefinitionIs(inputData, InputData.class);
    Node<?, ?> decision = g.getNode("A960E2D2-FBC1-4D11-AA33-064F6A0B5CB9");
    assertNodeContentDefinitionIs(decision, Decision.class);
    Node<?, ?> knowledgeSource = g.getNode("FB99ED65-BC43-4750-999F-7FE24690845B");
    assertNodeContentDefinitionIs(knowledgeSource, KnowledgeSource.class);
    Node<?, ?> bkm = g.getNode("2F07453C-854F-436F-8378-4CFCE63BB124");
    assertNodeContentDefinitionIs(bkm, BusinessKnowledgeModel.class);
    Node<?, ?> textAnnotation = g.getNode("7F4B8130-6F3D-4A16-9F6C-01D01DA481D2");
    assertNodeContentDefinitionIs(textAnnotation, TextAnnotation.class);
    Edge fromInput = assertNodeEdgesTo(inputData, textAnnotation, Association.class);
    assertEquals("From Input", ((View<Association>) fromInput.getContent()).getDefinition().getDescription().getValue());
    Edge fromDecision = assertNodeEdgesTo(decision, textAnnotation, Association.class);
    assertEquals("From Decision", ((View<Association>) fromDecision.getContent()).getDefinition().getDescription().getValue());
    Edge fromBkm = assertNodeEdgesTo(bkm, textAnnotation, Association.class);
    assertEquals("From BKM", ((View<Association>) fromBkm.getContent()).getDefinition().getDescription().getValue());
    Edge fromKnowledgeSource = assertNodeEdgesTo(knowledgeSource, textAnnotation, Association.class);
    assertEquals("From Knowledge Source", ((View<Association>) fromKnowledgeSource.getContent()).getDefinition().getDescription().getValue());
}
Also used : Association(org.kie.workbench.common.dmn.api.definition.v1_1.Association) Edge(org.kie.workbench.common.stunner.core.graph.Edge)

Example 19 with Association

use of org.eclipse.bpmn2.Association in project drools by kiegroup.

the class AssociationConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    Association a = (Association) parent;
    writeChildrenNode(writer, context, a.getSourceRef(), SOURCE_REF);
    writeChildrenNode(writer, context, a.getTargetRef(), TARGET_REF);
}
Also used : Association(org.kie.dmn.model.v1_1.Association)

Example 20 with Association

use of org.eclipse.bpmn2.Association in project drools by kiegroup.

the class AssociationConverter method writeAttributes.

@Override
protected void writeAttributes(HierarchicalStreamWriter writer, Object parent) {
    super.writeAttributes(writer, parent);
    Association a = (Association) parent;
    if (a.getAssociationDirection() != null)
        writer.addAttribute(ASSOCIATION_DIRECTION, a.getAssociationDirection().value());
}
Also used : Association(org.kie.dmn.model.v1_1.Association)

Aggregations

DataInputAssociation (org.eclipse.bpmn2.DataInputAssociation)12 ArrayList (java.util.ArrayList)11 DataOutputAssociation (org.eclipse.bpmn2.DataOutputAssociation)11 List (java.util.List)8 Artifact (org.eclipse.bpmn2.Artifact)7 Association (org.eclipse.bpmn2.Association)7 AdHocSubProcess (org.eclipse.bpmn2.AdHocSubProcess)6 DataInput (org.eclipse.bpmn2.DataInput)6 SubProcess (org.eclipse.bpmn2.SubProcess)6 NormalDistributionType (bpsim.NormalDistributionType)5 Parameter (bpsim.Parameter)5 PoissonDistributionType (bpsim.PoissonDistributionType)5 TimeParameters (bpsim.TimeParameters)5 UniformDistributionType (bpsim.UniformDistributionType)5 Assignment (org.eclipse.bpmn2.Assignment)5 DataOutput (org.eclipse.bpmn2.DataOutput)5 ItemAwareElement (org.eclipse.bpmn2.ItemAwareElement)5 Process (org.eclipse.bpmn2.Process)5 EObject (org.eclipse.emf.ecore.EObject)5 SimpleFeatureMapEntry (org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry)5