protected internal virtual T CreateChild <T>(IBpmnModelElementInstance parent, Type typeClass, string identifier) where T : IBaseElement { T instance = CreateInstance <T>(typeClass, identifier); parent.AddChildElement(instance); return(instance); }
protected internal virtual T CreateChild <T>(IBpmnModelElementInstance parent, Type typeClass) where T : IBpmnModelElementInstance { T instance = CreateInstance <T>(typeClass); parent.AddChildElement(instance); return(instance); }
/// <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 IBaseElementBuilder <TE> AddExtensionElement(IBpmnModelElementInstance extensionElement) { IExtensionElements extensionElements = GetCreateSingleChild <IExtensionElements>(typeof(IExtensionElements)); extensionElements.AddChildElement(extensionElement); return(this); }
public virtual TransactionBuilder TransactionDone() { IBpmnModelElementInstance lastTransaction = element.Scope; if (lastTransaction != null && lastTransaction is ITransaction) { return(new TransactionBuilder(modelInstance, (ITransaction)lastTransaction)); } else { throw new BpmnModelException("Unable to find a parent transaction."); } }
/// <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() { IBpmnModelElementInstance lastSubProcess = element.Scope; if (lastSubProcess != null && lastSubProcess is ISubProcess) { return(((ISubProcess)lastSubProcess).Builder()); } else { throw new BpmnModelException("Unable to find a parent subProcess."); } }
protected internal virtual T GetCreateSingleChild <T>(IBpmnModelElementInstance parent, Type typeClass) where T : IBpmnModelElementInstance { ICollection <T> childrenOfType = (ICollection <T>)parent.GetChildElementsByType(typeClass); if (childrenOfType.Count == 0) { return(CreateChild <T>(parent, typeClass)); } else { if (childrenOfType.Count > 1) { throw new BpmnModelException("XmlElement " + parent + " of type " + parent.ElementType.TypeName + " has more than one child element of type " + typeClass.FullName); } else { return(childrenOfType.GetEnumerator().Current); } } }