Search in sources :

Example 36 with DataInput

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

the class ReassignmentsInfos method of.

public static ReassignmentsInfo of(List<DataInputAssociation> dataInputAssociations) {
    ReassignmentTypeListValue reassignments = new ReassignmentTypeListValue();
    dataInputAssociations.forEach(din -> {
        DataInput targetRef = (DataInput) (din.getTargetRef());
        if (isReservedIdentifier(targetRef.getName())) {
            if (!din.getAssignment().isEmpty()) {
                Assignment assignment = din.getAssignment().get(0);
                if (assignment != null) {
                    String body = ((FormalExpression) assignment.getFrom()).getBody();
                    if (body != null) {
                        Arrays.stream(replaceBracket(body).split("\\^")).forEach(b -> {
                            reassignments.addValue(ParsedReassignmentsInfos.of(targetRef.getName(), b));
                        });
                    }
                }
            }
        }
    });
    return new ReassignmentsInfo(reassignments);
}
Also used : DataInput(org.eclipse.bpmn2.DataInput) Assignment(org.eclipse.bpmn2.Assignment) ReassignmentsInfo(org.kie.workbench.common.stunner.bpmn.definition.property.reassignment.ReassignmentsInfo) ReassignmentTypeListValue(org.kie.workbench.common.stunner.bpmn.definition.property.reassignment.ReassignmentTypeListValue) FormalExpression(org.eclipse.bpmn2.FormalExpression)

Example 37 with DataInput

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

the class NotificationsInfos method of.

public static NotificationsInfo of(List<DataInputAssociation> dataInputAssociations) {
    NotificationTypeListValue notifications = new NotificationTypeListValue();
    dataInputAssociations.forEach(din -> {
        DataInput targetRef = (DataInput) (din.getTargetRef());
        if (isReservedIdentifier(targetRef.getName())) {
            if (!din.getAssignment().isEmpty()) {
                Assignment assignment = din.getAssignment().get(0);
                if (assignment != null) {
                    String body = ((FormalExpression) assignment.getFrom()).getBody();
                    if (body != null) {
                        Arrays.stream(body.split("\\^")).forEach(b -> {
                            notifications.addValue(ParsedNotificationsInfos.of(targetRef.getName(), b));
                        });
                    }
                }
            }
        }
    });
    return new NotificationsInfo(notifications);
}
Also used : DataInput(org.eclipse.bpmn2.DataInput) Assignment(org.eclipse.bpmn2.Assignment) NotificationTypeListValue(org.kie.workbench.common.stunner.bpmn.definition.property.notification.NotificationTypeListValue) FormalExpression(org.eclipse.bpmn2.FormalExpression) NotificationsInfo(org.kie.workbench.common.stunner.bpmn.definition.property.notification.NotificationsInfo)

Example 38 with DataInput

use of org.eclipse.bpmn2.DataInput 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 39 with DataInput

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

the class CustomInput method associationOf.

private DataInputAssociation associationOf(Assignment assignment, DataInput dataInput) {
    DataInputAssociation dataInputAssociation = bpmn2.createDataInputAssociation();
    dataInputAssociation.getAssignment().add(assignment);
    dataInputAssociation.setTargetRef(dataInput);
    return dataInputAssociation;
}
Also used : DataInputAssociation(org.eclipse.bpmn2.DataInputAssociation)

Example 40 with DataInput

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

the class CustomInput method setStringValue.

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);
}
Also used : DataInput(org.eclipse.bpmn2.DataInput) DataInputAssociation(org.eclipse.bpmn2.DataInputAssociation)

Aggregations

DataInput (org.eclipse.bpmn2.DataInput)38 DataInputAssociation (org.eclipse.bpmn2.DataInputAssociation)25 DataOutput (org.eclipse.bpmn2.DataOutput)17 FormalExpression (org.eclipse.bpmn2.FormalExpression)15 ArrayList (java.util.ArrayList)12 DataOutputAssociation (org.eclipse.bpmn2.DataOutputAssociation)12 Assignment (org.eclipse.bpmn2.Assignment)11 ItemAwareElement (org.eclipse.bpmn2.ItemAwareElement)11 Test (org.junit.Test)10 List (java.util.List)9 InputSet (org.eclipse.bpmn2.InputSet)9 InputOutputSpecification (org.eclipse.bpmn2.InputOutputSpecification)8 SimpleFeatureMapEntry (org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry)8 Parameter (bpsim.Parameter)5 ItemDefinition (org.eclipse.bpmn2.ItemDefinition)5 Process (org.eclipse.bpmn2.Process)5 Property (org.eclipse.bpmn2.Property)5 NormalDistributionType (bpsim.NormalDistributionType)4 PoissonDistributionType (bpsim.PoissonDistributionType)4 TimeParameters (bpsim.TimeParameters)4