Ejemplo n.º 1
0
        protected internal virtual void ParseChildElements(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model, BaseChildElementParser parser)
        {
            bool readyWithChildElements = false;

            while (!readyWithChildElements && xtr.HasNext())
            {
                //xtr.next();
                if (xtr.IsStartElement())
                {
                    if (parser.ElementName.Equals(xtr.LocalName))
                    {
                        parser.ParseChildElement(xtr, parentElement, model);
                    }
                }
                else if (xtr.EndElement && ElementName.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase))
                {
                    readyWithChildElements = true;
                }

                if (xtr.IsEmptyElement && ElementName.Equals(xtr.LocalName, StringComparison.OrdinalIgnoreCase))
                {
                    readyWithChildElements = true;
                }
            }
        }
Ejemplo n.º 2
0
        public virtual void Parse(XMLStreamReader xtr, BpmnModel model)
        {
            if (!string.IsNullOrWhiteSpace(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_ID)))
            {
                string itemDefinitionId = model.TargetNamespace + ":" + xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_ID);
                string structureRef     = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_STRUCTURE_REF);
                if (!string.IsNullOrWhiteSpace(structureRef))
                {
                    ItemDefinition item = new ItemDefinition();
                    item.Id = itemDefinitionId;
                    BpmnXMLUtil.AddXMLLocation(item, xtr);

                    int indexOfP = structureRef.IndexOf(':');
                    if (indexOfP != -1)
                    {
                        string prefix            = structureRef.Substring(0, indexOfP);
                        string resolvedNamespace = model.GetNamespace(prefix);
                        structureRef = resolvedNamespace + ":" + structureRef.Substring(indexOfP + 1);
                    }
                    else
                    {
                        structureRef = model.TargetNamespace + ":" + structureRef;
                    }

                    item.StructureRef = structureRef;
                    item.ItemKind     = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_ITEM_KIND);
                    BpmnXMLUtil.ParseChildElements(BpmnXMLConstants.ELEMENT_ITEM_DEFINITION, item, xtr, model);
                    model.AddItemDefinition(itemDefinitionId, item);
                }
            }
        }
Ejemplo n.º 3
0
        public virtual void Parse(XMLStreamReader xtr, BpmnModel model)
        {
            string resourceId   = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_ID);
            string resourceName = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_NAME);

            Resource resource;

            if (model.ContainsResourceId(resourceId))
            {
                resource      = model.GetResource(resourceId);
                resource.Name = resourceName;
                foreach (Process process in model.Processes)
                {
                    foreach (FlowElement fe in process.FlowElements)
                    {
                        if (fe is UserTask && ((UserTask)fe).CandidateGroups.Contains(resourceId))
                        {
                            ((UserTask)fe).CandidateGroups.Remove(resourceId);
                            ((UserTask)fe).CandidateGroups.Add(resourceName);
                        }
                    }
                }
            }
            else
            {
                resource = new Resource(resourceId, resourceName);
                model.AddResource(resource);
            }

            BpmnXMLUtil.AddXMLLocation(resource, xtr);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Reads and trims the element text and returns it or {@code null}
        /// </summary>
        /// <param name="reader">  source for the element text </param>
        /// <returns> the string representing the trimmed element text or {@code null} if there is none or it is an empty string </returns>
        /// <exception cref="XMLStreamException"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public String rawElementText(javax.xml.stream.XMLStreamReader reader) throws javax.xml.stream.XMLStreamException
        public virtual string rawElementText(XMLStreamReader reader)
        {
            string elementText = reader.ElementText;

            elementText = string.ReferenceEquals(elementText, null) || elementText.Trim().Length == 0 ? null : elementText.Trim();
            return(elementText);
        }
