Search in sources :

Example 1 with ExtensibleXmlParser

use of org.drools.core.xml.ExtensibleXmlParser 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);
        }
    }
}
Also used : EventFilter(org.jbpm.process.core.event.EventFilter) ConstraintTrigger(org.jbpm.workflow.core.node.ConstraintTrigger) CorrelationManager(org.jbpm.process.core.correlation.CorrelationManager) HumanTaskNode(org.jbpm.workflow.core.node.HumanTaskNode) SequenceFlow(org.jbpm.bpmn2.core.SequenceFlow) LoggerFactory(org.slf4j.LoggerFactory) BoundaryEventNode(org.jbpm.workflow.core.node.BoundaryEventNode) StartNode(org.jbpm.workflow.core.node.StartNode) CorrelationProperty(org.jbpm.bpmn2.core.CorrelationProperty) RuleFlowProcessValidator(org.jbpm.ruleflow.core.validation.RuleFlowProcessValidator) NodeImpl(org.jbpm.workflow.core.impl.NodeImpl) CompositeNode(org.jbpm.workflow.core.node.CompositeNode) DroolsConsequenceAction(org.jbpm.workflow.core.impl.DroolsConsequenceAction) ItemDefinition(org.jbpm.bpmn2.core.ItemDefinition) Constraint(org.jbpm.workflow.core.Constraint) ExtensibleXmlParser(org.drools.core.xml.ExtensibleXmlParser) Association(org.jbpm.bpmn2.core.Association) Connection(org.jbpm.workflow.core.Connection) StateNode(org.jbpm.workflow.core.node.StateNode) ProcessBuildData(org.jbpm.compiler.xml.ProcessBuildData) RuleSetNode(org.jbpm.workflow.core.node.RuleSetNode) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) Signal(org.jbpm.bpmn2.core.Signal) SubProcessNode(org.jbpm.workflow.core.node.SubProcessNode) EventTrigger(org.jbpm.workflow.core.node.EventTrigger) CompositeContextNode(org.jbpm.workflow.core.node.CompositeContextNode) Collaboration(org.jbpm.bpmn2.core.Collaboration) Collection(java.util.Collection) Process(org.kie.api.definition.process.Process) Collectors(java.util.stream.Collectors) IntermediateLink(org.jbpm.bpmn2.core.IntermediateLink) ActionExceptionHandler(org.jbpm.process.core.context.exception.ActionExceptionHandler) Message(org.jbpm.bpmn2.core.Message) List(java.util.List) Error(org.jbpm.bpmn2.core.Error) Stream(java.util.stream.Stream) ContextContainer(org.jbpm.process.core.ContextContainer) EventTypeFilter(org.jbpm.process.core.event.EventTypeFilter) SignalNodeInstanceAction(org.jbpm.process.instance.impl.SignalNodeInstanceAction) SAXException(org.xml.sax.SAXException) CorrelationKey(org.jbpm.bpmn2.core.CorrelationKey) Trigger(org.jbpm.workflow.core.node.Trigger) NodeContainer(org.kie.api.definition.process.NodeContainer) DataStore(org.jbpm.bpmn2.core.DataStore) ExceptionScope(org.jbpm.process.core.context.exception.ExceptionScope) RuleFlowProcess(org.jbpm.ruleflow.core.RuleFlowProcess) StateBasedNode(org.jbpm.workflow.core.node.StateBasedNode) CompensationScope(org.jbpm.process.core.context.exception.CompensationScope) Escalation(org.jbpm.bpmn2.core.Escalation) CancelNodeInstanceAction(org.jbpm.process.instance.impl.CancelNodeInstanceAction) Split(org.jbpm.workflow.core.node.Split) HashMap(java.util.HashMap) EventSubProcessNode(org.jbpm.workflow.core.node.EventSubProcessNode) ArrayList(java.util.ArrayList) Lane(org.jbpm.bpmn2.core.Lane) Timer(org.jbpm.process.core.timer.Timer) HashSet(java.util.HashSet) Expression(org.jbpm.bpmn2.core.Expression) Swimlane(org.jbpm.process.core.context.swimlane.Swimlane) Attributes(org.xml.sax.Attributes) BaseAbstractHandler(org.drools.core.xml.BaseAbstractHandler) ConnectionImpl(org.jbpm.workflow.core.impl.ConnectionImpl) FaultNode(org.jbpm.workflow.core.node.FaultNode) DroolsAction(org.jbpm.workflow.core.DroolsAction) LinkedHashSet(java.util.LinkedHashSet) CorrelationSubscription(org.jbpm.bpmn2.core.CorrelationSubscription) WorkItemNode(org.jbpm.workflow.core.node.WorkItemNode) Interface(org.jbpm.bpmn2.core.Interface) ConnectionRef(org.jbpm.workflow.core.impl.ConnectionRef) ActionNode(org.jbpm.workflow.core.node.ActionNode) EndNode(org.jbpm.workflow.core.node.EndNode) Logger(org.slf4j.Logger) EventNode(org.jbpm.workflow.core.node.EventNode) ConstraintImpl(org.jbpm.workflow.core.impl.ConstraintImpl) Handler(org.drools.core.xml.Handler) MVELMessageExpressionEvaluator(org.jbpm.process.core.event.MVELMessageExpressionEvaluator) Node(org.kie.api.definition.process.Node) CompensationHandler(org.jbpm.process.core.context.exception.CompensationHandler) Definitions(org.jbpm.bpmn2.core.Definitions) ExtendedNodeImpl(org.jbpm.workflow.core.impl.ExtendedNodeImpl) MVELMessageExpressionEvaluator(org.jbpm.process.core.event.MVELMessageExpressionEvaluator) Message(org.jbpm.bpmn2.core.Message) CorrelationSubscription(org.jbpm.bpmn2.core.CorrelationSubscription) CorrelationManager(org.jbpm.process.core.correlation.CorrelationManager) CorrelationKey(org.jbpm.bpmn2.core.CorrelationKey) Expression(org.jbpm.bpmn2.core.Expression) Collaboration(org.jbpm.bpmn2.core.Collaboration) CorrelationProperty(org.jbpm.bpmn2.core.CorrelationProperty) Map(java.util.Map) HashMap(java.util.HashMap)

