Add UML Tagged Values to the generated documentation

Support

Hello, I'm currently evaluating Software Modeler. So far I like it very much. I've created a new project and added a UML class diagram to it. I added a class for which I created attributes. For some attributes I added Tagged Values.

Now I tried to generate a documentation using Process->Documentation functionality. I chose to create a .docx document. I like the output very much, but it does not contain the Tagged Values. Is it possible to influence the document generation to include the tagged values?

The reason behind this is, that we need to mark some attributes as Required (Required: Yes/No) and for some attributes we need to impose a character limit (MaxLength: 50). The Tagged Values feature of UML seems like a perfect solution to this, but it does not appear in the Documentation.

Thank you very much.

Best regards

Vladimir Gregor

20 October 2017 15:23:32 Vladimír Gregor

Add Comment

Dusan Rodina - softwareideas.net 20 October 2017 17:52:28

Hello,

thank you for your positive evaluation!

The documention generation and the default documentation template will be improved to include tagged values in one of next releases (probably the next one).

Software Ideas Modeler supports changing the documentation generation even now. Documentation template can be adjusted using Documentation Template Editor accessible from Process/Templates/Documentation Templates.

Example code for tagged value enumeration:

ForEach:Element.TaggedValues

AddNewTableRow

AddText(TaggedValue.Name)

GoToNextTableCell

AddText(TaggedValue.Type)

GoToNextTableCell

AddText(TaggedValue.Value)

EndFor

Vladimír Gregor 23 October 2017 0:36:05

RE:

Hello Dusan,

thank you for quick response. It's great to see that Software Modeler can actually create a documentation which includes Tagged Values. I have now noticed the possibility to browse the Documentation Template code. However, I'm not sure where exactly I should insert the code you submitted.

Could you give me more information on this?

Thank you.

Vladimír Gregor 23 October 2017 10:42:34

RE: RE:

So I started experimenting with Documentation Template code, however so far I was not able to achieve any desired results. I wanted to start simple - to remove the "Multiplicity" column from the class diagram documentation. I commented out 6 lines of code from the Default Documentation Template.

I am attaching the whole Documentation Template code for reference:

// Front Page

// Title - Project Name

SetParagraphStyle("Title")

SetParagraphSpaceBefore(100)

SetCenterAlignment

AddText(Project.Name)

// Subtitle - Author name

AddNewParagraph

SetParagraphStyle("Subtitle")

SetCenterAlignment

AddText(Project.Authors)

AddNewParagraph

AddNewPage

// Header

EditHeader

SetParagraphStyle("Text")

SetCenterAlignment

AddText(Project.Name)

// Footer

EditFooter

SetParagraphStyle("Text")

SetCenterAlignment

AddTemplateText("Page.Number")

EditBody

// Table of Contents

AddNewParagraph

SetParagraphStyle("Heading 1")

SetParagraphNormalText

AddText("Contents")

AddNewParagraph

AddParagraphTab(165, "Right", ".")

AddTemplateText("Document.TableOfContents")

AddNewParagraph

AddNewParagraph

AddNewPage

ClearParagraphTabs()

// Glossary

IfNot:Project.Glossary.IsEmpty

SetParagraphStyle("Heading 1")

SetParagraphLeftIndent(10)

ContinueNumberedList

SetParagraphNumbering("HeadingMultiLevel")

AddText("Glossary")

SetParagraphHeading(0)

AddNewParagraph

AddTable(2,1,DocumentBodyWidth, Mm(5))

SetParagraphStyle("Text")

SetTableStyle("Blue")

AddText("Term")

GoToNextTableCell

AddText("Definition")

ForEach:Project.Glossary

AddNewTableRow

AddText(GlossaryTerm.Term)

GoToNextTableCell

AddText(ChangeTextAlignment(ChangeFontSize(ChangeFontName(GlossaryTerm.Meaning, "Times New Roman"),12),"Justified"))

EndFor

EndTable

AddNewParagraph

AddNewPage

EndIf

// Count diagrams

Set:DiagramCounter=0

Set:TotalDiagramsCount=0

ForEach:Project.AllFolders

Set:TotalDiagramsCount=Sum(TotalDiagramsCount,Folder.Diagrams.Count)

EndFor

// Diagram pages

ForEach:Project.AllFolders

AddNewParagraph