Ejemplo n.º 5
0
        public virtual void Parse(XMLStreamReader xtr, BpmnModel model)
        {
            model.TargetNamespace = xtr.GetAttributeValue(BpmnXMLConstants.TARGET_NAMESPACE_ATTRIBUTE);
            for (int i = 0; i < xtr.NamespaceCount; i++)
            {
                string prefix = xtr.GetNamespacePrefix(i);
                if (!string.IsNullOrWhiteSpace(prefix))
                {
                    model.AddNamespace(prefix, xtr.GetNamespaceURI(i));
                }
            }

            for (int i = 0; i < xtr.AttributeCount; i++)
            {
                var attr = xtr.element.Attributes().ElementAt(i);
                ExtensionAttribute extensionAttribute = new ExtensionAttribute
                {
                    Name  = attr.Name.LocalName,
                    Value = attr.Value
                };
                if (!string.IsNullOrWhiteSpace(attr.Name.NamespaceName))
                {
                    extensionAttribute.Namespace = attr.Name.NamespaceName;
                }
                if (!string.IsNullOrWhiteSpace(xtr.element.GetPrefixOfNamespace(attr.Name.Namespace)))
                {
                    extensionAttribute.NamespacePrefix = xtr.element.GetPrefixOfNamespace(attr.Name.Namespace);
                }
                if (!BpmnXMLUtil.IsBlacklisted(extensionAttribute, defaultAttributes))
                {
                    model.AddDefinitionsAttribute(extensionAttribute);
                }
            }
        }
Ejemplo n.º 6
0
        public override void ParseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model)
        {
            if (!(parentElement is Activity))
            {
                return;
            }

            string errorCode       = xtr.GetAttributeValue(BpmnXMLConstants.MAP_EXCEPTION_ERRORCODE);
            string andChildren     = xtr.GetAttributeValue(BpmnXMLConstants.MAP_EXCEPTION_ANDCHILDREN);
            string exceptionClass  = xtr.ElementText;
            bool   hasChildrenBool = false;

            if (string.IsNullOrWhiteSpace(andChildren) || andChildren.ToLower().Equals("false"))
            {
                hasChildrenBool = false;
            }
            else if (andChildren.ToLower().Equals("true"))
            {
                hasChildrenBool = true;
            }
            else
            {
                throw new XMLException("'" + andChildren + "' is not valid boolean in mapException with errorCode=" + errorCode + " and class=" + exceptionClass);
            }

            if (string.IsNullOrWhiteSpace(errorCode) || string.IsNullOrWhiteSpace(errorCode.Trim()))
            {
                throw new XMLException("No errorCode defined mapException with errorCode=" + errorCode + " and class=" + exceptionClass);
            }

            ((Activity)parentElement).MapExceptions.Add(new MapExceptionEntry(errorCode, exceptionClass, hasChildrenBool));
        }
Ejemplo n.º 7
0
        public virtual void Parse(XMLStreamReader xtr, BpmnModel model)
        {
            string id = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_ID);

            if (!string.IsNullOrWhiteSpace(id))
            {
                DataStore dataStore = new DataStore();
                dataStore.Id = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_ID);

                string name = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_NAME);
                if (!string.IsNullOrWhiteSpace(name))
                {
                    dataStore.Name = name;
                }

                string itemSubjectRef = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_ITEM_SUBJECT_REF);
                if (!string.IsNullOrWhiteSpace(itemSubjectRef))
                {
                    dataStore.ItemSubjectRef = itemSubjectRef;
                }

                BpmnXMLUtil.AddXMLLocation(dataStore, xtr);

                model.AddDataStore(dataStore.Id, dataStore);

                BpmnXMLUtil.ParseChildElements(BpmnXMLConstants.ELEMENT_DATA_STORE, dataStore, xtr, model);
            }
        }
        protected internal virtual void ParseTerminateMultiInstanceAttribute(XMLStreamReader xtr, TerminateEventDefinition eventDefinition)
        {
            string terminateMiValue = xtr.GetAttributeValue(BpmnXMLConstants.ACTIVITI_EXTENSIONS_NAMESPACE, BpmnXMLConstants.ATTRIBUTE_TERMINATE_MULTI_INSTANCE);

            if (!(terminateMiValue is null) && "true".Equals(terminateMiValue))
            {
                eventDefinition.TerminateMultiInstance = true;
            }
        public override void ParseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model)
        {
            if (!(parentElement is SequenceFlow))
            {
                return;
            }

            ((SequenceFlow)parentElement).ConditionExpression = xtr.ElementText.Trim();
        }
