use of org.jbpm.bpmn2.core.CorrelationSubscription in project jbpm by kiegroup.
the class ProcessHandler method postProcessCollaborations.
private void postProcessCollaborations(RuleFlowProcess process, ExtensibleXmlParser parser) {
// now we wire correlation process subscriptions
CorrelationManager correlationManager = process.getCorrelationManager();
for (Message message : HandlerUtil.messages(parser).values()) {
correlationManager.newMessage(message.getId(), message.getName(), message.getType());
}
// only the ones this process is member of
List<Collaboration> collaborations = HandlerUtil.collaborations(parser).values().stream().filter(c -> c.getProcessesRef().contains(process.getId())).collect(Collectors.toList());
for (Collaboration collaboration : collaborations) {
for (CorrelationKey key : collaboration.getCorrelationKeys()) {
correlationManager.newCorrelation(key.getId(), key.getName());
List<CorrelationProperty> properties = key.getPropertiesRef().stream().map(k -> HandlerUtil.correlationProperties(parser).get(k)).collect(Collectors.toList());
for (CorrelationProperty correlationProperty : properties) {
correlationProperty.getMessageRefs().forEach(messageRef -> {
// for now only MVEL expressions
MVELMessageExpressionEvaluator evaluator = new MVELMessageExpressionEvaluator(correlationProperty.getRetrievalExpression(messageRef).getScript());
correlationManager.addMessagePropertyExpression(key.getId(), messageRef, correlationProperty.getId(), evaluator);
});
}
}
}
// we create the correlations
for (CorrelationSubscription subscription : HandlerUtil.correlationSuscription(process).values()) {
correlationManager.subscribeTo(subscription.getCorrelationKeyRef());
for (Map.Entry<String, Expression> binding : subscription.getPropertyExpressions().entrySet()) {
MVELMessageExpressionEvaluator evaluator = new MVELMessageExpressionEvaluator(binding.getValue().getScript());
correlationManager.addProcessSubscriptionPropertyExpression(subscription.getCorrelationKeyRef(), binding.getKey(), evaluator);
}
}
}
use of org.jbpm.bpmn2.core.CorrelationSubscription in project jbpm by kiegroup.
the class CorrelationSubscriptionHandler method start.
@Override
public Object start(String uri, String localName, Attributes attrs, ExtensibleXmlParser parser) throws SAXException {
parser.startElementBuilder(localName, attrs);
String correlationSubscriptionPropertyId = attrs.getValue("id");
String correlationSubscriptionPropertyName = attrs.getValue("name");
String correlationSubscriptionRef = attrs.getValue("correlationKeyRef");
CorrelationSubscription correlationSubscription = new CorrelationSubscription();
correlationSubscription.setId(correlationSubscriptionPropertyId);
correlationSubscription.setName(correlationSubscriptionPropertyName);
correlationSubscription.setCorrelationKeyRef(correlationSubscriptionRef);
RuleFlowProcess process = (RuleFlowProcess) parser.getParent();
HandlerUtil.correlationSuscription(process).put(correlationSubscriptionPropertyId, correlationSubscription);
return correlationSubscription;
}
use of org.jbpm.bpmn2.core.CorrelationSubscription in project kogito-runtimes by kiegroup.
the class CorrelationSubscriptionHandler method start.
@Override
public Object start(String uri, String localName, Attributes attrs, ExtensibleXmlParser parser) throws SAXException {
parser.startElementBuilder(localName, attrs);
String correlationSubscriptionPropertyId = attrs.getValue("id");
String correlationSubscriptionPropertyName = attrs.getValue("name");
String correlationSubscriptionRef = attrs.getValue("correlationKeyRef");
CorrelationSubscription correlationSubscription = new CorrelationSubscription();
correlationSubscription.setId(correlationSubscriptionPropertyId);
correlationSubscription.setName(correlationSubscriptionPropertyName);
correlationSubscription.setCorrelationKeyRef(correlationSubscriptionRef);
RuleFlowProcess process = (RuleFlowProcess) parser.getParent();
HandlerUtil.correlationSubscription(process).put(correlationSubscriptionPropertyId, correlationSubscription);
return correlationSubscription;
}
use of org.jbpm.bpmn2.core.CorrelationSubscription in project jbpm by kiegroup.
the class CorrelationSubscriptionHandler method end.
@Override
public Object end(String uri, String localName, ExtensibleXmlParser parser) throws SAXException {
Element element = parser.endElementBuilder();
CorrelationSubscription correlationSubscription = (CorrelationSubscription) parser.getCurrent();
correlationSubscription.getPropertyExpressions().putAll(buildPropertyProcessBindings(element.getChildNodes(), parser));
return null;
}
use of org.jbpm.bpmn2.core.CorrelationSubscription in project kogito-runtimes by kiegroup.
the class ProcessHandler method postProcessCollaborations.
private void postProcessCollaborations(RuleFlowProcess process, ExtensibleXmlParser parser) {
// now we wire correlation process subscriptions
CorrelationManager correlationManager = process.getCorrelationManager();
for (Message message : HandlerUtil.messages(parser).values()) {
correlationManager.newMessage(message.getId(), message.getName(), message.getType());
}
// only the ones this process is member of
List<Collaboration> collaborations = HandlerUtil.collaborations(parser).values().stream().filter(c -> c.getProcessesRef().contains(process.getId())).collect(Collectors.toList());
for (Collaboration collaboration : collaborations) {
for (CorrelationKey key : collaboration.getCorrelationKeys()) {
correlationManager.newCorrelation(key.getId(), key.getName());
List<CorrelationProperty> properties = key.getPropertiesRef().stream().map(k -> HandlerUtil.correlationProperties(parser).get(k)).collect(Collectors.toList());
for (CorrelationProperty correlationProperty : properties) {
correlationProperty.getMessageRefs().forEach(messageRef -> {
// for now only MVEL expressions
MVELMessageExpressionEvaluator evaluator = new MVELMessageExpressionEvaluator(correlationProperty.getRetrievalExpression(messageRef).getScript());
correlationManager.addMessagePropertyExpression(key.getId(), messageRef, correlationProperty.getId(), evaluator);
});
}
}
}
// we create the correlations
for (CorrelationSubscription subscription : HandlerUtil.correlationSubscription(process).values()) {
correlationManager.subscribeTo(subscription.getCorrelationKeyRef());
for (Map.Entry<String, Expression> binding : subscription.getPropertyExpressions().entrySet()) {
MVELMessageExpressionEvaluator evaluator = new MVELMessageExpressionEvaluator(binding.getValue().getScript());
correlationManager.addProcessSubscriptionPropertyExpression(subscription.getCorrelationKeyRef(), binding.getKey(), evaluator);
}
}
}
Aggregations