Example 2 with ExtensibleXmlParser

use of org.drools.core.xml.ExtensibleXmlParser in project kogito-runtimes by kiegroup.

the class AbstractNodeHandler method readCatchSpecification.

protected IOSpecification readCatchSpecification(ExtensibleXmlParser parser, Element element) {
    IOSpecification ioSpec = new IOSpecification();
    ioSpec.getDataOutputs().addAll(readDataOutput(parser, element));
    org.w3c.dom.Node xmlNode = element.getFirstChild();
    while (xmlNode != null) {
        String nodeName = xmlNode.getNodeName();
        if ("dataOutputAssociation".equals(nodeName)) {
            readDataAssociation(parser, (Element) xmlNode, id -> ioSpec.getDataOutput().get(id), id -> getVariableDataSpec(parser, id)).ifPresent(e -> ioSpec.getDataOutputAssociation().add(e));
        }
        xmlNode = xmlNode.getNextSibling();
    }
    return ioSpec;
}
Also used : SequenceFlow(org.jbpm.bpmn2.core.SequenceFlow) ForEachNode(org.jbpm.workflow.core.node.ForEachNode) LoggerFactory(org.slf4j.LoggerFactory) PatternConstants(org.jbpm.util.PatternConstants) NodeImpl(org.jbpm.workflow.core.impl.NodeImpl) Thread.currentThread(java.lang.Thread.currentThread) DroolsConsequenceAction(org.jbpm.workflow.core.impl.DroolsConsequenceAction) ItemDefinition(org.jbpm.bpmn2.core.ItemDefinition) Assignment(org.jbpm.workflow.core.node.Assignment) ExtensibleXmlParser(org.drools.core.xml.ExtensibleXmlParser) Association(org.jbpm.bpmn2.core.Association) StateNode(org.jbpm.workflow.core.node.StateNode) Matcher(java.util.regex.Matcher) ProcessBuildData(org.jbpm.compiler.xml.ProcessBuildData) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) Signal(org.jbpm.bpmn2.core.Signal) Transformation(org.jbpm.workflow.core.node.Transformation) IOSpecification(org.jbpm.workflow.core.impl.IOSpecification) XmlDumper(org.drools.compiler.compiler.xml.XmlDumper) MultiInstanceSpecification(org.jbpm.workflow.core.impl.MultiInstanceSpecification) CatchLinkNode(org.jbpm.workflow.core.node.CatchLinkNode) CompositeContextNode(org.jbpm.workflow.core.node.CompositeContextNode) Collection(java.util.Collection) Set(java.util.Set) UUID(java.util.UUID) VariableScope(org.jbpm.process.core.context.variable.VariableScope) List(java.util.List) Error(org.jbpm.bpmn2.core.Error) ContextContainer(org.jbpm.process.core.ContextContainer) Node(org.jbpm.workflow.core.Node) JavaDialect(org.drools.mvel.java.JavaDialect) SAXException(org.xml.sax.SAXException) Optional(java.util.Optional) MAPPING_VARIABLE_INPUT(org.jbpm.ruleflow.core.Metadata.MAPPING_VARIABLE_INPUT) VARIABLE(org.jbpm.ruleflow.core.Metadata.VARIABLE) RuleFlowProcess(org.jbpm.ruleflow.core.RuleFlowProcess) DataDefinition(org.jbpm.workflow.core.impl.DataDefinition) HashMap(java.util.HashMap) Function(java.util.function.Function) ArrayList(java.util.ArrayList) Lane(org.jbpm.bpmn2.core.Lane) TimerNode(org.jbpm.workflow.core.node.TimerNode) HashSet(java.util.HashSet) DataTypeResolver.fromType(org.jbpm.process.core.datatype.DataTypeResolver.fromType) NodeContainer(org.jbpm.workflow.core.NodeContainer) DataAssociation(org.jbpm.workflow.core.impl.DataAssociation) Attributes(org.xml.sax.Attributes) BaseAbstractHandler(org.drools.core.xml.BaseAbstractHandler) FaultNode(org.jbpm.workflow.core.node.FaultNode) DroolsAction(org.jbpm.workflow.core.DroolsAction) Variable(org.jbpm.process.core.context.variable.Variable) DataTransformer(org.kie.api.runtime.process.DataTransformer) ActionNode(org.jbpm.workflow.core.node.ActionNode) EndNode(org.jbpm.workflow.core.node.EndNode) Logger(org.slf4j.Logger) NodeList(org.w3c.dom.NodeList) Iterator(java.util.Iterator) EventNode(org.jbpm.workflow.core.node.EventNode) COMPLETION_CONDITION(org.jbpm.ruleflow.core.Metadata.COMPLETION_CONDITION) Handler(org.drools.core.xml.Handler) DataTypeResolver(org.jbpm.process.core.datatype.DataTypeResolver) SAXParseException(org.xml.sax.SAXParseException) Element(org.w3c.dom.Element) DataTransformerRegistry(org.jbpm.process.core.impl.DataTransformerRegistry) MAPPING_VARIABLE(org.jbpm.ruleflow.core.Metadata.MAPPING_VARIABLE) Definitions(org.jbpm.bpmn2.core.Definitions) ExtendedNodeImpl(org.jbpm.workflow.core.impl.ExtendedNodeImpl) IOSpecification(org.jbpm.workflow.core.impl.IOSpecification) Element(org.w3c.dom.Element)

