1. Home
  2. Docs
  3. Chapter 23. Document Production
  4. 5. Writing Doc. Composer element templates
  5. Looping (Non Connector)

Looping (Non Connector)

Download PDF

When you want to retrieve the children elements from a querying model element / diagram, write a loop element.

<IterationBlock>

Retrieve elements from project / model element / diagram. By iterating over project and model element, a list of model element will be returned. By iterating over diagram, a list of diagram element will be returned. The following example show the use of <IterationBlock> in a template.

<IterationBlock modelType="class">
    <Property property="name"/>
    <ParagraphBreak/>
</IterationBlock>

Here is the outcome of the example above.

User
Account
AccountManager
Transaction
AccountController

The following table lists the available attributes of <IterationBlock>.

Name Description Required?
modelType : string Filter the children by specified model element type (e.g. package). Optional
modelTypes : string Filter the children by a number of model element types. (e.g. actor, usecase) Optional
stereotypes : string Filter the children by a number of stereotypes. Optional
name : string Filter the children by their name. Optional
filterhidden : boolean Filter hidden children diagram element. This is for retrieving from diagram/diagram element only. Optional
includeConnectors : boolean Determines whether to retrieve shape or shape+connectors from diagram. This is for retrieving from diagram only. Optional
allLevel : boolean Determines whether to retrieve all model elements from project. When false, only the root level elements will be retrieved. This attribute is only useful when retrieving elements from project. Optional
ignoreLastSeparator : boolean Ignore the break for the last element of current for-each loop.

Break can be <ParagraphBreak> or <StaticText @content= “\n” or “,”>.

Optional
breakString : string Insert a string between model elements of current for-each. Optional
identifier : string Optional
suppressDuplicatedModelElement : boolean = true When the same model element is being included twice in an iteration, having suppressDuplicatedModelElement set to true means to ignore those repeated occurrences. Optional

<ForEach>

Retrieve model elements from a model element’s property. The following example show the use of <ForEach> in a template.

<ForEach property = "stereotypes">
    <Property property="name"/>
    <ParagraphBreak/>
</ForEach>

Here is the outcome of the example above.

Control
ORM Persistable

The following table lists the available attributes of <ForEach>.

Name Description Required?
property : string The property from which model elements can be retrieved. Required
ignoreLastSeparator : boolean Ignore the break for the last element of current for-each loop. Optional
breakString : string Insert a string between model elements of current for-each. Optional

<ForEachSubDiagram>

Retrieve sub-diagram(s) from a model element. For example, retrieve sub-sequence-diagrams from a controller class. Note that you can only use <ForEachSubDiagram> to retrieve sub-diagram(s) of model element. If you want to retrieve diagrams from project, use <ForEachDiagram> instead.

The following table lists the available attributes of <ForEachSubDiagram>.

Name Description Required?
diagramType : string The type of diagram to retrieve. Optional
ignoreLastSeparator : boolean Ignore the break for the last element of current for-each loop. Optional
layerFilters : string Select the diagram layer to or not to process when outputting content to a document. Let’s say if you need to produce a document for a business stakeholder, you may not want him to see the annotation shapes. What you have to do is to configure the layer filter by excluding the annotation layer (assuming that such a layer exists). Doc. Composer engine will read the filter and not to process the annotation shapes.

Possible values:
@followDiagram – Follow the visibility of the layers set to the actual diagram. Layers that are set visible will be included here, likewise hidden layers will be excluded. Simply put, what you can see in the document will be exactly the same as the real diagram.

@all – Include all diagram layers in processing.

name – The name of the only layer to include in processing.

name1, name2, name3… – The names of the layers to include in processing. “, ” is used as a delimiter.

${…} – ‘…’ is the variable name. Use a variable to specify the name/names of layers to include in processing. User can specify the value of the variable in Doc. Composer.

@exclude:name – The name of the only layer not to process.

@exclude:name1, name2, name3… – The names of the layers not to process.

@exclude:${…} – ‘…’ is the variable name. Use a variable to specify the name/names of layers not to include in processing. User can specify the value of the variable in Doc. Composer.

