Beispiel #1
0
        /// <summary>
        /// Add an extension element to the element.
        /// </summary>
        /// <param name="extensionElement">  the extension element to add </param>
        /// <returns> the builder object </returns>
        public virtual B addExtensionElement(BpmnModelElementInstance extensionElement)
        {
            ExtensionElements extensionElements = getCreateSingleChild(typeof(ExtensionElements));

            extensionElements.addChildElement(extensionElement);
            return(myself);
        }
Beispiel #2
0
        protected internal virtual T createChild <T>(BpmnModelElementInstance parent, Type typeClass, string identifier) where T : BaseElement
        {
            typeClass = typeof(T);
            T instance = createInstance(typeClass, identifier);

            parent.addChildElement(instance);
            return(instance);
        }
Beispiel #3
0
        protected internal virtual T createChild <T>(BpmnModelElementInstance parent, Type typeClass) where T : BpmnModelElementInstance
        {
            typeClass = typeof(T);
            T instance = createInstance(typeClass);

            parent.addChildElement(instance);
            return(instance);
        }
Beispiel #4
0
        protected internal virtual T createElement <T>(BpmnModelElementInstance parentElement, string id, Type elementClass) where T : BpmnModelElementInstance
        {
            elementClass = typeof(T);
            T element = modelInstance.newInstance(elementClass);

            element.setAttributeValue("id", id, true);
            parentElement.addChildElement(element);
            return(element);
        }
Beispiel #5
0
        public virtual SubProcessBuilder addSubProcessTo(string parentId)
        {
            SubProcess eventSubProcess = modelInstance.newInstance(typeof(SubProcess));

            BpmnModelElementInstance parent = getModelElementById(parentId);

            parent.addChildElement(eventSubProcess);

            return(eventSubProcess.builder());
        }
Beispiel #6
0
        public virtual TransactionBuilder transactionDone()
        {
            BpmnModelElementInstance lastTransaction = element.Scope;

            if (lastTransaction != null && lastTransaction is Transaction)
            {
                return(new TransactionBuilder(modelInstance, (Transaction)lastTransaction));
            }
            else
            {
                throw new BpmnModelException("Unable to find a parent transaction.");
            }
        }
Beispiel #7
0
        /// <summary>
        /// Finishes the building of an embedded sub-process.
        /// </summary>
        /// <returns> the parent sub-process builder </returns>
        /// <exception cref="BpmnModelException"> if no parent sub-process can be found </exception>
        public virtual SubProcessBuilder subProcessDone()
        {
            BpmnModelElementInstance lastSubProcess = element.Scope;

            if (lastSubProcess != null && lastSubProcess is SubProcess)
            {
                return(((SubProcess)lastSubProcess).builder());
            }
            else
            {
                throw new BpmnModelException("Unable to find a parent subProcess.");
            }
        }
Beispiel #8
0
        protected internal virtual T getCreateSingleChild <T>(BpmnModelElementInstance parent, Type typeClass) where T : BpmnModelElementInstance
        {
            typeClass = typeof(T);
            ICollection <T> childrenOfType = parent.getChildElementsByType(typeClass);

            if (childrenOfType.Count == 0)
            {
                return(createChild(parent, typeClass));
            }
            else
            {
                if (childrenOfType.Count > 1)
                {
//JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method:
                    throw new BpmnModelException("Element " + parent + " of type " + parent.ElementType.TypeName + " has more than one child element of type " + typeClass.FullName);
                }
                else
                {
                    return(childrenOfType.GetEnumerator().next());
                }
            }
        }