Example 3 with ExtensibleXmlParser

use of org.drools.core.xml.ExtensibleXmlParser in project kogito-runtimes by kiegroup.

the class AbstractNodeHandler method readIOEspecification.

protected IOSpecification readIOEspecification(ExtensibleXmlParser parser, Element element) {
    org.w3c.dom.Node xmlNode = element.getFirstChild();
    IOSpecification ioSpec = new IOSpecification();
    while (xmlNode != null) {
        String nodeName = xmlNode.getNodeName();
        if ("ioSpecification".equals(nodeName)) {
            ioSpec.getDataInputs().addAll(readDataInput(parser, xmlNode));
            ioSpec.getDataOutputs().addAll(readDataOutput(parser, xmlNode));
        } else if ("dataInputAssociation".equals(nodeName)) {
            readDataAssociation(parser, (Element) xmlNode, id -> getVariableDataSpec(parser, id), id -> ioSpec.getDataInput().get(id)).ifPresent(e -> ioSpec.getDataInputAssociation().add(e));
        } else if ("dataOutputAssociation".equals(nodeName)) {
            readDataAssociation(parser, (Element) xmlNode, id -> ioSpec.getDataOutput().get(id), id -> getVariableDataSpec(parser, id)).ifPresent(e -> ioSpec.getDataOutputAssociation().add(e));
        }
        xmlNode = xmlNode.getNextSibling();
    }
    return ioSpec;
}
Also used : SequenceFlow(org.jbpm.bpmn2.core.SequenceFlow) ForEachNode(org.jbpm.workflow.core.node.ForEachNode) LoggerFactory(org.slf4j.LoggerFactory) PatternConstants(org.jbpm.util.PatternConstants) NodeImpl(org.jbpm.workflow.core.impl.NodeImpl) Thread.currentThread(java.lang.Thread.currentThread) DroolsConsequenceAction(org.jbpm.workflow.core.impl.DroolsConsequenceAction) ItemDefinition(org.jbpm.bpmn2.core.ItemDefinition) Assignment(org.jbpm.workflow.core.node.Assignment) ExtensibleXmlParser(org.drools.core.xml.ExtensibleXmlParser) Association(org.jbpm.bpmn2.core.Association) StateNode(org.jbpm.workflow.core.node.StateNode) Matcher(java.util.regex.Matcher) ProcessBuildData(org.jbpm.compiler.xml.ProcessBuildData) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) Signal(org.jbpm.bpmn2.core.Signal) Transformation(org.jbpm.workflow.core.node.Transformation) IOSpecification(org.jbpm.workflow.core.impl.IOSpecification) XmlDumper(org.drools.compiler.compiler.xml.XmlDumper) MultiInstanceSpecification(org.jbpm.workflow.core.impl.MultiInstanceSpecification) CatchLinkNode(org.jbpm.workflow.core.node.CatchLinkNode) CompositeContextNode(org.jbpm.workflow.core.node.CompositeContextNode) Collection(java.util.Collection) Set(java.util.Set) UUID(java.util.UUID) VariableScope(org.jbpm.process.core.context.variable.VariableScope) List(java.util.List) Error(org.jbpm.bpmn2.core.Error) ContextContainer(org.jbpm.process.core.ContextContainer) Node(org.jbpm.workflow.core.Node) JavaDialect(org.drools.mvel.java.JavaDialect) SAXException(org.xml.sax.SAXException) Optional(java.util.Optional) MAPPING_VARIABLE_INPUT(org.jbpm.ruleflow.core.Metadata.MAPPING_VARIABLE_INPUT) VARIABLE(org.jbpm.ruleflow.core.Metadata.VARIABLE) RuleFlowProcess(org.jbpm.ruleflow.core.RuleFlowProcess) DataDefinition(org.jbpm.workflow.core.impl.DataDefinition) HashMap(java.util.HashMap) Function(java.util.function.Function) ArrayList(java.util.ArrayList) Lane(org.jbpm.bpmn2.core.Lane) TimerNode(org.jbpm.workflow.core.node.TimerNode) HashSet(java.util.HashSet) DataTypeResolver.fromType(org.jbpm.process.core.datatype.DataTypeResolver.fromType) NodeContainer(org.jbpm.workflow.core.NodeContainer) DataAssociation(org.jbpm.workflow.core.impl.DataAssociation) Attributes(org.xml.sax.Attributes) BaseAbstractHandler(org.drools.core.xml.BaseAbstractHandler) FaultNode(org.jbpm.workflow.core.node.FaultNode) DroolsAction(org.jbpm.workflow.core.DroolsAction) Variable(org.jbpm.process.core.context.variable.Variable) DataTransformer(org.kie.api.runtime.process.DataTransformer) ActionNode(org.jbpm.workflow.core.node.ActionNode) EndNode(org.jbpm.workflow.core.node.EndNode) Logger(org.slf4j.Logger) NodeList(org.w3c.dom.NodeList) Iterator(java.util.Iterator) EventNode(org.jbpm.workflow.core.node.EventNode) COMPLETION_CONDITION(org.jbpm.ruleflow.core.Metadata.COMPLETION_CONDITION) Handler(org.drools.core.xml.Handler) DataTypeResolver(org.jbpm.process.core.datatype.DataTypeResolver) SAXParseException(org.xml.sax.SAXParseException) Element(org.w3c.dom.Element) DataTransformerRegistry(org.jbpm.process.core.impl.DataTransformerRegistry) MAPPING_VARIABLE(org.jbpm.ruleflow.core.Metadata.MAPPING_VARIABLE) Definitions(org.jbpm.bpmn2.core.Definitions) ExtendedNodeImpl(org.jbpm.workflow.core.impl.ExtendedNodeImpl) IOSpecification(org.jbpm.workflow.core.impl.IOSpecification) Element(org.w3c.dom.Element)

