Beispiel #1
0
        /// <summary>
        /// Calculate a collection of all base types for the given type
        /// </summary>
        public static ICollection <ModelElementType> calculateAllBaseTypes(ModelElementType type)
        {
            IList <ModelElementType> baseTypes = new List <ModelElementType>();
            ModelElementTypeImpl     typeImpl  = (ModelElementTypeImpl)type;

            typeImpl.resolveBaseTypes(baseTypes);
            return(baseTypes);
        }
Beispiel #2
0
        /// <summary>
        /// Calculate a collection of all extending types for the given base types
        /// </summary>
        /// <param name="baseTypes"> the collection of types to calculate the union of all extending types </param>
        public static ICollection <ModelElementType> calculateAllExtendingTypes(Model model, ICollection <ModelElementType> baseTypes)
        {
            ISet <ModelElementType> allExtendingTypes = new HashSet <ModelElementType>();

            foreach (ModelElementType baseType in baseTypes)
            {
                ModelElementTypeImpl modelElementTypeImpl = (ModelElementTypeImpl)model.getType(baseType.InstanceType);
                modelElementTypeImpl.resolveExtendingTypes(allExtendingTypes);
            }
            return(allExtendingTypes);
        }
Beispiel #3
0
        /// <summary>
        /// Returns the <seealso cref="ModelElementInstanceImpl ModelElement"/> for a DOM element.
        /// If the model element does not yet exist, it is created and linked to the DOM.
        /// </summary>
        /// <param name="domElement"> the child element to create a new <seealso cref="ModelElementInstanceImpl ModelElement"/> for </param>
        /// <returns> the child model element </returns>
        public static ModelElementInstance getModelElement(DomElement domElement, ModelInstanceImpl modelInstance)
        {
            ModelElementInstance modelElement = domElement.ModelElementInstance;

            if (modelElement == null)
            {
                ModelElementTypeImpl modelType = getModelElement(domElement, modelInstance, domElement.NamespaceURI);
                modelElement = modelType.newInstance(modelInstance, domElement);
                domElement.ModelElementInstance = modelElement;
            }
            return(modelElement);
        }
Beispiel #4
0
 public virtual void buildTypeHierarchy(Model model)
 {
     // build type hierarchy
     if (extendedType != null)
     {
         ModelElementTypeImpl extendedModelElementType = (ModelElementTypeImpl)model.getType(extendedType);
         if (extendedModelElementType == null)
         {
             throw new ModelException("Type " + modelType + " is defined to extend " + extendedType + " but no such type is defined.");
         }
         else
         {
             modelType.setBaseType(extendedModelElementType);
             extendedModelElementType.registerExtendingType(modelType);
         }
     }
 }
Beispiel #5
0
        protected internal static ModelElementTypeImpl getModelElement(DomElement domElement, ModelInstanceImpl modelInstance, string namespaceUri)
        {
            string localName = domElement.LocalName;
            ModelElementTypeImpl modelType = (ModelElementTypeImpl)modelInstance.Model.getTypeForName(namespaceUri, localName);

            if (modelType == null)
            {
                Model  model = modelInstance.Model;
                string actualNamespaceUri = model.getActualNamespace(namespaceUri);

                if (!string.ReferenceEquals(actualNamespaceUri, null))
                {
                    modelType = getModelElement(domElement, modelInstance, actualNamespaceUri);
                }
                else
                {
                    modelType = (ModelElementTypeImpl)modelInstance.registerGenericType(namespaceUri, localName);
                }
            }
            return(modelType);
        }
Beispiel #6
0
        public virtual void PerformModelBuild(IModel model)
        {
            ModelElementTypeImpl referenceTargetType = (ModelElementTypeImpl)model.GetType(typeof(TTarget));
            ModelElementTypeImpl referenceSourceType = (ModelElementTypeImpl)model.GetType(typeof(TSource));

            ElementReferenceCollectionImpl.ReferenceTargetElementType = referenceTargetType;
            ElementReferenceCollectionImpl.SetReferenceSourceElementType(referenceSourceType);

            // the referenced attribute may be declared on a base type of the referenced type.
            AttributeImpl idAttribute = (AttributeImpl)referenceTargetType.GetAttribute("id");

            if (idAttribute != null)
            {
                idAttribute.RegisterIncoming(ElementReferenceCollectionImpl);
                ElementReferenceCollectionImpl.ReferenceTargetAttribute = idAttribute;
            }
            else
            {
                throw new ModelException("Unable to find id attribute of " + typeof(TTarget));
            }
        }
Beispiel #7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") public void performModelBuild(org.camunda.bpm.model.xml.Model model)
        public virtual void performModelBuild(Model model)
        {
            ModelElementTypeImpl referenceTargetType = (ModelElementTypeImpl)model.getType(referenceTargetClass);
            ModelElementTypeImpl referenceSourceType = (ModelElementTypeImpl)model.getType(childElementType);

            elementReferenceCollectionImpl.ReferenceTargetElementType = referenceTargetType;
            elementReferenceCollectionImpl.setReferenceSourceElementType(referenceSourceType);

            // the referenced attribute may be declared on a base type of the referenced type.
            AttributeImpl <string> idAttribute = (AttributeImpl <string>)referenceTargetType.getAttribute("id");

            if (idAttribute != null)
            {
                idAttribute.registerIncoming(elementReferenceCollectionImpl);
                elementReferenceCollectionImpl.ReferenceTargetAttribute = idAttribute;
            }
            else
            {
                throw new ModelException("Unable to find id attribute of " + referenceTargetClass);
            }
        }