SetParagraphStyle("Heading 1")

SetParagraphLeftIndent(10)

SetParagraphNumbering("HeadingMultiLevel")

AddText(" ")

AddText(Folder.Name)

SetParagraphHeading(1)

// Folder description

AddNewParagraph

SetParagraphStyle("Text")

AddText(ChangeTextAlignment(ChangeFontSize(ChangeFontName(Folder.Documentation, "Times New Roman"),12),"Justified"))

// Documents

ForEach:Folder.Documents

AddNewParagraph

SetParagraphStyle("Heading 2")

SetParagraphLeftIndent(10)

SetParagraphNumbering("HeadingMultiLevel")

AddText(" ")

AddText(Document.Name)

SetParagraphHeading(2)

AddNewParagraph

AddText(Document.Content)

EndFor

// Diagrams

ForEach:Folder.Diagrams

If:GT(Diagram.Elements.Count,0)

AddNewParagraph

SetParagraphStyle("Heading 2")

SetParagraphLeftIndent(10)

SetParagraphNumbering("HeadingMultiLevel")

AddText(" ")

AddText(Diagram.Name)

SetParagraphHeading(2)

// Diagram description

AddNewParagraph

SetParagraphStyle("Text")

AddText(ChangeTextAlignment(ChangeFontSize(ChangeFontName(Diagram.Documentation, "Times New Roman"),12),"Justified"))

// Diagram image

AddNewParagraph

SetParagraphStyle("Text")

SetCenterAlignment

AddImage(Diagram.Image,DocumentBodyWidth)

// Diagram elements table

AddNewParagraph

SetLeftAlignment

AddTable(3,1,DocumentBodyWidth, Mm(5))

SetTableStyle("Blue")

AddText("Name")

GoToNextTableCell

AddText("ID")

GoToNextTableCell

AddText("Type")

ForEach:Diagram.Elements

IfNot:IsEmpty(Element.Name)

AddNewTableRow

SetParagraphStyle("Compact Text")

AddText(Element.Name)

GoToNextTableCell

SetParagraphStyle("Compact Text")

AddText(Element.CustomID)

GoToNextTableCell

SetParagraphStyle("Compact Text")

AddText(Element.ElementType)

EndIf

EndFor

EndTable

// Elements

ForEach:Diagram.Elements

If:Or(Element.HasDocumentation,Element.HasAttributes,Element.HasOperations,Equals(Element.ElementType,"state"),Equals(Element.ElementType,"use-case"),Equals(Element.ElementType,"enumeration"))

AddNewParagraph

SetParagraphStyle("Heading 3")

SetParagraphLeftIndent(15)

SetParagraphNumbering("HeadingMultiLevel")

AddText(" ")

AddText(Element.Name)

SetParagraphHeading(3)

// Diagram description

AddNewParagraph

SetParagraphStyle("Text")

AddText(ChangeTextAlignment(ChangeFontSize(ChangeFontName(Element.Documentation, "Times New Roman"),12),"Justified"))

// Attributes

If:Element.HasAttributes

AddNewParagraph

SetParagraphStyle("Heading 4")

AddText("Attributes")

AddNewParagraph

SetParagraphStyle("Text")

If:Equals(Element.ElementType,"erd-entity")

AddTable(5,1,DocumentBodyWidth, Mm(5))

SetTableStyle("Blue")

SetTableColumnSize(0,0.1)

SetTableColumnSize(1,0.3)

SetTableColumnSize(2,0.15)

SetTableColumnSize(3,0.1)

SetTableColumnSize(4,0.35)

SetParagraphStyle("Compact Text")

AddText("Key")

GoToNextTableCell

SetParagraphStyle("Compact Text")

AddText("Name")

GoToNextTableCell

SetParagraphStyle("Compact Text")

AddText("Type")

GoToNextTableCell

SetParagraphStyle("Compact Text")

AddText("Size")

GoToNextTableCell

SetParagraphStyle("Compact Text")

AddText("Description")

ForEach:Element.Attributes

AddNewTableRow

SetParagraphStyle("Compact Text")

If:Attribute.IsPrimaryKey

AddText("PK")

EndIf

If:Attribute.IsForeignKey

If:Attribute.IsPrimaryKey

AddText(",")

EndIf

AddText("FK")

EndIf