Example 4 with ExtensibleXmlParser

use of org.drools.core.xml.ExtensibleXmlParser in project jbpm by kiegroup.

the class StartEventHandler method handleNode.

@Override
@SuppressWarnings("unchecked")
protected void handleNode(final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
    super.handleNode(node, element, uri, localName, parser);
    StartNode startNode = (StartNode) node;
    // TODO: StartEventHandler.handleNode(): the parser doesn't discriminate between the schema default and the actual set value
    // However, while the schema says the "isInterrupting" attr should default to true
    // The spec says that Escalation start events should default to not interrupting..
    startNode.setInterrupting(Boolean.parseBoolean(element.getAttribute("isInterrupting")));
    org.w3c.dom.Node xmlNode = element.getFirstChild();
    while (xmlNode != null) {
        String nodeName = xmlNode.getNodeName();
        if ("dataOutput".equals(nodeName)) {
            readDataOutput(xmlNode);
        } else if ("dataOutputAssociation".equals(nodeName)) {
            readDataOutputAssociation(xmlNode, startNode);
        } else if ("outputSet".equals(nodeName)) {
            // p. 225, BPMN2 spec (2011-01-03)
            // InputSet and OutputSet elements imply that process execution should wait for them to be filled
            // and are therefore not applicable to catch events
            String message = "Ignoring <" + nodeName + "> element: " + "<" + nodeName + "> elements should not be used on start or other catch events.";
            SAXParseException saxpe = new SAXParseException(message, parser.getLocator());
            parser.warning(saxpe);
        // no exception thrown for backwards compatibility (we used to ignore these elements)
        } else if ("conditionalEventDefinition".equals(nodeName)) {
            String constraint = null;
            org.w3c.dom.Node subNode = xmlNode.getFirstChild();
            while (subNode != null) {
                String subnodeName = subNode.getNodeName();
                if ("condition".equals(subnodeName)) {
                    constraint = xmlNode.getTextContent();
                    break;
                }
                subNode = subNode.getNextSibling();
            }
            ConstraintTrigger trigger = new ConstraintTrigger();
            trigger.setConstraint(constraint);
            startNode.addTrigger(trigger);
            break;
        } else if ("signalEventDefinition".equals(nodeName)) {
            String type = ((Element) xmlNode).getAttribute("signalRef");
            type = checkSignalAndConvertToRealSignalNam(parser, type, s -> s.addIncomingNode(node));
            if (type != null && type.trim().length() > 0) {
                addTriggerWithInMappings(startNode, type);
            }
        } else if ("messageEventDefinition".equals(nodeName)) {
            String messageRef = ((Element) xmlNode).getAttribute("messageRef");
            Map<String, Message> messages = (Map<String, Message>) ((ProcessBuildData) parser.getData()).getMetaData("Messages");
            if (messages == null) {
                throw new IllegalArgumentException("No messages found");
            }
            Message message = messages.get(messageRef);
            if (message == null) {
                throw new IllegalArgumentException("Could not find message " + messageRef);
            }
            message.addIncomingNode(node);
            startNode.setMetaData("MessageType", message.getType());
            addTriggerWithInMappings(startNode, "Message-" + message.getName(), message.getId(), ((RuleFlowProcess) parser.getMetaData().get("CurrentProcessDefinition")).getCorrelationManager());
        } else if ("timerEventDefinition".equals(nodeName)) {
            handleTimerNode(startNode, element, uri, localName, parser);
        // following event definitions are only for event sub process and will be validated to not be included in top process definitions
        } else if ("errorEventDefinition".equals(nodeName)) {
            if (!startNode.isInterrupting()) {
                // BPMN2 spec (p.245-246, (2011-01-03)) implies that
                // - a <startEvent> in an Event Sub-Process
                // - *without* the 'isInterupting' attribute always interrupts (containing process)
                String errorMsg = "Error Start Events in an Event Sub-Process always interrupt the containing (sub)process(es).";
                throw new IllegalArgumentException(errorMsg);
            }
            String errorRef = ((Element) xmlNode).getAttribute("errorRef");
            if (errorRef != null && errorRef.trim().length() > 0) {
                List<Error> errors = (List<Error>) ((ProcessBuildData) parser.getData()).getMetaData("Errors");
                if (errors == null) {
                    throw new IllegalArgumentException("No errors found");
                }
                Error error = null;
                for (Error listError : errors) {
                    if (errorRef.equals(listError.getId())) {
                        error = listError;
                    }
                }
                if (error == null) {
                    throw new IllegalArgumentException("Could not find error " + errorRef);
                }
                startNode.setMetaData("FaultCode", error.getErrorCode());
                addTriggerWithInMappings(startNode, "Error-" + error.getErrorCode());
            }
        } else if ("escalationEventDefinition".equals(nodeName)) {
            String escalationRef = ((Element) xmlNode).getAttribute("escalationRef");
            if (escalationRef != null && escalationRef.trim().length() > 0) {
                Map<String, Escalation> escalations = (Map<String, Escalation>) ((ProcessBuildData) parser.getData()).getMetaData(ProcessHandler.ESCALATIONS);
                if (escalations == null) {
                    throw new IllegalArgumentException("No escalations found");
                }
                Escalation escalation = escalations.get(escalationRef);
                if (escalation == null) {
                    throw new IllegalArgumentException("Could not find escalation " + escalationRef);
                }
                addTriggerWithInMappings(startNode, "Escalation-" + escalation.getEscalationCode());
            }
        } else if ("compensateEventDefinition".equals(nodeName)) {
            handleCompensationNode(startNode, xmlNode);
        }
        xmlNode = xmlNode.getNextSibling();
    }
}
Also used : ConstraintTrigger(org.jbpm.workflow.core.node.ConstraintTrigger) EventFilter(org.jbpm.process.core.event.EventFilter) ConstraintTrigger(org.jbpm.workflow.core.node.ConstraintTrigger) CorrelationManager(org.jbpm.process.core.correlation.CorrelationManager) EventTransformerImpl(org.jbpm.process.core.event.EventTransformerImpl) Escalation(org.jbpm.bpmn2.core.Escalation) StartNode(org.jbpm.workflow.core.node.StartNode) DroolsConsequenceAction(org.jbpm.workflow.core.impl.DroolsConsequenceAction) EventSubProcessNode(org.jbpm.workflow.core.node.EventSubProcessNode) ArrayList(java.util.ArrayList) ExtensibleXmlParser(org.drools.core.xml.ExtensibleXmlParser) Timer(org.jbpm.process.core.timer.Timer) ProcessBuildData(org.jbpm.compiler.xml.ProcessBuildData) Map(java.util.Map) Attributes(org.xml.sax.Attributes) EventTrigger(org.jbpm.workflow.core.node.EventTrigger) Transformation(org.jbpm.workflow.core.node.Transformation) XmlDumper(org.drools.compiler.compiler.xml.XmlDumper) DataTransformer(org.kie.api.runtime.process.DataTransformer) NonAcceptingEventTypeFilter(org.jbpm.process.core.event.NonAcceptingEventTypeFilter) Message(org.jbpm.bpmn2.core.Message) List(java.util.List) Error(org.jbpm.bpmn2.core.Error) SAXParseException(org.xml.sax.SAXParseException) EventTypeFilter(org.jbpm.process.core.event.EventTypeFilter) Element(org.w3c.dom.Element) DataTransformerRegistry(org.jbpm.process.core.impl.DataTransformerRegistry) Node(org.jbpm.workflow.core.Node) SAXException(org.xml.sax.SAXException) Trigger(org.jbpm.workflow.core.node.Trigger) RuleFlowProcess(org.jbpm.ruleflow.core.RuleFlowProcess) StartNode(org.jbpm.workflow.core.node.StartNode) RuleFlowProcess(org.jbpm.ruleflow.core.RuleFlowProcess) Message(org.jbpm.bpmn2.core.Message) StartNode(org.jbpm.workflow.core.node.StartNode) EventSubProcessNode(org.jbpm.workflow.core.node.EventSubProcessNode) Node(org.jbpm.workflow.core.Node) Element(org.w3c.dom.Element) Escalation(org.jbpm.bpmn2.core.Escalation) Error(org.jbpm.bpmn2.core.Error) ProcessBuildData(org.jbpm.compiler.xml.ProcessBuildData) SAXParseException(org.xml.sax.SAXParseException) ArrayList(java.util.ArrayList) List(java.util.List) Map(java.util.Map)

