Search in sources :

Example 1 with Error

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.Error in project kie-wb-common by kiegroup.

the class Bpmn2JsonMarshaller method marshallDefinitions.

protected void marshallDefinitions(Definitions def, JsonGenerator generator, String preProcessingData) throws JsonGenerationException, IOException {
    try {
        generator.writeStartObject();
        generator.writeObjectField("resourceId", def.getId());
        /**
         * "properties":{"name":"",
         * "documentation":"",
         * "auditing":"",
         * "monitoring":"",
         * "executable":"true",
         * "package":"com.sample",
         * "vardefs":"a,b,c,d",
         * "lanes" : "a,b,c",
         * "id":"",
         * "version":"",
         * "author":"",
         * "language":"",
         * "namespaces":"",
         * "targetnamespace":"",
         * "expressionlanguage":"",
         * "typelanguage":"",
         * "creationdate":"",
         * "modificationdate":""
         * }
         */
        Map<String, Object> props = new LinkedHashMap<String, Object>();
        props.put(NAMESPACES, "");
        // props.put("targetnamespace", def.getTargetNamespace());
        props.put(TARGETNAMESPACE, "http://www.omg.org/bpmn20");
        props.put(TYPELANGUAGE, def.getTypeLanguage());
        props.put(NAME, StringEscapeUtils.unescapeXml(def.getName()));
        props.put(ID, def.getId());
        props.put(EXPRESSIONLANGUAGE, def.getExpressionLanguage());
        // backwards compat for BZ 1048191
        putDocumentationProperty(def, props);
        for (RootElement rootElement : def.getRootElements()) {
            if (rootElement instanceof Process) {
                // have to wait for process node to finish properties and stencil marshalling
                props.put(EXECUTABLE, ((Process) rootElement).isIsExecutable() + "");
                props.put(ID, rootElement.getId());
                if (rootElement.getDocumentation() != null && rootElement.getDocumentation().size() > 0) {
                    props.put(DOCUMENTATION, rootElement.getDocumentation().get(0).getText());
                }
                Process pr = (Process) rootElement;
                if (pr.getName() != null && pr.getName().length() > 0) {
                    props.put(PROCESSN, StringEscapeUtils.unescapeXml(((Process) rootElement).getName()));
                }
                List<Property> processProperties = ((Process) rootElement).getProperties();
                if (processProperties != null && processProperties.size() > 0) {
                    String propVal = "";
                    for (int i = 0; i < processProperties.size(); i++) {
                        Property p = processProperties.get(i);
                        String pKPI = Utils.getMetaDataValue(p.getExtensionValues(), "customKPI");
                        propVal += p.getId();
                        // check the structureRef value
                        if (p.getItemSubjectRef() != null && p.getItemSubjectRef().getStructureRef() != null) {
                            propVal += ":" + p.getItemSubjectRef().getStructureRef();
                        }
                        if (pKPI != null && pKPI.length() > 0) {
                            propVal += ":" + pKPI;
                        }
                        if (i != processProperties.size() - 1) {
                            propVal += ",";
                        }
                    }
                    props.put("vardefs", propVal);
                }
                // packageName and version and adHoc are jbpm-specific extension attribute
                Iterator<FeatureMap.Entry> iter = ((Process) rootElement).getAnyAttribute().iterator();
                while (iter.hasNext()) {
                    FeatureMap.Entry entry = iter.next();
                    if (entry.getEStructuralFeature().getName().equals("packageName")) {
                        props.put(PACKAGE, entry.getValue());
                    }
                    if (entry.getEStructuralFeature().getName().equals("version")) {
                        props.put(VERSION, entry.getValue());
                    }
                    if (entry.getEStructuralFeature().getName().equals("adHoc")) {
                        props.put(ADHOCPROCESS, entry.getValue());
                    }
                }
                // process imports, custom description and globals extension elements
                String allImports = "";
                if ((rootElement).getExtensionValues() != null && (rootElement).getExtensionValues().size() > 0) {
                    String importsStr = "";
                    String globalsStr = "";
                    for (ExtensionAttributeValue extattrval : rootElement.getExtensionValues()) {
                        FeatureMap extensionElements = extattrval.getValue();
                        @SuppressWarnings("unchecked") List<ImportType> importExtensions = (List<ImportType>) extensionElements.get(DroolsPackage.Literals.DOCUMENT_ROOT__IMPORT, true);
                        @SuppressWarnings("unchecked") List<GlobalType> globalExtensions = (List<GlobalType>) extensionElements.get(DroolsPackage.Literals.DOCUMENT_ROOT__GLOBAL, true);
                        List<MetaDataType> metadataExtensions = (List<MetaDataType>) extensionElements.get(DroolsPackage.Literals.DOCUMENT_ROOT__META_DATA, true);
                        for (ImportType importType : importExtensions) {
                            importsStr += importType.getName();
                            importsStr += "|default,";
                        }
                        for (GlobalType globalType : globalExtensions) {
                            globalsStr += (globalType.getIdentifier() + ":" + globalType.getType());
                            globalsStr += ",";
                        }
                        for (MetaDataType metaType : metadataExtensions) {
                            props.put("customdescription", metaType.getMetaValue());
                        }
                    }
                    allImports += importsStr;
                    if (globalsStr.length() > 0) {
                        if (globalsStr.endsWith(",")) {
                            globalsStr = globalsStr.substring(0, globalsStr.length() - 1);
                        }
                        props.put(GLOBALS, globalsStr);
                    }
                }
                // definitions imports (wsdl)
                List<org.eclipse.bpmn2.Import> wsdlImports = def.getImports();
                if (wsdlImports != null) {
                    for (org.eclipse.bpmn2.Import imp : wsdlImports) {
                        allImports += imp.getLocation() + "|" + imp.getNamespace() + "|wsdl,";
                    }
                }
                if (allImports.endsWith(",")) {
                    allImports = allImports.substring(0, allImports.length() - 1);
                }
                props.put(IMPORTS, allImports);
                // simulation
                if (_simulationScenario != null && _simulationScenario.getScenarioParameters() != null) {
                    props.put(CURRENCY, _simulationScenario.getScenarioParameters().getBaseCurrencyUnit() == null ? "" : _simulationScenario.getScenarioParameters().getBaseCurrencyUnit());
                    props.put(TIMEUNIT, _simulationScenario.getScenarioParameters().getBaseTimeUnit().getName());
                }
                marshallProperties(props, generator);
                marshallStencil("BPMNDiagram", generator);
                linkSequenceFlows(((Process) rootElement).getFlowElements());
                marshallProcess((Process) rootElement, def, generator, preProcessingData);
            } else if (rootElement instanceof Interface) {
            // TODO
            } else if (rootElement instanceof ItemDefinition) {
            // TODO
            } else if (rootElement instanceof Resource) {
            // TODO
            } else if (rootElement instanceof Error) {
            // TODO
            } else if (rootElement instanceof Message) {
            // TODO
            } else if (rootElement instanceof Signal) {
            // TODO
            } else if (rootElement instanceof Escalation) {
            // TODO
            } else if (rootElement instanceof Collaboration) {
            } else {
                _logger.warn("Unknown root element " + rootElement + ". This element will not be parsed.");
            }
        }
        generator.writeObjectFieldStart("stencilset");
        generator.writeObjectField("url", this.profile.getStencilSetURL());
        generator.writeObjectField("namespace", this.profile.getStencilSetNamespaceURL());
        generator.writeEndObject();
        generator.writeArrayFieldStart("ssextensions");
        generator.writeObject(this.profile.getStencilSetExtensionURL());
        generator.writeEndArray();
        generator.writeEndObject();
    } finally {
        _diagramElements.clear();
    }
}
Also used : Message(org.eclipse.bpmn2.Message) Escalation(org.eclipse.bpmn2.Escalation) ItemDefinition(org.eclipse.bpmn2.ItemDefinition) AdHocSubProcess(org.eclipse.bpmn2.AdHocSubProcess) Process(org.eclipse.bpmn2.Process) SubProcess(org.eclipse.bpmn2.SubProcess) ExtensionAttributeValue(org.eclipse.bpmn2.ExtensionAttributeValue) LinkedHashMap(java.util.LinkedHashMap) Entry(java.util.Map.Entry) Signal(org.eclipse.bpmn2.Signal) MetaDataType(org.jboss.drools.MetaDataType) ArrayList(java.util.ArrayList) List(java.util.List) EList(org.eclipse.emf.common.util.EList) Property(org.eclipse.bpmn2.Property) ImportType(org.jboss.drools.ImportType) Resource(org.eclipse.bpmn2.Resource) Error(org.eclipse.bpmn2.Error) Point(org.eclipse.dd.dc.Point) FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) RootElement(org.eclipse.bpmn2.RootElement) Collaboration(org.eclipse.bpmn2.Collaboration) DataObject(org.eclipse.bpmn2.DataObject) Interface(org.eclipse.bpmn2.Interface) GlobalType(org.jboss.drools.GlobalType)

