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);
}
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);
}
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;
}
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;
}
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);
}
Aggregations