/// <summary> /// event launched just before a node is expanded /// </summary> /// <param name="sender">sender</param> /// <param name="e">arguments</param> void NavigatorTreeBeforeExpand(object sender, TreeViewCancelEventArgs e) { foreach (TreeNode subNode in e.Node.Nodes) { if (this.isOwnerNode(subNode)) { UML.Extended.UMLItem owner = ((UML.Extended.UMLItem)e.Node.Tag).owner; if (owner != null) { this.addElementToTree(owner, e.Node, subNode); } } else if (this.isTypeNode(subNode)) { UML.Classes.Kernel.Property attribute = e.Node.Tag as UML.Classes.Kernel.Property; if (attribute != null && attribute.type != null) { this.addElementToTree(attribute.type, e.Node, subNode); } } } if (BeforeExpand != null) { BeforeExpand(sender, e); } }
public virtual DB.Column transformLogicalProperty(UML.Classes.Kernel.Property attribute) { createColumn((UTF_EA.Attribute)attribute); if (this._column != null) { this._column.logicalAttribute = (UTF_EA.Attribute)attribute; } return(this._column); }
/// <summary> /// Opens the type of the attribute /// </summary> private List <UML.UMLItem> getClassifier(UML.UMLItem parentElement) { List <UML.UMLItem> elementsToNavigate = new List <UML.UMLItem>(); UML.Classes.Kernel.Property selectedAttribute = parentElement as UML.Classes.Kernel.Property; if (null != selectedAttribute) { elementsToNavigate.Add(selectedAttribute.type); } return(elementsToNavigate); }
/// <summary> /// Checks if the attribute type is present as the source element of one of the schema elements /// If it finds a match the type is set to the subset elemnt of this schema element /// </summary> public void createSubsetProperty() { //no need to do anything if the subset element does not exist if (this.owner.subsetElement != null) { HashSet <SBF.SchemaElement> schemaElements = this.owner.owner.elements; if (this.subSetProperty == null) { this.subSetProperty = this.model.factory.createNewElement <UML.Classes.Kernel.Property>(this.owner.subsetElement, this.sourceProperty.name); } this.subSetProperty.name = this.sourceProperty.name; this.subSetProperty.type = this.sourceProperty.type; this.subSetProperty.stereotypes = this.sourceProperty.stereotypes; ((UTF_EA.Attribute) this.subSetProperty).multiplicity = this.multiplicity; //notes only update them if they are empty if (this.subSetProperty.ownedComments.Count == 0 || !this.subSetProperty.ownedComments.Any(x => x.body.Length > 0)) { this.subSetProperty.ownedComments = this.sourceProperty.ownedComments; if (this.owner.owner.settings.prefixNotes && this.owner.owner.settings.prefixNotesText.Length > 0 && this.subSetProperty.ownedComments.Any(x => x.body.Length > 0)) { foreach (var comment in subSetProperty.ownedComments) { comment.body = this.owner.owner.settings.prefixNotesText + Environment.NewLine + comment.body; } } } //resolve the type foreach (EASchemaElement element in schemaElements) { if (this.redefinedElement != null && this.redefinedElement.subsetElement != null && this.subSetProperty != null) { //replace the type by the subset element of the redefined type this.subSetProperty.type = this.redefinedElement.subsetElement; } else if (element.sourceElement != null && element.subsetElement != null && this.subSetProperty != null && element.sourceElement.Equals(this.subSetProperty.type)) { //replace the type if it matches the source element this.subSetProperty.type = element.subsetElement; } } ((UTF_EA.Element) this.subSetProperty).save(); //copy tagged values ((EASchema)this.owner.owner).copyTaggedValues((UTF_EA.Element) this.sourceProperty, (UTF_EA.Element) this.subSetProperty); //add tagged value with reference to source attribute ((UTF_EA.Element) this.subSetProperty).addTaggedValue(this.owner.owner.settings.sourceAttributeTagName, ((UTF_EA.Element) this.sourceProperty).guid); } }
internal static string getTypeMenuName(UML.UMLItem element) { string typeMenuname = typeMenuPrefix; UML.Classes.Kernel.Property attribute = element as UML.Classes.Kernel.Property; if (attribute != null && attribute.type != null) { typeMenuname += attribute.type.name; } return(typeMenuname); }
/// <summary> /// Creates the subset property in the subsetElement of the owning SchemaElement /// </summary> /// <returns>the new property</returns> public UML.Classes.Kernel.Property createSubsetProperty() { this.subSetProperty = this.model.factory.createNewElement<UML.Classes.Kernel.Property>(this.owner.subsetElement,this.sourceProperty.name); this.subSetProperty.type = this.sourceProperty.type; this.subSetProperty.stereotypes = this.sourceProperty.stereotypes; this.subSetProperty.lower = this.sourceProperty.lower; this.subSetProperty.upper = this.sourceProperty.upper; this.subSetProperty.ownedComments = this.sourceProperty.ownedComments; ((UTF_EA.Element) this.subSetProperty).save(); //copy tagged values ((UTF_EA.Element) this.subSetProperty).copyTaggedValues((UTF_EA.Element)this.sourceProperty); //add tagged value with reference to source association ((UTF_EA.Element)this.subSetProperty).addTaggedValue(EASchemaBuilderFactory.sourceAttributeTagName,((UTF_EA.Element)this.sourceProperty).guid); return this.subSetProperty; }
/// <summary> /// Checks if the attribute type is present as the source element of one of the schema elements /// If it finds a match the type is set to the subset elemnt of this schema element /// </summary> public void createSubsetProperty() { //no need to do anything if the subset element does not exist if (this.owner.subsetElement != null) { HashSet <SBF.SchemaElement> schemaElements = this.owner.owner.elements; if (this.subSetProperty == null) { this.subSetProperty = this.model.factory.createNewElement <UML.Classes.Kernel.Property>(this.owner.subsetElement, this.sourceProperty.name); } else { //report rename if (this.subSetProperty.name != this.sourceProperty.name) { EAOutputLogger.log(this.model, this.owner.owner.settings.outputName , string.Format("Attribute '{0}' has been renamed from '{1}' since the last schema generation" , this.sourceProperty.owner.name + "." + this.sourceProperty.name , this.subSetProperty.name) , ((UTF_EA.ElementWrapper)sourceProperty.owner).id , LogTypeEnum.warning); } //report different type string newTypeName = (this.redefinedElement != null) ? this.redefinedElement.name : this.sourceProperty.type.name; if (this.subSetProperty.type.name != newTypeName) { EAOutputLogger.log(this.model, this.owner.owner.settings.outputName , string.Format("Attribute '{0}' has changed type from '{1}' to '{2}' since the last schema generation" , this.sourceProperty.owner.name + "." + this.sourceProperty.name , this.subSetProperty.type.name , newTypeName) , ((UTF_EA.ElementWrapper)sourceProperty.owner).id , LogTypeEnum.warning); } //report report different multiplicity if (((UTF_EA.Attribute) this.subSetProperty).EAMultiplicity != this.multiplicity) { EAOutputLogger.log(this.model, this.owner.owner.settings.outputName , string.Format("Attribute '{0}' has changed multiplicity from '{1}' to '{2}' since the last schema generation" , this.sourceProperty.owner.name + "." + this.sourceProperty.name , this.subSetProperty.multiplicity , this.sourceProperty.multiplicity) , ((UTF_EA.ElementWrapper)sourceProperty.owner).id , LogTypeEnum.warning); } } this.subSetProperty.name = this.sourceProperty.name; this.subSetProperty.type = this.sourceProperty.type; this.subSetProperty.stereotypes = this.sourceProperty.stereotypes; this.subSetProperty.multiplicity = this.multiplicity; this.subSetProperty.position = this.sourceProperty.position; //alias ((UTF_EA.Attribute) this.subSetProperty).alias = ((UTF_EA.Attribute)sourceProperty).alias; //notes only update them if they are empty if (this.subSetProperty.ownedComments.Count == 0 || !this.subSetProperty.ownedComments.Any(x => x.body.Length > 0)) { this.subSetProperty.ownedComments = this.sourceProperty.ownedComments; if (this.owner.owner.settings.prefixNotes && this.owner.owner.settings.prefixNotesText.Length > 0 && this.subSetProperty.ownedComments.Any(x => x.body.Length > 0)) { foreach (var comment in subSetProperty.ownedComments) { comment.body = this.owner.owner.settings.prefixNotesText + Environment.NewLine + comment.body; } } } //resolve the type foreach (EASchemaElement element in schemaElements) { if (this.redefinedElement != null && this.redefinedElement.subsetElement != null && this.subSetProperty != null) { //replace the type by the subset element of the redefined type this.subSetProperty.type = this.redefinedElement.subsetElement; } //check for restriction of type choice because that can contain the type that is used to redefine this attribute else if (this.choiceElements != null && this.choiceElements.Count > 0 && this.subSetProperty != null) { var redefinedTypeElement = this.choiceElements[0]; if (redefinedTypeElement.subsetElement != null) { this.subSetProperty.type = redefinedTypeElement.subsetElement; } else { this.subSetProperty.type = redefinedTypeElement.sourceElement; } } else if (element.sourceElement != null && element.subsetElement != null && this.subSetProperty != null && element.sourceElement.Equals(this.subSetProperty.type) && element.name == this.subSetProperty.type.name) { //replace the type if it matches the source element this.subSetProperty.type = element.subsetElement; } } ((UTF_EA.Element) this.subSetProperty).save(); //copy tagged values ((EASchema)this.owner.owner).copyTaggedValues((UTF_EA.Element) this.sourceProperty, (UTF_EA.Element) this.subSetProperty); //add tagged value with reference to source attribute ((UTF_EA.Element) this.subSetProperty).addTaggedValue(this.owner.owner.settings.sourceAttributeTagName, ((UTF_EA.Element) this.sourceProperty).guid); } }