GoToNextTableCell

SetParagraphStyle("Compact Text")

AddText(Attribute.Name)

GoToNextTableCell

SetParagraphStyle("Compact Text")

AddText(Attribute.OriginalType.Name)

GoToNextTableCell

SetParagraphStyle("Compact Text")

AddText(Attribute.TypeLength)

GoToNextTableCell

SetParagraphStyle("Compact Text")

AddTextLine(Attribute.Description)

AddText(ChangeTextAlignment(ChangeFontSize(ChangeFontName(Attribute.Documentation, "Times New Roman"),12),"Justified"))

EndFor

EndTable

Else

AddTable(4,1,DocumentBodyWidth, Mm(5))

SetTableStyle("Blue")

SetTableColumnSize(0,0.3)

SetTableColumnSize(1,0.2)

SetTableColumnSize(2,0.1)

SetTableColumnSize(3,0.4)

SetParagraphStyle("Compact Text")

AddText("Name")

GoToNextTableCell

SetParagraphStyle("Compact Text")

AddText("Type")

///GoToNextTableCell

///SetParagraphStyle("Compact Text")

///AddText("Multiplicity")

GoToNextTableCell

SetParagraphStyle("Compact Text")

AddText("Description")

ForEach:Element.Attributes

AddNewTableRow

SetParagraphStyle("Compact Text")

AddText(Attribute.Name)

GoToNextTableCell

SetParagraphStyle("Compact Text")

AddText(Attribute.OriginalType.Name)

// GoToNextTableCell

///SetParagraphStyle("Compact Text")

///AddText(Attribute.Multiplicity)

GoToNextTableCell

SetParagraphStyle("Compact Text")

AddTextLine(Attribute.Description)

AddText(ChangeTextAlignment(ChangeFontSize(ChangeFontName(Attribute.Documentation, "Times New Roman"),12),"Justified"))

EndFor

EndTable

EndIf

EndIf

// Data

If:Element.HasData

AddNewParagraph

SetParagraphStyle("Heading 4")

AddText("Data")

AddNewParagraph

SetParagraphStyle("Text")

AddTable(Element.Attributes.Count,1,DocumentBodyWidth, Mm(5))

SetTableStyle("Blue")

SetParagraphStyle("Compact Text")

ForEach:Element.Attributes

AddText(Attribute.Name)

IfNot:IsLastItem

GoToNextTableCell

SetParagraphStyle("Compact Text")

EndIf

EndFor

ForEach:Element.DataRows

AddNewTableRow

SetParagraphStyle("Compact Text")

ForEach:DataRow.Values

AddText(Value)

IfNot:IsLastItem

GoToNextTableCell

SetParagraphStyle("Compact Text")

EndIf

EndFor

EndFor

EndTable

EndIf

// Enumeration items

If:GT(Element.EnumerationItems.Count,0)

AddNewParagraph

SetParagraphStyle("Heading 4")

AddText("Items")

AddNewParagraph

SetParagraphStyle("Text")

AddTable(5,1,DocumentBodyWidth, Mm(5))

SetTableStyle("Blue")

SetTableColumnSize(0,0.2)

SetTableColumnSize(1,0.3)

SetTableColumnSize(2,0.5)

SetParagraphStyle("Compact Text")

AddText("Name")

GoToNextTableCell

SetParagraphStyle("Compact Text")

AddText("Value")

GoToNextTableCell

SetParagraphStyle("Compact Text")

AddText("Description")

ForEach:Element.EnumerationItems

AddNewTableRow

SetParagraphStyle("Compact Text")

AddText(EnumerationItem.Name)

GoToNextTableCell

SetParagraphStyle("Compact Text")

AddText(EnumerationItem.Value)

GoToNextTableCell

SetParagraphStyle("Compact Text")

AddText(ChangeTextAlignment(ChangeFontSize(ChangeFontName(EnumerationItem.Documentation, "Times New Roman"),12),"Justified"))

EndFor

EndTable

EndIf

// Operations

If:Element.HasOperations

AddNewParagraph

SetParagraphStyle("Heading 4")

AddText("Operations")

ForEach:Element.Operations

AddNewParagraph

SetParagraphStyle("Heading 5")

AddText(Operation.Name)

If:Operation.HasReturnType

AddNewParagraph

SetParagraphStyle("Text")

