Description of EASchemaElement.
Inheritance: SchemaBuilderFramework.SchemaElement
        /// <summary>
        /// Finds all subset elements linked to the given message element and links those to the schema elements.
        /// If a subset element could not be matched, and it is in the same package as the given messageElement, then it is deleted
        /// </summary>
        /// <param name="messageElement">the message element to start from</param>
        void matchSubsetElements(UML.Classes.Kernel.Classifier messageElement)
        {
            HashSet <UML.Classes.Kernel.Classifier> subsetElements = this.getSubsetElementsfromMessage(messageElement);

            //match each subset element to a schema element
            foreach (UML.Classes.Kernel.Classifier subsetElement in subsetElements)
            {
                //get the corrsponding schema element
                EASchemaElement schemaElement = this.getSchemaElementForSubsetElement(subsetElement);
                //found a corresponding schema element
                if (schemaElement != null &&
                    shouldElementExistAsDatatype(subsetElement))
                {
                    schemaElement.matchSubsetElement(subsetElement);
                }
                else
                {
                    //if it doesn't correspond with a schema element we delete it?
                    //only if the subset element is located in the same folder as the message element
                    //and it doesn't have one of stereotypes to be ignored
                    if (subsetElement.owner.Equals(messageElement.owner) &&
                        !this.settings.ignoredStereotypes.Intersect(((UTF_EA.Element)subsetElement).stereotypeNames).Any())
                    {
                        subsetElement.delete();
                    }
                }
            }
        }
        void matchSubsetElements(Package destinationPackage, HashSet <Classifier> subsetElements)
        {
            //loop subset elements ordered by name
            foreach (Classifier subsetElement in subsetElements.OrderBy(x => name))
            {
                //tell the user what we are doing
                EAOutputLogger.log(this.model, this.settings.outputName, "Matching subset element: '" + subsetElement.name + "' to a schema element"
                                   , ((TSF_EA.ElementWrapper)subsetElement).id, LogTypeEnum.log);
                //get the corrsponding schema element
                EASchemaElement schemaElement = this.getSchemaElementForSubsetElement(subsetElement);

                //found a corresponding schema element
                if (schemaElement != null && shouldElementExistAsDatatype(subsetElement))
                {
                    schemaElement.matchSubsetElement(subsetElement);
                }
                else
                {
                    //if it doesn't correspond with a schema element we delete it?
                    //only if the subset element is located in the same folder as the message element
                    //and it doesn't have one of stereotypes to be ignored
                    if (destinationPackage.getNestedPackageTree(true).Any(x => x.Equals(subsetElement.owningPackage)) &&
                        !this.settings.ignoredStereotypes.Intersect(((TSF_EA.Element)subsetElement).stereotypeNames).Any())
                    {
                        subsetElement.delete();
                    }
                }
            }
        }
        /// <summary>
        /// finds the Schema Element for which the given element could be the subset element
        /// </summary>
        /// <param name="subsetElement">the element to search a match for</param>
        /// <returns>the corresponding SchemaElement</returns>
        internal EASchemaElement getSchemaElementForSubsetElement(Classifier subsetElement)
        {
            EASchemaElement result = null;

            if (subsetElement != null)
            {
                foreach (EASchemaElement schemaElement in this.elements)
                {
                    if (schemaElement.name == subsetElement.name)
                    {
                        //check if the subset element has a dependency to the source element of the schema
                        string sqlCheckTrace = @"select c.Connector_ID from t_connector c
												where 
												c.Connector_Type = 'Abstraction'
												and c.Stereotype = 'trace'
												and c.Start_Object_ID = "                                                 + ((UTF_EA.ElementWrapper)subsetElement).id +
                                               " and c.End_Object_ID = " + ((UTF_EA.ElementWrapper)schemaElement.sourceElement).id;
                        var checkTraceXML   = this.model.SQLQuery(sqlCheckTrace);
                        var connectorIDNode = checkTraceXML.SelectSingleNode(this.model.formatXPath("//Connector_ID"));
                        int connectorID;
                        if (connectorIDNode != null && int.TryParse(connectorIDNode.InnerText, out connectorID))
                        {
                            result = schemaElement;
                            break;
                        }
                    }
                }
            }
            return(result);
        }
        /// <summary>
        /// finds the Schema Element for which the given element could be the subset element
        /// </summary>
        /// <param name="subsetElement">the element to search a match for</param>
        /// <returns>the corresponding SchemaElement</returns>
        internal EASchemaElement getSchemaElementForSubsetElement(Classifier subsetElement)
        {
            EASchemaElement result = null;

            if (subsetElement != null)
            {
                foreach (EASchemaElement schemaElement in this.elements)
                {
                    if (schemaElement.name == subsetElement.name &&
                        schemaElement.sourceElement != null)
                    {
                        //check on if there is a tagged value that references the source element
                        if (this.settings.tvInsteadOfTrace)
                        {
                            var traceTag = subsetElement.taggedValues.FirstOrDefault(x => x.name == this.settings.elementTagName);
                            if (traceTag != null &&
                                traceTag.tagValue != null &&
                                traceTag.tagValue.Equals(schemaElement.sourceElement))
                            {
                                result = schemaElement;
                            }
                        }
                        else
                        {
                            //check if the subset element has a dependency to the source element of the schema
                            string sqlCheckTrace = @"select c.Connector_ID from t_connector c
													where 
													c.Connector_Type = 'Abstraction'
													and c.Stereotype = 'trace'
													and c.Start_Object_ID = "                                                     + ((TSF_EA.ElementWrapper)subsetElement).id +
                                                   " and c.End_Object_ID = " + ((TSF_EA.ElementWrapper)schemaElement.sourceElement).id;
                            var checkTraceXML   = this.model.SQLQuery(sqlCheckTrace);
                            var connectorIDNode = checkTraceXML.SelectSingleNode(this.model.formatXPath("//Connector_ID"));
                            int connectorID;
                            if (connectorIDNode != null && int.TryParse(connectorIDNode.InnerText, out connectorID))
                            {
                                result = schemaElement;
                                break;
                            }
                        }
                    }
                }
            }
            return(result);
        }
 private void setAssociationClassProperties()
 {
     UTF_EA.AssociationClass sourceAssociationClass = ((UTF_EA.Association) this.sourceAssociation).associationClass;
     if (sourceAssociationClass != null)
     {
         //find subset association class
         EASchemaElement associationClassSchemaElement = ((EASchema)this.owner.owner).getSchemaElementForUMLElement(sourceAssociationClass);
         if (associationClassSchemaElement != null &&
             associationClassSchemaElement.subsetElement != null)
         {
             //link the corresponding subset associationclass to the subset associations
             foreach (var subsetAssociation in this.subsetAssociations)
             {
                 ((UTF_EA.AssociationClass)associationClassSchemaElement.subsetElement).relatedAssociation = subsetAssociation as UTF_EA.Association;
                 associationClassSchemaElement.subsetElement.save();
                 break;                 //we can only link one association to the association class, so we break after the first one
             }
         }
     }
 }
        /// <summary>
        /// finds the Schema Element for which the given element could be the subset element
        /// </summary>
        /// <param name="subsetElement">the element to search a match for</param>
        /// <returns>the corresponding SchemaElement</returns>
        internal EASchemaElement getSchemaElementForSubsetElement(UML.Classes.Kernel.Classifier subsetElement)
        {
            EASchemaElement result = null;

            foreach (EASchemaElement schemaElement in this.elements)
            {
                if (schemaElement.name == subsetElement.name)
                {
                    //check if the subset element has a dependency to the source element of the schema
                    foreach (var dependency in subsetElement.clientDependencies)
                    {
                        if (schemaElement.sourceElement.Equals(dependency.supplier))
                        {
                            result = schemaElement;
                            break;
                        }
                    }
                }
            }
            return(result);
        }
        /// <summary>
        /// returns the SchemaElement that corresponds with the given UML element
        /// </summary>
        /// <param name="umlElement">the source UMLElement</param>
        /// <returns></returns>
        internal EASchemaElement getSchemaElementForUMLElement(UML.Classes.Kernel.Element umlElement)
        {
            EASchemaElement result = null;

            foreach (EASchemaElement schemaElement in this.elements)
            {
                if (schemaElement.sourceElement != null &&
                    schemaElement.sourceElement.Equals(umlElement))
                {
                    if (result == null)
                    {
                        result = schemaElement;
                    }
                    else if (schemaElement.name == umlElement.name)
                    {
                        result = schemaElement;
                        break;
                    }
                }
            }
            return(result);
        }
 public EASchemaAssociation(UTF_EA.Model model, EASchemaElement owner, EA.SchemaProperty objectToWrap)
     : base(model, owner, objectToWrap)
 {
     this.subsetAssociations = new List<Association>();
 }
 /// <summary>
 /// constructor. Nothing specific, just calling base constructor
 /// </summary>
 /// <param name="model">the model</param>
 /// <param name="owner">the owner Schema Element</param>
 /// <param name="objectToWrap">the EA.SchemaProperty object to wrap</param>
 public EASchemaProperty(UTF_EA.Model model, EASchemaElement owner, EA.SchemaProperty objectToWrap) : base(model, owner, objectToWrap)
 {
 }
 public EASchemaPropertyWrapper(UTF_EA.Model model, EASchemaElement owner, EA.SchemaProperty objectToWrap)
 {
     this._owner          = owner;
     this.model           = model;
     this.wrappedProperty = objectToWrap;
 }
 public EASchemaAssociation(UTF_EA.Model model, EASchemaElement owner, EA.SchemaProperty objectToWrap) : base(model, owner, objectToWrap)
 {
     this.subsetAssociations = new List <Association>();
 }
		public EASchemaAssociation(UTF_EA.Model model,EASchemaElement owner, EA.SchemaProperty objectToWrap):base(model,owner, objectToWrap)
		{
		}
 public EASchemaPropertyWrapper(UTF_EA.Model model, EASchemaElement owner, EA.SchemaProperty objectToWrap)
 {
     this._owner = owner;
     this.model = model;
     this.wrappedProperty = objectToWrap;
 }
 /// <summary>
 /// constructor. Nothing specific, just calling base constructor
 /// </summary>
 /// <param name="model">the model</param>
 /// <param name="owner">the owner Schema Element</param>
 /// <param name="objectToWrap">the EA.SchemaProperty object to wrap</param>
 public EASchemaLiteral(UTF_EA.Model model,EASchemaElement owner, EA.SchemaProperty objectToWrap)
     : base(model,owner, objectToWrap)
 {
 }