Ejemplo n.º 10
0
        public virtual void Parse(XMLStreamReader xtr, BpmnModel model)
        {
            string id = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_DI_BPMNELEMENT);
            IList <GraphicInfo> wayPointList = new List <GraphicInfo>();

            while (xtr.HasNext())
            {
                //xtr.next();

                if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_DI_LABEL.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase))
                {
                    while (xtr.HasNext())
                    {
                        //xtr.next();

                        if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_DI_BOUNDS.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase))
                        {
                            GraphicInfo graphicInfo = new GraphicInfo();
                            BpmnXMLUtil.AddXMLLocation(graphicInfo, xtr);
                            graphicInfo.X      = Convert.ToDouble(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_DI_X));
                            graphicInfo.Y      = Convert.ToDouble(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_DI_Y));
                            graphicInfo.Width  = Convert.ToDouble(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_DI_WIDTH));
                            graphicInfo.Height = Convert.ToDouble(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_DI_HEIGHT));
                            model.AddLabelGraphicInfo(id, graphicInfo);
                            break;
                        }
                        else if (xtr.EndElement && BpmnXMLConstants.ELEMENT_DI_LABEL.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase))
                        {
                            break;
                        }

                        if (xtr.IsEmptyElement && BpmnXMLConstants.ELEMENT_DI_LABEL.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase))
                        {
                            break;
                        }
                    }
                }
                else if (xtr.IsStartElement() && BpmnXMLConstants.ELEMENT_DI_WAYPOINT.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase))
                {
                    GraphicInfo graphicInfo = new GraphicInfo();
                    BpmnXMLUtil.AddXMLLocation(graphicInfo, xtr);
                    graphicInfo.X = Convert.ToDouble(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_DI_X));
                    graphicInfo.Y = Convert.ToDouble(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_DI_Y));
                    wayPointList.Add(graphicInfo);
                }
                else if (xtr.EndElement && BpmnXMLConstants.ELEMENT_DI_EDGE.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase))
                {
                    break;
                }

                if (xtr.IsEmptyElement && BpmnXMLConstants.ELEMENT_DI_EDGE.Equals(xtr.LocalName, StringComparison.CurrentCultureIgnoreCase))
                {
                    break;
                }
            }
            model.AddFlowGraphicInfoList(id, wayPointList);
        }
Ejemplo n.º 11
0
        public override void ParseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model)
        {
            if (!(parentElement is TextAnnotation))
            {
                return;
            }

            ((TextAnnotation)parentElement).Text = xtr.ElementText;
        }
Ejemplo n.º 12
0
        public override void ParseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model)
        {
            if (!(parentElement is ScriptTask))
            {
                return;
            }

            ((ScriptTask)parentElement).Script = xtr.ElementText;
        }
Ejemplo n.º 13
0
        public virtual void Parse(XMLStreamReader xtr, BpmnModel model)
        {
            Import importObject = new Import();

            BpmnXMLUtil.AddXMLLocation(importObject, xtr);
            importObject.ImportType = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_IMPORT_TYPE);
            importObject.Namespace  = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_NAMESPACE);
            importObject.Location   = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_LOCATION);
            model.Imports.Add(importObject);
        }
Ejemplo n.º 14
0
        // find the start element and parses the name
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private static String parseElementName(javax.xml.stream.XMLStreamReader reader) throws javax.xml.stream.XMLStreamException
        private static string parseElementName(XMLStreamReader reader)
        {
            int @event = reader.EventType;

            while (@event != XMLStreamConstants.START_ELEMENT)
            {
                @event = reader.next();
            }
            return(reader.LocalName);
        }
Ejemplo n.º 15
0
        public override void ParseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model)
        {
            if (!(parentElement is Lane))
            {
                return;
            }

            Lane lane = (Lane)parentElement;

            lane.FlowReferences.Add(xtr.ElementText);
        }
Ejemplo n.º 16
0
        public virtual void Parse(XMLStreamReader xtr, Process activeProcess, BpmnModel model)
        {
            Lane lane = new Lane();

            BpmnXMLUtil.AddXMLLocation(lane, xtr);
            lane.Id            = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_ID);
            lane.Name          = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_NAME);
            lane.ParentProcess = activeProcess;
            activeProcess.Lanes.Add(lane);
            BpmnXMLUtil.ParseChildElements(BpmnXMLConstants.ELEMENT_LANE, lane, xtr, model);
        }