Beispiel #8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") public void performModelBuild(org.camunda.bpm.model.xml.Model model)
        public virtual void performModelBuild(Model model)
        {
            // register declaring type as a referencing type of referenced type
            ModelElementTypeImpl referenceTargetType = (ModelElementTypeImpl)model.getType(referenceTargetElement);

            // the actual referenced type
            attributeReferenceImpl.ReferenceTargetElementType = referenceTargetType;

            // the referenced attribute may be declared on a base type of the referenced type.
            AttributeImpl <string> idAttribute = (AttributeImpl <string>)referenceTargetType.getAttribute("id");

            if (idAttribute != null)
            {
                idAttribute.registerIncoming(attributeReferenceImpl);
                attributeReferenceImpl.ReferenceTargetAttribute = idAttribute;
            }
            else
            {
                throw new ModelException("Element type " + referenceTargetType.TypeNamespace + ":" + referenceTargetType.TypeName + " has no id attribute");
            }
        }
 public SequenceBuilderImpl(ModelElementTypeImpl modelType)
 {
     this._elementType = modelType;
 }
Beispiel #10
0
 public ChildElementCollectionImpl(Type childElementTypeClass, ModelElementTypeImpl parentElementType)
 {
     childElementTypeClass      = typeof(T);
     this.childElementTypeClass = childElementTypeClass;
     this.parentElementType     = parentElementType;
 }
Beispiel #11
0
 public ChildElementImpl(ModelElementTypeImpl parentElementType) : base(parentElementType)
 {
     this.maxOccurs = 1;
 }
Beispiel #12
0
 public StringAttributeBuilderImpl(string attributeName, ModelElementTypeImpl modelType) : base(attributeName, modelType, new StringAttribute(modelType))
 {
 }
Beispiel #13
0
        public virtual ChildElementAssert assertThatChildElement(ModelElementType childElementType)
        {
            ModelElementTypeImpl modelElementTypeImpl = (ModelElementTypeImpl)modelElementType;

            return(assertThat(modelElementTypeImpl.getChildElementCollection(childElementType)));
        }
Beispiel #14
0
 public IntegerAttributeBuilder(string attributeName, ModelElementTypeImpl modelType)
     : base(attributeName, modelType, new IntegerAttribute(modelType))
 {
 }
Beispiel #15
0
 public ModelElementTypeBuilderImpl(Type instanceType, string name, ModelImpl model)
 {
     this.instanceType = instanceType;
     this.model        = model;
     modelType         = new ModelElementTypeImpl(model, name, instanceType);
 }
 public ModelTypeInstanceContext(IDomElement domElement, IModelInstance model, ModelElementTypeImpl modelType)
 {
     this._domElement = domElement;
     this._model      = model;
     this._modelType  = modelType;
 }
Beispiel #17
0
 public NamedEnumAttributeBuilder(string attributeName, ModelElementTypeImpl modelType, Type type)
 {
     type = typeof(T);
     base(attributeName, modelType, new NamedEnumAttribute <T>(modelType, type));
 }
 public NamedEnumAttributeBuilder(string attributeName, ModelElementTypeImpl modelType)
     : base(attributeName, modelType, new NamedEnumAttribute <T>(modelType))
 {
 }
Beispiel #19
0
 public ChildElementImpl(Type childElementTypeChild, ModelElementTypeImpl parentElementType)
 {
     childElementTypeChild = typeof(T);
     base(childElementTypeChild, parentElementType);
     this.maxOccurs = 1;
 }
Beispiel #20
0
 public ChildElementCollectionImpl(ModelElementTypeImpl parentElementType)
 {
     //this.childElementTypeClass = childElementTypeClass;
     this._parentElementType = parentElementType;
 }
Beispiel #21
0
 public ModelElementInstanceImpl(ModelTypeInstanceContext instanceContext)
 {
     this.domElement    = instanceContext.DomElement;
     this.modelInstance = instanceContext.Model;
     this.elementType   = instanceContext.ModelType;
 }
Beispiel #22
0
 public DoubleAttributeBuilder(string attributeName, ModelElementTypeImpl modelType) : base(attributeName, modelType, new DoubleAttribute((modelType)))
 {
 }
 public BooleanAttributeBuilder(string attributeName, ModelElementTypeImpl modelType)
     : base(attributeName, modelType, new BooleanAttribute(modelType))
 {
 }
Beispiel #24
0
 public virtual void setReferenceSourceElementType(ModelElementTypeImpl referenceSourceType)
 {
     this.referenceSourceType = referenceSourceType;
 }
 internal AttributeBuilderImpl(string attributeName, ModelElementTypeImpl modelType, AttributeImpl /*<T>*/ attribute)
 {
     this._modelType         = modelType;
     this._attribute         = attribute;
     attribute.AttributeName = attributeName;
 }
Beispiel #26
0
 public ChildElementCollectionBuilderImpl(IModelElementType parentElementType)
 {
     this.parentElementType = (ModelElementTypeImpl)parentElementType;
     this._collection       = CreateCollectionInstance();
 }