Retrieve Referenced Model Element in Doc. Composer
Visual Paradigm support created reference between any model elements or diagrams. This help in elaborate your models without being limited to a specific notations or resources. For example, you can use an Entity table to elaborate the data structure on database of an Actor. Visual Paradigm Doc. Composer allows you to create professional documentation with fully customizable templates. In Doc. Composer you are not limit to retrieve just the reference relationship between models, you can also output the detail information of the referenced elements. In this article we will show you how it works.
Assume we have an Actor which is reference to an Entity model and a Class model to elaborate its details.
To retrieve the referenced entity and class models from actor in Doc. Composer:
- Suppose we are using Build from Scratch mode in Doc. Composer, select the actor model in Model Explorer tree.
- Right click on the References template and select Duplicate from popup menu.
- Name the template as ReferenceModel.
- Replace the template content with the following code.
<?xml version="1.0" encoding="UTF-8"?> <AnyBaseInitiationBlock> <HasValueChecker property="references"> <Text style="@heading+">References</Text> <ParagraphBreak/> <TableBlock> <TableRow> <TableCell><Text>Name</Text></TableCell> <TableCell><Text>Model Type</Text></TableCell> <TableCell><Text>Description</Text></TableCell> </TableRow> <ForEach property="references"> <ValueChecker property="type" value="Model Element"> <ModelElementProperty property="url"> <TableRow> <TableCell><Property property="name"/></TableCell> <TableCell><Property property="modelType"/></TableCell> <TableCell><Property property="description"/></TableCell> </TableRow> </ModelElementProperty> </ValueChecker> </ForEach> </TableBlock> </HasValueChecker> </AnyBaseInitiationBlock>
- Press OK button to confirm the change and close Edit Template.
- Drag the ReferenceModel template from Template pane into document editor.
- Now the name referenced model elements as well as their model type and description are show in the table.
Understand the template
- There are multiple types of references available in Visual Paradigm, which can be reference of UML, reference of files, reference to diagrams, and also reference to model elements. To retrieve the model element the actor referenced we need to make sure it is a model element type reference. We can use the type property of the reference to determine what type of reference it is, and we proceed if the reference is in Model Element.
<ForEach property="references"> <ValueChecker property="type" value="Model Element">
- When the reference is a Model Element type reference, we can use the url property to find out the ID of the referenced element. The ID is a string value and we can use the ModelElementProperty node to parse it into the model element it referencing. And within the ModelElementProperty node it will be working on the referenced model element.
<ModelElementProperty property="url">
Related Know-how |
Related Link |
Leave a Reply
Want to join the discussion?Feel free to contribute!