/// <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 createSubsetLiteral() { HashSet <SBF.SchemaElement> schemaElements = this.owner.owner.elements; if (this.subSetLiteral == null) { this.subSetLiteral = this.model.factory.createNewElement <UML.Classes.Kernel.EnumerationLiteral>(this.owner.subsetElement, this.sourceLiteral.name); } this.subSetLiteral.name = this.sourceLiteral.name; this.subSetLiteral.stereotypes = this.sourceLiteral.stereotypes; //notes only update them if they are empty if (this.subSetLiteral.ownedComments.Count == 0 || !this.subSetLiteral.ownedComments.Any(x => x.body.Length > 0)) { this.subSetLiteral.ownedComments = this.sourceLiteral.ownedComments; if (this.owner.owner.settings.prefixNotes && this.owner.owner.settings.prefixNotesText.Length > 0 && this.subSetLiteral.ownedComments.Any(x => x.body.Length > 0)) { foreach (var comment in subSetLiteral.ownedComments) { comment.body = this.owner.owner.settings.prefixNotesText + Environment.NewLine + comment.body; } } } ((UTF_EA.Element) this.subSetLiteral).save(); //copy tagged values ((UTF_EA.Element) this.subSetLiteral).copyTaggedValues((UTF_EA.Element) this.sourceLiteral); //add tagged value with reference to source literal value ((UTF_EA.Element) this.subSetLiteral).addTaggedValue(this.owner.owner.settings.sourceAttributeTagName, ((UTF_EA.Element) this.sourceLiteral).guid); }
/// <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 createSubsetLiteral() { HashSet <SBF.SchemaElement> schemaElements = this.owner.owner.elements; if (this.subSetLiteral == null) { this.subSetLiteral = this.model.factory.createNewElement <UML.Classes.Kernel.EnumerationLiteral>(this.owner.subsetElement, this.sourceLiteral.name); } else { if (this.subSetLiteral.name != this.sourceLiteral.name) { EAOutputLogger.log(this.model, this.owner.owner.settings.outputName , string.Format("Literal value '{0}' has been renamed from '{1}' since the last schema generation" , this.sourceLiteral.owner.name + "." + this.sourceLiteral.name , this.subSetLiteral.name) , ((UTF_EA.ElementWrapper)sourceLiteral.owner).id , LogTypeEnum.warning); } } this.subSetLiteral.name = this.sourceLiteral.name; this.subSetLiteral.stereotypes = this.sourceLiteral.stereotypes; //alias ((UTF_EA.EnumerationLiteral)subSetLiteral).alias = ((UTF_EA.EnumerationLiteral)sourceLiteral).alias; //notes only update them if they are empty if (this.subSetLiteral.ownedComments.Count == 0 || !this.subSetLiteral.ownedComments.Any(x => x.body.Length > 0)) { this.subSetLiteral.ownedComments = this.sourceLiteral.ownedComments; if (this.owner.owner.settings.prefixNotes && this.owner.owner.settings.prefixNotesText.Length > 0 && this.subSetLiteral.ownedComments.Any(x => x.body.Length > 0)) { foreach (var comment in subSetLiteral.ownedComments) { comment.body = this.owner.owner.settings.prefixNotesText + Environment.NewLine + comment.body; } } } ((UTF_EA.Element) this.subSetLiteral).save(); //copy tagged values ((UTF_EA.Element) this.subSetLiteral).copyTaggedValues((UTF_EA.Element) this.sourceLiteral); //add tagged value with reference to source literal value ((UTF_EA.Element) this.subSetLiteral).addTaggedValue(this.owner.owner.settings.sourceAttributeTagName, ((UTF_EA.Element) this.sourceLiteral).guid); }