SwitchBold()

AddText("Return type: ")

SwitchBold()

AddText(Operation.OriginalReturnType.Name)

EndIf

AddNewParagraph

SetParagraphStyle("Text")

AddText(Operation.Documentation)

If:GreaterThan(Operation.Parameters.Count,0)

AddNewParagraph

SetParagraphStyle("Heading 6")

AddText("Parameters")

AddNewParagraph

SetParagraphStyle("Text")

AddTable(4,1,DocumentBodyWidth, Mm(5))

SetTableStyle("Blue")

AddText("Name")

GoToNextTableCell

AddText("Type")

GoToNextTableCell

AddText("Default Value")

GoToNextTableCell

AddText("Description")

ForEach:Operation.Parameters

AddNewTableRow

AddText(Parameter.Name)

GoToNextTableCell

AddText(Parameter.OriginalType.Name)

GoToNextTableCell

AddText(Parameter.DefaultValue)

GoToNextTableCell

AddText(ChangeTextAlignment(ChangeFontSize(ChangeFontName(Parameter.Documentation, "Times New Roman"),12),"Justified"))

EndFor

EndTable

EndIf

EndFor

EndIf

// Actions

If:Equals(Element.ElementType,"state")

AddNewParagraph

SetParagraphStyle("Text")

AddTable(2,3,DocumentBodyWidth, Mm(5))

SetTableColumnSize(0,0.3)

SetTableColumnSize(1,0.7)

SetTableStyle("Simple")

AddText("From")

GoToNextTableCell

ForEach:Element.InRelations

If:Eq(Relation.From.ElementType,"state")

AddText(Relation.From.Name)

AddText(", ")

EndIf

EndFor

GoToNextTableCell

AddText("To")

GoToNextTableCell

ForEach:Element.OutRelations

If:Eq(Relation.To.ElementType,"state")

AddText(Relation.To.Name)

AddText(", ")

EndIf

EndFor

GoToNextTableCell

AddText("State Invariant")

GoToNextTableCell

AddText(Element.StateInvariant)

ForEach:Element.Actions

AddNewTableRow

AddText(Action.Name)

GoToNextTableCell

AddText(Action.Behavior)

EndFor

EndTable

EndIf

// Use Case

If:Equals(Element.ElementType,"use-case")

// Status

AddNewParagraph

SetParagraphStyle("Text")

AddTable(3,1,DocumentBodyWidth, Mm(5))

SetTableStyle("Simple")

SetTableColumnSize(0,0.3)

SetTableColumnSize(1,0.6)

SetTableColumnSize(2,0.1)

AddText("Status")

GoToNextTableCell

AddText(Element.State)

GoToNextTableCell

AddImage(Element.StateIcon,Mm(10),Mm(10))

EndTable

AddNewParagraph

AddText(" ")

// Scope

AddNewParagraph

SetParagraphStyle("Text")

AddTable(3,2,DocumentBodyWidth, Mm(5))

SetTableStyle("Simple")

SetTableColumnSize(0,0.3)

SetTableColumnSize(1,0.6)

SetTableColumnSize(2,0.1)

AddText("Scope")

GoToNextTableCell

AddText(Element.DesignScope)

AddText(" / ")

AddText(Element.DesignScopeName)

GoToNextTableCell

AddImage(Element.DesignScopeIcon,Mm(10),Mm(10))

GoToNextTableCell // Goal Level

AddText("Goal Level")

GoToNextTableCell

AddText(Element.GoalLevel)

GoToNextTableCell

AddImage(Element.GoalLevelIcon,Mm(10),Mm(10))

EndTable

AddNewParagraph

AddText(" ")

// Actors

AddNewParagraph

SetParagraphStyle("Text")

AddTable(2,1,DocumentBodyWidth, Mm(5))

SetTableStyle("Blue")

SetTableColumnSize(0,0.3)

SetTableColumnSize(1,0.7)

AddText("Actor")

GoToNextTableCell

AddText("Description")

ForEach:Element.Stakeholders

AddNewTableRow

AddText(Stakeholder.Name)

GoToNextTableCell

AddText(ChangeTextAlignment(ChangeFontSize(ChangeFontName(Stakeholder.Documentation, "Times New Roman"),12),"Justified"))

EndFor

EndTable

AddNewParagraph