By not specifying layerFilters, ‘AdHoc’ filter will be used, which means that the end user will be responsible for configuring the filter in Doc. Composer. If not specified, it will behave as @followDiagram.

Optional

<ForEachDiagram>

Retrieve diagram(s) from project. Like other for-each elements, you can specify the type of diagram to retrieve. For example, retrieve all class diagrams from project. Note that you can only use <ForEachDiagram> to retrieve diagram from project. If you want to retrieve sub-diagrams from model element, use <ForEachSubDiagram> instead.

The following table lists the available attributes of <ForEachDiagram>.

Name Description Required?
diagramType : string The type of diagram to retrieve. Optional
property : string The property from which diagrams can be retrieved. Optional
ignoreLastSeparator : boolean Ignore the break for the last element of current for-each loop. Optional
layerFilters : string Select the diagram layer to or not to process when outputting content to a document. Let’s say if you need to produce a document for a business stakeholder, you may not want him to see the annotation shapes. What you have to do is to configure the layer filter by excluding the annotation layer (assuming that such a layer exists). Doc. Composer engine will read the filter and not to process the annotation shapes.

Possible values:
@followDiagram – Follow the visibility of the layers set to the actual diagram. Layers that are set visible will be included here, likewise hidden layers will be excluded. Simply put, what you can see in the document will be exactly the same as the real diagram.

@all – Include all diagram layers in processing.

name – The name of the only layer to include in processing.

name1, name2, name3… – The names of the layers to include in processing. “, ” is used as a delimiter.

${…} – ‘…’ is the variable name. Use a variable to specify the name/names of layers to include in processing. User can specify the value of the variable in Doc. Composer.

@exclude:name – The name of the only layer not to process.

@exclude:name1, name2, name3… – The names of the layers not to process.

@exclude:${…} – ‘…’ is the variable name. Use a variable to specify the name/names of layers not to include in processing. User can specify the value of the variable in Doc. Composer.

By not specifying layerFilters, ‘AdHoc’ filter will be used, which means that the end user will be responsible for configuring the filter in Doc. Composer. If not specified, it will behave as @followDiagram.

Optional

<ForEachOwnerDiagram>

Retrieve the diagram(s) that owns a specific model element. For example, class diagram “Domain Diagram” and “Security” both contain class “Login” (same model element), by applying <ForEachOwnerDiagram> on the “Login” class, diagram “Domain Diagram” and “Security” will be returned.

The following table lists the available attributes of <ForEachOwnerDiagram>.

Name Description Required?
diagramType : string The type of diagram to retrieve. Optional
ignoreLastSeparator : boolean Ignore the break for the last element of current for-each loop. Optional
layerFilters : string Select the diagram layer to or not to process when outputting content to a document. Let’s say if you need to produce a document for a business stakeholder, you may not want him to see the annotation shapes. What you have to do is to configure the layer filter by excluding the annotation layer (assuming that such a layer exists). Doc. Composer engine will read the filter and not to process the annotation shapes.

Possible values:
@followDiagram – Follow the visibility of the layers set to the actual diagram. Layers that are set visible will be included here, likewise hidden layers will be excluded. Simply put, what you can see in the document will be exactly the same as the real diagram.

@all – Include all diagram layers in processing.

name – The name of the only layer to include in processing.

name1, name2, name3… – The names of the layers to include in processing. “, ” is used as a delimiter.

${…} – ‘…’ is the variable name. Use a variable to specify the name/names of layers to include in processing. User can specify the value of the variable in Doc. Composer.

@exclude:name – The name of the only layer not to process.

@exclude:name1, name2, name3… – The names of the layers not to process.

@exclude:${…} – ‘…’ is the variable name. Use a variable to specify the name/names of layers not to include in processing. User can specify the value of the variable in Doc. Composer.

By not specifying layerFilters, ‘AdHoc’ filter will be used, which means that the end user will be responsible for configuring the filter in Doc. Composer. If not specified, it will behave as @followDiagram.

Optional