Ejemplo n.º 17
0
        public override void ParseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model)
        {
            if (!(parentElement is TimerEventDefinition))
            {
                return;
            }

            TimerEventDefinition eventDefinition = (TimerEventDefinition)parentElement;

            eventDefinition.TimeDate = xtr.ElementText;
        }
        public override void ParseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model)
        {
            if (!(parentElement is Event))
            {
                return;
            }
            CancelEventDefinition eventDefinition = new CancelEventDefinition();

            BpmnXMLUtil.AddXMLLocation(eventDefinition, xtr);
            ((Event)parentElement).EventDefinitions.Add(eventDefinition);
        }
Ejemplo n.º 19
0
 public override void ParseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model)
 {
     if (parentElement is DataStore)
     {
         ((DataStore)parentElement).DataState = xtr.ElementText;
     }
     else if (parentElement is DataStoreReference)
     {
         ((DataStoreReference)parentElement).DataState = xtr.ElementText;
     }
 }
Ejemplo n.º 20
0
        public virtual void Parse(XMLStreamReader xtr, Process activeProcess)
        {
            string resourceElement = XMLStreamReaderUtil.moveDown(xtr);

            if (!string.IsNullOrWhiteSpace(resourceElement) && "resourceAssignmentExpression".Equals(resourceElement))
            {
                string expression = XMLStreamReaderUtil.moveDown(xtr);
                if (!string.IsNullOrWhiteSpace(expression) && "formalExpression".Equals(expression))
                {
                    IList <string> assignmentList = new List <string>();
                    string         assignmentText = xtr.ElementText;
                    if (assignmentText.Contains(","))
                    {
                        string[] assignmentArray = assignmentText.Split(",", true);
                        assignmentList = new List <string>(assignmentArray);
                    }
                    else
                    {
                        assignmentList.Add(assignmentText);
                    }
                    for (var idx = 0; idx < assignmentList.Count; idx++)
                    {
                        string assignmentValue = assignmentList[idx];
                        if (assignmentValue is null)
                        {
                            continue;
                        }
                        assignmentValue = assignmentList[idx] = assignmentValue.Trim();
                        if (assignmentValue.Length == 0)
                        {
                            continue;
                        }

                        string userPrefix  = "user(";
                        string groupPrefix = "group(";
                        if (assignmentValue.StartsWith(userPrefix, StringComparison.Ordinal))
                        {
                            assignmentValue = assignmentList[idx] = StringHelper.SubstringSpecial(assignmentValue, userPrefix.Length, assignmentValue.Length - 1).Trim();
                            activeProcess.CandidateStarterUsers.Add(assignmentValue);
                        }
                        else if (assignmentValue.StartsWith(groupPrefix, StringComparison.Ordinal))
                        {
                            assignmentValue = assignmentList[idx] = StringHelper.SubstringSpecial(assignmentValue, groupPrefix.Length, assignmentValue.Length - 1).Trim();
                            activeProcess.CandidateStarterGroups.Add(assignmentValue);
                        }
                        else
                        {
                            activeProcess.CandidateStarterGroups.Add(assignmentValue);
                        }
                    }
                }
            }
        }
        protected internal virtual void parseTerminateAllAttribute(XMLStreamReader xtr, TerminateEventDefinition eventDefinition)
        {
            string terminateAllValue = xtr.GetAttributeValue(BpmnXMLConstants.ACTIVITI_EXTENSIONS_NAMESPACE, BpmnXMLConstants.ATTRIBUTE_TERMINATE_ALL);

            if (!string.ReferenceEquals(terminateAllValue, null) && "true".Equals(terminateAllValue))
            {
                eventDefinition.TerminateAll = true;
            }
            else
            {
                eventDefinition.TerminateAll = false;
            }
        }
Ejemplo n.º 22
0
 public virtual void Parse(XMLStreamReader xtr, BpmnModel model)
 {
     if (!string.IsNullOrWhiteSpace(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_ID)))
     {
         string  messageId   = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_ID);
         string  messageName = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_NAME);
         string  itemRef     = ParseItemRef(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_ITEM_REF), model);
         Message message     = new Message(messageId, messageName, itemRef);
         BpmnXMLUtil.AddXMLLocation(message, xtr);
         BpmnXMLUtil.ParseChildElements(BpmnXMLConstants.ELEMENT_MESSAGE, message, xtr, model);
         model.AddMessage(message);
     }
 }