AddText(" ")

// Precondition

AddNewParagraph

SetParagraphStyle("Text")

AddTable(2,3,DocumentBodyWidth, Mm(5))

SetTableColumnSize(0,0.3)

SetTableColumnSize(1,0.7)

SetTableStyle("Simple")

AddText("Precondition")

GoToNextTableCell

AddText(Element.Precondition)

// Success Guarantee

GoToNextTableCell

AddText("Success Guarantee")

GoToNextTableCell

AddText(Element.SuccessGuarantees)

// Minimal Guarantee

GoToNextTableCell

AddText("Minimal Guarantee")

GoToNextTableCell

AddText(Element.MinimalGuarantees)

EndTable

// Flow events

AddNewParagraph

StartNumberedList

ForEach:Element.FlowEvents

SetParagraphNumbering("ListMultiLevel")

SetParagraphNumberingLevel(1)

SetParagraphLeftIndent(10)

SetParagraphFirstLineIndent(0)

AddText(FlowEvent.Name)

AddText(" ")

AddText(ChangeTextAlignment(ChangeFontSize(ChangeFontName(FlowEvent.Documentation, "Times New Roman"),12),"Justified"))

ForEach:FlowEvent.SubEvents

AddNewParagraph

ContinueNumberedList

SetParagraphNumbering("ListMultiLevel")

SetParagraphNumberingLevel(2)

SetParagraphLeftIndent(15)

SetParagraphFirstLineIndent(5)

AddText(SubEvent.Name)

AddText(" ")

AddText(ChangeTextAlignment(ChangeFontSize(ChangeFontName(SubEvent.Documentation, "Times New Roman"),12),"Justified"))

ForEach:SubEvent.SubEvents(SubEvent2)

AddNewParagraph

SetParagraphNumbering("ListMultiLevel")

SetParagraphNumberingLevel(3)

SetParagraphLeftIndent(25)

SetParagraphFirstLineIndent(10)

AddText(SubEvent2.Name)

AddText(" ")

AddText(ChangeTextAlignment(ChangeFontSize(ChangeFontName(SubEvent2.Documentation, "Times New Roman"),12),"Justified"))

ForEach:SubEvent2.SubEvents(SubEvent3)

AddNewParagraph

SetParagraphNumbering("ListMultiLevel")

SetParagraphNumberingLevel(4)

SetParagraphLeftIndent(35)

SetParagraphFirstLineIndent(15)

AddText(SubEvent3.Name)

AddText(" ")

AddText(ChangeTextAlignment(ChangeFontSize(ChangeFontName(SubEvent3.Documentation, "Times New Roman"),12),"Justified"))

EndFor

EndFor

EndFor

If:IsLastItem

AddNewParagraph

ContinueNumberedList

EndIf

EndFor

SetParagraphNormalText

EndIf

EndIf

EndFor

EndIf // If:GT(Diagram.Elements.Count,0)

// Notify progress

Set:DiagramCounter=Inc(DiagramCounter)

NotifyProgress(Div(DiagramCounter, TotalDiagramsCount))

EndFor

AddNewPage

EndFor

With the attached Documentation Template code, the documentation generation into a .docx format takes roughly 5 minutes (whereas it took about 2-3 seconds before) and the result is a broken .docx file unreadable by MS Word 2016.

Could you help me to setup the Documentation Template code so that it would display all tagged values for Attributes of a class?

Thank you very much.

Best regards

Vladimir Gregor

Dusan Rodina - softwareideas.net 24 October 2017 10:36:49

RE: RE: RE:

I apologize for the late answer. The complex solution for this issue is being prepared. The adjusted template and other improvements in documentation generation will be included in the next release of Software Ideas Modeler.

If everything goes well, it should be released this week or in the beginning of the next one.

If you want to remove the multiplicity column from the template, you also have to change the number of columns of table in this line:

AddTable(3,1,DocumentBodyWidth, Mm(5))

If you want to add a tagged value instead of multiplicity to the Attributes table.

E.g. for "Required" is it possible this way:

AddText(Attribute.GetTaggedValue("Required"))

To display all tagged values, you need to enumerate them all this way:

ForEach:Attribute.TaggedValues

AddText(TaggedValue.Name)

AddText(" = ")

AddText(TaggedValue.Value)

AddText(", ")

EndFor