Example 5 with ExtensibleXmlParser

use of org.drools.core.xml.ExtensibleXmlParser in project jbpm by kiegroup.

the class IntermediateCatchEventHandler method handleSignalNode.

@SuppressWarnings("unchecked")
protected void handleSignalNode(final Node node, final Element element, final String uri, final String localName, final ExtensibleXmlParser parser) throws SAXException {
    super.handleNode(node, element, uri, localName, parser);
    EventNode eventNode = (EventNode) node;
    org.w3c.dom.Node xmlNode = element.getFirstChild();
    while (xmlNode != null) {
        String nodeName = xmlNode.getNodeName();
        if ("dataOutput".equals(nodeName)) {
            String id = ((Element) xmlNode).getAttribute("id");
            String outputName = ((Element) xmlNode).getAttribute("name");
            dataOutputs.put(id, outputName);
        } else if ("dataOutputAssociation".equals(nodeName)) {
            readDataOutputAssociation(xmlNode, eventNode);
        } else if ("signalEventDefinition".equals(nodeName)) {
            String type = ((Element) xmlNode).getAttribute("signalRef");
            if (type != null && type.trim().length() > 0) {
                type = checkSignalAndConvertToRealSignalNam(parser, type, s -> s.addIncomingNode(node));
                List<EventFilter> eventFilters = new ArrayList<EventFilter>();
                EventTypeFilter eventFilter = new EventTypeFilter();
                eventFilter.setType(type);
                eventFilters.add(eventFilter);
                eventNode.setEventFilters(eventFilters);
            }
        }
        xmlNode = xmlNode.getNextSibling();
    }
}
Also used : EventFilter(org.jbpm.process.core.event.EventFilter) EventTransformerImpl(org.jbpm.process.core.event.EventTransformerImpl) CompositeNode(org.jbpm.workflow.core.node.CompositeNode) ArrayList(java.util.ArrayList) ExtensibleXmlParser(org.drools.core.xml.ExtensibleXmlParser) Timer(org.jbpm.process.core.timer.Timer) TimerNode(org.jbpm.workflow.core.node.TimerNode) NodeContainer(org.jbpm.workflow.core.NodeContainer) StateNode(org.jbpm.workflow.core.node.StateNode) ProcessBuildData(org.jbpm.compiler.xml.ProcessBuildData) Map(java.util.Map) Attributes(org.xml.sax.Attributes) NamedNodeMap(org.w3c.dom.NamedNodeMap) Transformation(org.jbpm.workflow.core.node.Transformation) CatchLinkNode(org.jbpm.workflow.core.node.CatchLinkNode) DataTransformer(org.kie.api.runtime.process.DataTransformer) EventNode(org.jbpm.workflow.core.node.EventNode) IntermediateLink(org.jbpm.bpmn2.core.IntermediateLink) Message(org.jbpm.bpmn2.core.Message) List(java.util.List) EventTypeFilter(org.jbpm.process.core.event.EventTypeFilter) Element(org.w3c.dom.Element) DataTransformerRegistry(org.jbpm.process.core.impl.DataTransformerRegistry) Node(org.jbpm.workflow.core.Node) SAXException(org.xml.sax.SAXException) RuleFlowProcess(org.jbpm.ruleflow.core.RuleFlowProcess) EventNode(org.jbpm.workflow.core.node.EventNode) EventTypeFilter(org.jbpm.process.core.event.EventTypeFilter) Element(org.w3c.dom.Element) ArrayList(java.util.ArrayList) EventFilter(org.jbpm.process.core.event.EventFilter)

Aggregations

List (java.util.List)10 Map (java.util.Map)10 ExtensibleXmlParser (org.drools.core.xml.ExtensibleXmlParser)10 ProcessBuildData (org.jbpm.compiler.xml.ProcessBuildData)10 Attributes (org.xml.sax.Attributes)10 SAXException (org.xml.sax.SAXException)10 ArrayList (java.util.ArrayList)9 Error (org.jbpm.bpmn2.core.Error)9 RuleFlowProcess (org.jbpm.ruleflow.core.RuleFlowProcess)9 DroolsConsequenceAction (org.jbpm.workflow.core.impl.DroolsConsequenceAction)8 EndNode (org.jbpm.workflow.core.node.EndNode)8 EventNode (org.jbpm.workflow.core.node.EventNode)8 FaultNode (org.jbpm.workflow.core.node.FaultNode)8 StateNode (org.jbpm.workflow.core.node.StateNode)8 Collection (java.util.Collection)7 HashMap (java.util.HashMap)7 HashSet (java.util.HashSet)7 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)7 BaseAbstractHandler (org.drools.core.xml.BaseAbstractHandler)7 Handler (org.drools.core.xml.Handler)7