Ejemplo n.º 23
0
        public override void ParseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model)
        {
            if (!(parentElement is Activity))
            {
                return;
            }
            DataAssociation dataAssociation = new DataAssociation();

            BpmnXMLUtil.AddXMLLocation(dataAssociation, xtr);
            DataAssociationParser.parseDataAssociation(dataAssociation, ElementName, xtr);

            ((Activity)parentElement).DataInputAssociations.Add(dataAssociation);
        }
        public override void ParseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model)
        {
            EventListener listener = new EventListener();

            BpmnXMLUtil.AddXMLLocation(listener, xtr);
            if (!string.IsNullOrWhiteSpace(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_LISTENER_CLASS)))
            {
                listener.Implementation     = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_LISTENER_CLASS);
                listener.ImplementationType = ImplementationType.IMPLEMENTATION_TYPE_CLASS;
            }
            else if (!string.IsNullOrWhiteSpace(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_LISTENER_DELEGATEEXPRESSION)))
            {
                listener.Implementation     = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_LISTENER_DELEGATEEXPRESSION);
                listener.ImplementationType = ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION;
            }
            else if (!string.IsNullOrWhiteSpace(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_LISTENER_THROW_EVENT_TYPE)))
            {
                string eventType = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_LISTENER_THROW_EVENT_TYPE);
                if (BpmnXMLConstants.ATTRIBUTE_LISTENER_THROW_EVENT_TYPE_SIGNAL.Equals(eventType))
                {
                    listener.ImplementationType = ImplementationType.IMPLEMENTATION_TYPE_THROW_SIGNAL_EVENT;
                    listener.Implementation     = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_LISTENER_THROW_SIGNAL_EVENT_NAME);
                }
                else if (BpmnXMLConstants.ATTRIBUTE_LISTENER_THROW_EVENT_TYPE_GLOBAL_SIGNAL.Equals(eventType))
                {
                    listener.ImplementationType = ImplementationType.IMPLEMENTATION_TYPE_THROW_GLOBAL_SIGNAL_EVENT;
                    listener.Implementation     = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_LISTENER_THROW_SIGNAL_EVENT_NAME);
                }
                else if (BpmnXMLConstants.ATTRIBUTE_LISTENER_THROW_EVENT_TYPE_MESSAGE.Equals(eventType))
                {
                    listener.ImplementationType = ImplementationType.IMPLEMENTATION_TYPE_THROW_MESSAGE_EVENT;
                    listener.Implementation     = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_LISTENER_THROW_MESSAGE_EVENT_NAME);
                }
                else if (BpmnXMLConstants.ATTRIBUTE_LISTENER_THROW_EVENT_TYPE_ERROR.Equals(eventType))
                {
                    listener.ImplementationType = ImplementationType.IMPLEMENTATION_TYPE_THROW_ERROR_EVENT;
                    listener.Implementation     = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_LISTENER_THROW_ERROR_EVENT_CODE);
                }
                else
                {
                    listener.ImplementationType = ImplementationType.IMPLEMENTATION_TYPE_INVALID_THROW_EVENT;
                }
            }
            listener.Events     = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_LISTENER_EVENTS);
            listener.EntityType = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_LISTENER_ENTITY_TYPE);

            Process parentProcess = (Process)parentElement;

            parentProcess.EventListeners.Add(listener);
        }
