Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 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);
         }
     }
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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));
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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");
            }
        }
Ejemplo n.º 9
0
 public SequenceBuilderImpl(ModelElementTypeImpl modelType)
 {
     this._elementType = modelType;
 }
Ejemplo n.º 10
0
 public ChildElementCollectionImpl(Type childElementTypeClass, ModelElementTypeImpl parentElementType)
 {
     childElementTypeClass      = typeof(T);
     this.childElementTypeClass = childElementTypeClass;
     this.parentElementType     = parentElementType;
 }
Ejemplo n.º 11
0
 public ChildElementImpl(ModelElementTypeImpl parentElementType) : base(parentElementType)
 {
     this.maxOccurs = 1;
 }
Ejemplo n.º 12
0
 public StringAttributeBuilderImpl(string attributeName, ModelElementTypeImpl modelType) : base(attributeName, modelType, new StringAttribute(modelType))
 {
 }
Ejemplo n.º 13
0
        public virtual ChildElementAssert assertThatChildElement(ModelElementType childElementType)
        {
            ModelElementTypeImpl modelElementTypeImpl = (ModelElementTypeImpl)modelElementType;

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