/// <summary> /// checks all attributes of the subset element and tries to match it with a SchemaProperty. /// It it can't be matches te subset attribute is deleted. /// </summary> public void matchSubsetAttributes() { if (this.subsetElement != null) { foreach (UTF_EA.Attribute attribute in this.subsetElement.attributes) { EASchemaProperty matchingProperty = this.getMatchingSchemaProperty(attribute); if (matchingProperty != null) { //found a match matchingProperty.subSetProperty = attribute; } else { //only delete if stereotype not in list of ignored stereotypes if (attribute.stereotypes.Count(x => this.owner.settings.ignoredStereotypes.Contains(x.name)) <= 0) { //no match, delete the attribute attribute.delete(); } } } } }
/// <summary> /// checks all attributes of the subset element and tries to match it with a SchemaProperty. /// It it can't be matches te subset attribute is deleted. /// </summary> public void matchSubsetAttributes() { if (this.subsetElement != null) { foreach (UTF_EA.Attribute attribute in this.subsetElement.attributes) { //tell the user what we are doing EAOutputLogger.log(this.model, this.owner.settings.outputName, "Matching subset attribute: '" + attribute.name + "' to a schema property" , ((UTF_EA.ElementWrapper)subsetElement).id, LogTypeEnum.log); EASchemaProperty matchingProperty = this.getMatchingSchemaProperty(attribute); if (matchingProperty != null) { //found a match matchingProperty.subSetProperty = attribute; } else { //only delete if stereotype not in list of ignored stereotypes if (attribute.stereotypes.Count(x => this.owner.settings.ignoredStereotypes.Contains(x.name)) <= 0) { //no match, delete the attribute attribute.delete(); } } } } }
/// <summary> /// finds the corresponding Schema property for the given attribut /// </summary> /// <param name="attribute">attribute</param> /// <returns>the corresponding Schema property if one is found. Else null</returns> public EASchemaProperty getMatchingSchemaProperty(UTF_EA.Attribute attribute) { EASchemaProperty result = null; var sourceAttributeTag = attribute.getTaggedValue(this.owner.settings.sourceAttributeTagName); if (sourceAttributeTag != null) { string tagReference = sourceAttributeTag.eaStringValue; foreach (EASchemaProperty property in this.schemaProperties) { //we have the same attribute if the given attribute has a tagged value //called sourceAttribute that refences the source attribute of the schema Property if (((UTF_EA.Attribute)property.sourceProperty).guid == tagReference) { result = property; break; } } } return(result); }