Ejemplo n.º 25
0
        public virtual void Parse(XMLStreamReader xtr, IList <SubProcess> activeSubProcessList, Process activeProcess, BpmnModel model)
        {
            BaseElement parentElement;

            if (activeSubProcessList.Count > 0)
            {
                parentElement = activeSubProcessList[activeSubProcessList.Count - 1];
            }
            else
            {
                parentElement = activeProcess;
            }

            bool readyWithChildElements = false;

            while (readyWithChildElements == false && xtr.HasNext())
            {
                //xtr.next();

                if (xtr.IsStartElement())
                {
                    if (BpmnXMLConstants.ELEMENT_EXECUTION_LISTENER.Equals(xtr.LocalName))
                    {
                        (new ExecutionListenerParser()).ParseChildElement(xtr, parentElement, model);
                    }
                    else if (BpmnXMLConstants.ELEMENT_EVENT_LISTENER.Equals(xtr.LocalName))
                    {
                        (new ActivitiEventListenerParser()).ParseChildElement(xtr, parentElement, model);
                    }
                    else if (BpmnXMLConstants.ELEMENT_POTENTIAL_STARTER.Equals(xtr.LocalName))
                    {
                        (new PotentialStarterParser()).Parse(xtr, activeProcess);
                    }
                    else
                    {
                        ExtensionElement extensionElement = BpmnXMLUtil.ParseExtensionElement(xtr);
                        parentElement.AddExtensionElement(extensionElement);
                    }
                }
                else if (xtr.EndElement && BpmnXMLConstants.ELEMENT_EXTENSIONS.Equals(xtr.LocalName))
                {
                    readyWithChildElements = true;
                }

                if (xtr.IsEmptyElement && string.Compare(xtr.LocalName, BpmnXMLConstants.ELEMENT_EXTENSIONS, true) == 0)
                {
                    readyWithChildElements = true;
                }
            }
        }
Ejemplo n.º 26
0
 public virtual void Parse(XMLStreamReader xtr, BpmnModel model)
 {
     if (!string.IsNullOrWhiteSpace(xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_ID)))
     {
         Pool pool = new Pool
         {
             Id         = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_ID),
             Name       = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_NAME),
             ProcessRef = xtr.GetAttributeValue(BpmnXMLConstants.ATTRIBUTE_PROCESS_REF)
         };
         BpmnXMLUtil.ParseChildElements(BpmnXMLConstants.ELEMENT_PARTICIPANT, pool, xtr, model);
         model.Pools.Add(pool);
     }
 }
        public override void ParseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model)
        {
            if (!(parentElement is Activity))
            {
                return;
            }
            string cycle = xtr.ElementText;

            if (string.ReferenceEquals(cycle, null) || cycle.Length == 0)
            {
                return;
            }
            ((Activity)parentElement).FailedJobRetryTimeCycleValue = cycle;
        }
Ejemplo n.º 28
0
        public override void ParseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model)
        {
            if (!(parentElement is TimerEventDefinition))
            {
                return;
            }

            TimerEventDefinition eventDefinition = (TimerEventDefinition)parentElement;

            if (!string.IsNullOrWhiteSpace(xtr.GetAttributeValue(BpmnXMLConstants.ACTIVITI_EXTENSIONS_NAMESPACE, BpmnXMLConstants.ATTRIBUTE_END_DATE)))
            {
                eventDefinition.EndDate = xtr.GetAttributeValue(BpmnXMLConstants.ACTIVITI_EXTENSIONS_NAMESPACE, BpmnXMLConstants.ATTRIBUTE_END_DATE);
            }
            eventDefinition.TimeCycle = xtr.ElementText;
        }
Ejemplo n.º 29
0
        public override void ParseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model)
        {
            string docText = xtr.ElementText;

            if (!string.IsNullOrWhiteSpace(docText))
            {
                if (parentElement is FlowElement)
                {
                    ((FlowElement)parentElement).Documentation = docText.Trim();
                }
                else if (parentElement is Process)
                {
                    ((Process)parentElement).Documentation = docText.Trim();
                }
            }
        }
        public override void ParseChildElement(XMLStreamReader xtr, BaseElement parentElement, BpmnModel model)
        {
            if (!(parentElement is Event))
            {
                return;
            }

            ErrorEventDefinition eventDefinition = new ErrorEventDefinition();

            BpmnXMLUtil.AddXMLLocation(eventDefinition, xtr);
            eventDefinition.ErrorCode = xtr.GetAttributeValue("errorRef");

            BpmnXMLUtil.ParseChildElements(BpmnXMLConstants.ELEMENT_EVENT_ERRORDEFINITION, eventDefinition, xtr, model);

            ((Event)parentElement).EventDefinitions.Add(eventDefinition);
        }