Example 2 with Error

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.Error in project kie-wb-common by kiegroup.

the class Bpmn2JsonUnmarshaller method setThrowEventsInfoForLanes.

public void setThrowEventsInfoForLanes(Lane lane, Definitions def, List<RootElement> rootElements, List<Signal> toAddSignals, Set<Error> toAddErrors, Set<Escalation> toAddEscalations, Set<Message> toAddMessages, Set<ItemDefinition> toAddItemDefinitions) {
    List<FlowNode> laneFlowNodes = lane.getFlowNodeRefs();
    for (FlowNode fe : laneFlowNodes) {
        if (fe instanceof ThrowEvent) {
            if (((ThrowEvent) fe).getEventDefinitions().size() > 0) {
                EventDefinition ed = ((ThrowEvent) fe).getEventDefinitions().get(0);
                if (ed instanceof SignalEventDefinition) {
                    SignalEventDefinition sed = (SignalEventDefinition) ed;
                    if (sed.getSignalRef() != null && sed.getSignalRef().length() > 0) {
                        String signalRef = sed.getSignalRef();
                        boolean shouldAddSignal = true;
                        for (RootElement re : rootElements) {
                            if (re instanceof Signal) {
                                if (((Signal) re).getName().equals(signalRef)) {
                                    shouldAddSignal = false;
                                    break;
                                }
                            }
                        }
                        if (toAddSignals != null) {
                            for (Signal s : toAddSignals) {
                                if (s.getName().equals(signalRef)) {
                                    shouldAddSignal = false;
                                    break;
                                }
                            }
                        }
                        if (shouldAddSignal) {
                            Signal signal = Bpmn2Factory.eINSTANCE.createSignal();
                            signal.setName(signalRef);
                            toAddSignals.add(signal);
                        }
                    }
                } else if (ed instanceof ErrorEventDefinition) {
                    String errorCode = null;
                    String errorId = null;
                    Iterator<FeatureMap.Entry> iter = ed.getAnyAttribute().iterator();
                    while (iter.hasNext()) {
                        FeatureMap.Entry entry = iter.next();
                        if (entry.getEStructuralFeature().getName().equals("erefname")) {
                            errorId = (String) entry.getValue();
                            errorCode = (String) entry.getValue();
                        }
                    }
                    Error err = this._errors.get(errorCode);
                    if (err == null) {
                        err = Bpmn2Factory.eINSTANCE.createError();
                        err.setId(errorId);
                        err.setErrorCode(errorCode);
                        this._errors.put(errorCode, err);
                    }
                    toAddErrors.add(err);
                    ((ErrorEventDefinition) ed).setErrorRef(err);
                } else if (ed instanceof EscalationEventDefinition) {
                    String escalationCode = null;
                    Iterator<FeatureMap.Entry> iter = ed.getAnyAttribute().iterator();
                    while (iter.hasNext()) {
                        FeatureMap.Entry entry = iter.next();
                        if (entry.getEStructuralFeature().getName().equals("esccode")) {
                            escalationCode = (String) entry.getValue();
                            break;
                        }
                    }
                    Escalation escalation = this._escalations.get(escalationCode);
                    if (escalation == null) {
                        escalation = Bpmn2Factory.eINSTANCE.createEscalation();
                        escalation.setEscalationCode(escalationCode);
                        this._escalations.put(escalationCode, escalation);
                    }
                    toAddEscalations.add(escalation);
                    ((EscalationEventDefinition) ed).setEscalationRef(escalation);
                } else if (ed instanceof MessageEventDefinition) {
                    ((MessageEventDefinition) ed).setMessageRef(extractMessage(ed, toAddMessages, toAddItemDefinitions));
                } else if (ed instanceof CompensateEventDefinition) {
                    Iterator<FeatureMap.Entry> iter = ed.getAnyAttribute().iterator();
                    while (iter.hasNext()) {
                        FeatureMap.Entry entry = iter.next();
                        if (entry.getEStructuralFeature().getName().equals("actrefname")) {
                            String activityNameRef = (String) entry.getValue();
                            // we have to iterate again through all flow
                            // elements
                            // in order to find our activity name
                            List<RootElement> re = def.getRootElements();
                            for (RootElement r : re) {
                                if (r instanceof Process) {
                                    Process p = (Process) r;
                                    List<FlowElement> fes = p.getFlowElements();
                                    for (FlowElement f : fes) {
                                        if (f instanceof Activity && ((Activity) f).getName().equals(activityNameRef)) {
                                            ((CompensateEventDefinition) ed).setActivityRef((Activity) f);
                                            ((Activity) f).setIsForCompensation(true);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        } else if (fe instanceof FlowElementsContainer) {
            setThrowEventsInfo((FlowElementsContainer) fe, def, rootElements, toAddSignals, toAddErrors, toAddEscalations, toAddMessages, toAddItemDefinitions);
        }
    }
}
Also used : Escalation(org.eclipse.bpmn2.Escalation) Activity(org.eclipse.bpmn2.Activity) CallActivity(org.eclipse.bpmn2.CallActivity) AdHocSubProcess(org.eclipse.bpmn2.AdHocSubProcess) SubProcess(org.eclipse.bpmn2.SubProcess) Process(org.eclipse.bpmn2.Process) EventDefinition(org.eclipse.bpmn2.EventDefinition) ConditionalEventDefinition(org.eclipse.bpmn2.ConditionalEventDefinition) EscalationEventDefinition(org.eclipse.bpmn2.EscalationEventDefinition) MessageEventDefinition(org.eclipse.bpmn2.MessageEventDefinition) ErrorEventDefinition(org.eclipse.bpmn2.ErrorEventDefinition) SignalEventDefinition(org.eclipse.bpmn2.SignalEventDefinition) CompensateEventDefinition(org.eclipse.bpmn2.CompensateEventDefinition) TimerEventDefinition(org.eclipse.bpmn2.TimerEventDefinition) Signal(org.eclipse.bpmn2.Signal) Entry(java.util.Map.Entry) SimpleFeatureMapEntry(org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry) Iterator(java.util.Iterator) SignalEventDefinition(org.eclipse.bpmn2.SignalEventDefinition) ThrowEvent(org.eclipse.bpmn2.ThrowEvent) Error(org.eclipse.bpmn2.Error) FlowElementsContainer(org.eclipse.bpmn2.FlowElementsContainer) FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) RootElement(org.eclipse.bpmn2.RootElement) EscalationEventDefinition(org.eclipse.bpmn2.EscalationEventDefinition) FlowElement(org.eclipse.bpmn2.FlowElement) ErrorEventDefinition(org.eclipse.bpmn2.ErrorEventDefinition) MessageEventDefinition(org.eclipse.bpmn2.MessageEventDefinition) CompensateEventDefinition(org.eclipse.bpmn2.CompensateEventDefinition) FlowNode(org.eclipse.bpmn2.FlowNode)

Example 3 with Error

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.Error in project kie-wb-common by kiegroup.

the class Bpmn2JsonUnmarshaller method setCatchEventsInfo.

public void setCatchEventsInfo(FlowElementsContainer container, Definitions def, List<Signal> toAddSignals, Set<Error> toAddErrors, Set<Escalation> toAddEscalations, Set<Message> toAddMessages, Set<ItemDefinition> toAddItemDefinitions) {
    List<FlowElement> flowElements = container.getFlowElements();
    for (FlowElement fe : flowElements) {
        if (fe instanceof CatchEvent) {
            if (((CatchEvent) fe).getEventDefinitions().size() > 0) {
                EventDefinition ed = ((CatchEvent) fe).getEventDefinitions().get(0);
                if (ed instanceof SignalEventDefinition) {
                    SignalEventDefinition sed = (SignalEventDefinition) ed;
                    if (sed.getSignalRef() != null && sed.getSignalRef().length() > 0) {
                        String signalRef = sed.getSignalRef();
                        boolean shouldAddSignal = true;
                        List<RootElement> rootElements = def.getRootElements();
                        for (RootElement re : rootElements) {
                            if (re instanceof Signal) {
                                if (((Signal) re).getName().equals(signalRef)) {
                                    shouldAddSignal = false;
                                    break;
                                }
                            }
                        }
                        if (toAddSignals != null) {
                            for (Signal s : toAddSignals) {
                                if (s.getName().equals(signalRef)) {
                                    shouldAddSignal = false;
                                    break;
                                }
                            }
                        }
                        if (shouldAddSignal) {
                            Signal signal = Bpmn2Factory.eINSTANCE.createSignal();
                            signal.setName(signalRef);
                            toAddSignals.add(signal);
                        }
                    }
                } else if (ed instanceof ErrorEventDefinition) {
                    String errorCode = null;
                    String errorId = null;
                    Iterator<FeatureMap.Entry> iter = ed.getAnyAttribute().iterator();
                    while (iter.hasNext()) {
                        FeatureMap.Entry entry = iter.next();
                        if (entry.getEStructuralFeature().getName().equals("erefname")) {
                            errorId = (String) entry.getValue();
                            errorCode = (String) entry.getValue();
                        }
                    }
                    Error err = this._errors.get(errorCode);
                    if (err == null) {
                        err = Bpmn2Factory.eINSTANCE.createError();
                        err.setId(errorId);
                        err.setErrorCode(errorCode);
                        this._errors.put(errorCode, err);
                    }
                    toAddErrors.add(err);
                    ((ErrorEventDefinition) ed).setErrorRef(err);
                } else if (ed instanceof EscalationEventDefinition) {
                    String escalationCode = null;
                    Iterator<FeatureMap.Entry> iter = ed.getAnyAttribute().iterator();
                    while (iter.hasNext()) {
                        FeatureMap.Entry entry = iter.next();
                        if (entry.getEStructuralFeature().getName().equals("esccode")) {
                            escalationCode = (String) entry.getValue();
                            break;
                        }
                    }
                    Escalation escalation = this._escalations.get(escalationCode);
                    if (escalation == null) {
                        escalation = Bpmn2Factory.eINSTANCE.createEscalation();
                        escalation.setEscalationCode(escalationCode);
                        this._escalations.put(escalationCode, escalation);
                    }
                    toAddEscalations.add(escalation);
                    ((EscalationEventDefinition) ed).setEscalationRef(escalation);
                } else if (ed instanceof MessageEventDefinition) {
                    ((MessageEventDefinition) ed).setMessageRef(extractMessage(ed, toAddMessages, toAddItemDefinitions));
                } else if (ed instanceof CompensateEventDefinition) {
                    Iterator<FeatureMap.Entry> iter = ed.getAnyAttribute().iterator();
                    while (iter.hasNext()) {
                        FeatureMap.Entry entry = iter.next();
                        if (entry.getEStructuralFeature().getName().equals("actrefname")) {
                            String activityNameRef = (String) entry.getValue();
                            // we have to iterate again through all flow elements
                            // in order to find our activity name
                            List<RootElement> re = def.getRootElements();
                            for (RootElement r : re) {
                                if (r instanceof Process) {
                                    Process p = (Process) r;
                                    List<FlowElement> fes = p.getFlowElements();
                                    for (FlowElement f : fes) {
                                        if (f instanceof Activity && ((Activity) f).getName().equals(activityNameRef)) {
                                            ((CompensateEventDefinition) ed).setActivityRef((Activity) f);
                                            ((Activity) f).setIsForCompensation(true);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        } else if (fe instanceof FlowElementsContainer) {
            setCatchEventsInfo((FlowElementsContainer) fe, def, toAddSignals, toAddErrors, toAddEscalations, toAddMessages, toAddItemDefinitions);
        }
    }
}
Also used : Escalation(org.eclipse.bpmn2.Escalation) Error(org.eclipse.bpmn2.Error) Activity(org.eclipse.bpmn2.Activity) CallActivity(org.eclipse.bpmn2.CallActivity) FlowElementsContainer(org.eclipse.bpmn2.FlowElementsContainer) AdHocSubProcess(org.eclipse.bpmn2.AdHocSubProcess) SubProcess(org.eclipse.bpmn2.SubProcess) Process(org.eclipse.bpmn2.Process) CatchEvent(org.eclipse.bpmn2.CatchEvent) EventDefinition(org.eclipse.bpmn2.EventDefinition) ConditionalEventDefinition(org.eclipse.bpmn2.ConditionalEventDefinition) EscalationEventDefinition(org.eclipse.bpmn2.EscalationEventDefinition) MessageEventDefinition(org.eclipse.bpmn2.MessageEventDefinition) ErrorEventDefinition(org.eclipse.bpmn2.ErrorEventDefinition) SignalEventDefinition(org.eclipse.bpmn2.SignalEventDefinition) CompensateEventDefinition(org.eclipse.bpmn2.CompensateEventDefinition) TimerEventDefinition(org.eclipse.bpmn2.TimerEventDefinition) FeatureMap(org.eclipse.emf.ecore.util.FeatureMap) Signal(org.eclipse.bpmn2.Signal) Entry(java.util.Map.Entry) SimpleFeatureMapEntry(org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry) RootElement(org.eclipse.bpmn2.RootElement) EscalationEventDefinition(org.eclipse.bpmn2.EscalationEventDefinition) FlowElement(org.eclipse.bpmn2.FlowElement) ErrorEventDefinition(org.eclipse.bpmn2.ErrorEventDefinition) Iterator(java.util.Iterator) SignalEventDefinition(org.eclipse.bpmn2.SignalEventDefinition) MessageEventDefinition(org.eclipse.bpmn2.MessageEventDefinition) CompensateEventDefinition(org.eclipse.bpmn2.CompensateEventDefinition)

Example 4 with Error

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.Error in project kie-wb-common by kiegroup.

the class Bpmn2JsonUnmarshaller method revisitThrowEvents.

/**
 * Updates event definitions for all throwing events.
 * @param def Definitions
 */
public void revisitThrowEvents(Definitions def) {
    List<RootElement> rootElements = def.getRootElements();
    List<Signal> toAddSignals = new ArrayList<Signal>();
    Set<Error> toAddErrors = new HashSet<Error>();
    Set<Escalation> toAddEscalations = new HashSet<Escalation>();
    Set<Message> toAddMessages = new HashSet<Message>();
    Set<ItemDefinition> toAddItemDefinitions = new HashSet<ItemDefinition>();
    for (RootElement root : rootElements) {
        if (root instanceof Process) {
            setThrowEventsInfo((Process) root, def, rootElements, toAddSignals, toAddErrors, toAddEscalations, toAddMessages, toAddItemDefinitions);
        }
    }
    for (Lane lane : _lanes) {
        setThrowEventsInfoForLanes(lane, def, rootElements, toAddSignals, toAddErrors, toAddEscalations, toAddMessages, toAddItemDefinitions);
    }
    for (Signal s : toAddSignals) {
        def.getRootElements().add(s);
    }
    for (Error er : toAddErrors) {
        def.getRootElements().add(er);
    }
    for (Escalation es : toAddEscalations) {
        def.getRootElements().add(es);
    }
    for (ItemDefinition idef : toAddItemDefinitions) {
        def.getRootElements().add(idef);
    }
    for (Message msg : toAddMessages) {
        def.getRootElements().add(msg);
    }
}
Also used : Message(org.eclipse.bpmn2.Message) Escalation(org.eclipse.bpmn2.Escalation) ArrayList(java.util.ArrayList) ItemDefinition(org.eclipse.bpmn2.ItemDefinition) Lane(org.eclipse.bpmn2.Lane) Error(org.eclipse.bpmn2.Error) AdHocSubProcess(org.eclipse.bpmn2.AdHocSubProcess) SubProcess(org.eclipse.bpmn2.SubProcess) Process(org.eclipse.bpmn2.Process) Signal(org.eclipse.bpmn2.Signal) RootElement(org.eclipse.bpmn2.RootElement) HashSet(java.util.HashSet)

Example 5 with Error

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.Error in project kie-wb-common by kiegroup.

the class Bpmn2JsonUnmarshaller method revisitCatchEvents.

/**
 * Updates event definitions for all catch events.
 * @param def Definitions
 */
public void revisitCatchEvents(Definitions def) {
    List<RootElement> rootElements = def.getRootElements();
    List<Signal> toAddSignals = new ArrayList<Signal>();
    Set<Error> toAddErrors = new HashSet<Error>();
    Set<Escalation> toAddEscalations = new HashSet<Escalation>();
    Set<Message> toAddMessages = new HashSet<Message>();
    Set<ItemDefinition> toAddItemDefinitions = new HashSet<ItemDefinition>();
    for (RootElement root : rootElements) {
        if (root instanceof Process) {
            setCatchEventsInfo((Process) root, def, toAddSignals, toAddErrors, toAddEscalations, toAddMessages, toAddItemDefinitions);
        }
    }
    for (Lane lane : _lanes) {
        setCatchEventsInfoForLanes(lane, def, toAddSignals, toAddErrors, toAddEscalations, toAddMessages, toAddItemDefinitions);
    }
    for (Signal s : toAddSignals) {
        def.getRootElements().add(s);
    }
    for (Error er : toAddErrors) {
        def.getRootElements().add(er);
    }
    for (Escalation es : toAddEscalations) {
        def.getRootElements().add(es);
    }
    for (ItemDefinition idef : toAddItemDefinitions) {
        def.getRootElements().add(idef);
    }
    for (Message msg : toAddMessages) {
        def.getRootElements().add(msg);
    }
}
Also used : Message(org.eclipse.bpmn2.Message) Escalation(org.eclipse.bpmn2.Escalation) ArrayList(java.util.ArrayList) ItemDefinition(org.eclipse.bpmn2.ItemDefinition) Lane(org.eclipse.bpmn2.Lane) Error(org.eclipse.bpmn2.Error) AdHocSubProcess(org.eclipse.bpmn2.AdHocSubProcess) SubProcess(org.eclipse.bpmn2.SubProcess) Process(org.eclipse.bpmn2.Process) Signal(org.eclipse.bpmn2.Signal) RootElement(org.eclipse.bpmn2.RootElement) HashSet(java.util.HashSet)

Aggregations

RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)81 ArrayList (java.util.ArrayList)65 ExecutionException (java.util.concurrent.ExecutionException)61 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)41 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)30 BigInteger (java.math.BigInteger)29 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)25 List (java.util.List)24 Optional (com.google.common.base.Optional)23 Test (org.junit.Test)22 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)22 RpcError (org.opendaylight.yangtools.yang.common.RpcError)20 Logger (org.slf4j.Logger)20 LoggerFactory (org.slf4j.LoggerFactory)20 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)19 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)17 TransactionCommitFailedException (org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException)17 ManagedNewTransactionRunner (org.opendaylight.genius.infra.ManagedNewTransactionRunner)16 Nonnull (javax.annotation.Nonnull)15 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)15