1. Home
  2. Docs
  3. Chapter 23. Document Production
  4. 5. Writing Doc. Composer element templates
  5. DCTL Examples

DCTL Examples

Working with Use Case Flow of Events

<ForEach property="stepContainers">
    <Property property="name"/>
    <TableBlock>
        <FlowOfEventIterationBlock> <!-- Walk through each step (row) in a scenario -->
            <TableRow>
                <TableCell>
                    <FlowOfEventIndent/> <!-- Apply proper indentation to the current step. You don't have to specify the level of indentation. It's automatically done for you -->
 
                    <Property property="index" foreColor="#848284" style="Table Contents"/> <!-- The step number. We set its foreColor to a lighter one to make it looks like how it looks in Visual Paradigm -->

                    <Text style="Table Contents"> </Text>
                    <ValueChecker property="type" operator="not equals" value="">
                        <ValueChecker property="type" operator="not equals" value="system">
                            <Property property="type" foreColor="#00B200" style="Table Contents"/> <!-- @type here refers to 'control labels' like if, then, elseif -->
                        </ValueChecker>
                        <ValueChecker property="type" operator="equals" value="system">
                            <Property property="type" foreColor="#CA6400" style="Table Contents"/> <!-- @type here refers to SYSTEM -->
                        </ValueChecker>
                    </ValueChecker>
                    <Property property="name" style="Table Contents"/> <!-- The content of step -->
               </TableCell>
            </TableRow>
        </FlowOfEventIterationBlock>
    </TableBlock>
</ForEach>

Working with Sub-Diagrams

<HasSubDiagramChecker>
   <!-- Name of all sub-diagrams -->
   <ForEachSubDiagram>
      <Property property="name" />
      <ParagraphBreak/>
   </ForEachSubDiagram >

   <!-- Name of all sub-BPD -->
   <ForEachSubDiagram diagramType="BusinessProcessDiagram">
      <Property property="name" />
      <ParagraphBreak/>
   </ForEachSubDiagram >
</HasSubDiagramChecker>

Working with References

<!-- Output the name of all Use Case reference -->
<HasValueChecker property="references">
   <ForEach property="references">
      <ValueChecker property="type" operator="equals" value="Model Element">
         <ModelElementProperty property="url">
            <ValueChecker property="modelType" operator="equals" value="UseCase">
               <Property property="name" />
            </ValueChecker>
         </ModelElementProperty>
      </ValueChecker>
   </ForEach>
</HasValueChecker>

<!-- Output the name of all model elements that are referencing the querying element as 'Model Element Reference' -->
<HasValueChecker property="modelElementReferencedBys">
   <ForEach property="modelElementReferencedBys">
      <Property property="name"/>
   </ForEach>
</HasValueChecker>

<!-- Output the name of all model elements that are referencing the querying element as 'Shape Reference' -->
<HasValueChecker property="viewReferencedBys">
   <ForEach property="viewReferencedBys">
      <Property property="name"/>  
   </ForEach>
</HasValueChecker>

Working with Stereotypes and Tagged Values

<!-- Output the name of all assigned stereotypes -->
<HasValueChecker property="stereotypes">
   <ForEach property="stereotypes" ignoreLastSeparator="true">
      <Text><<</Text>
         <Property property="name" />
      <Text>>></Text>
   </ForEach>
</HasValueChecker>
<ParagraphBreak/>

<!-- Output the name of tagged values added -->
<HasValueChecker property="taggedValues">
   <ModelElementProperty property="taggedValues">
      <HasChildElementChecker modelType="TaggedValue">
         <IterationBlock modelType="TaggedValue">
            <Property property="name" />
            <Text> - </Text>
            <Property property="value" />
         </IterationBlock>
      </HasChildElementChecker>
   </ModelElementProperty>
</HasValueChecker>

Working with Table Records of Entity

<!-- Check if an entity (i.e. DBTable) has record specified -->
<HasValueChecker property="records">
   <TableBlock>
      <!-- Create a header row that shows the columns' name in each cell -->
      <TableRow>
         <IterationBlock modelType = "DBColumn">
            <TableCell>
               <Property property="name" />
            </TableCell>
         </IterationBlock>
      </TableRow>
      <!-- Create one row for each record -->
      <ModelElementProperty property="records">
         <IterationBlock modelType = "EntityRecord">
            <TableRow>
               <IterationBlock modelType = "EntityRecordCell">
                  <TableCell>
                     <!-- Output the value directly if it's a general column -->
                     <Property property="value" />
                     <!-- Use the following method to output the value if it's a FK -->
                     <HasValueChecker property="value" flag="true">
                        <ModelElementProperty property="value">
                           <Property property="value" />
                        </ModelElementProperty>
                     </HasValueChecker>
                  </TableCell>
               </IterationBlock>
            </TableRow>
         </IterationBlock>
      </ModelElementProperty>  
   </TableBlock>
</HasValueChecker>

Working with Working Procedures of BPMN Task/Sub-Process

<!-- Check if a BPMN task/sub-process has working procedure entered -->
<HasValueChecker property="bpProcedures">

   <!-- Retrieve the procedure steps -->
   <ForEach property="bpProcedures">
      <Property property="name" style="@heading"/>
      <ParagraphBreak/>
   
      <!-- Retrieve the steps in the querying procedure set -->
      <ForEach property="bpProcedureSteps">
         <Property property="name"/>
         <ParagraphBreak/>
      </ForEach>
   </ForEach>   
</HasValueChecker>

Working with Action and Action’s Type

<HasChildElementChecker flag="true">
   <TableBlock colWidths="1,2" tableWidth="14500" alignment="right">
      <TableRow>
         <TableCell leftBorderEnable="false" rightBorderEnable="false" color="230, 230, 230">
            <Text style="Column header 1">Element</Text>
         </TableCell>
         <TableCell leftBorderEnable="false" rightBorderEnable="false" color="230, 230, 230">
            <Text style="Column header 1">Description</Text>
         </TableCell>
      </TableRow>
   
      <IterationBlock modelType="ActivityAction">
         <!-- Sort the activities by name. -->
         <Sortings>
            <Sorting by="name"></Sorting>
         </Sortings>

         <ValueChecker property="modelType" operator="not equals" value="">
            <TableRow>
               <TableCell leftBorderEnable="false" rightBorderEnable="false">
                  <Property property="name" style="Table Contents"/>
               </TableCell>
               <TableCell leftBorderEnable="false" rightBorderEnable="false">
                  <ValueChecker property = "documentation" operator = "NOT EQUAL" value = "">
                     <Property property="documentation" style="Table Contents"/>
                     <ParagraphBreak/>
                     <ParagraphBreak/>
                  </ValueChecker>

                  <ModelElementProperty property="actionType">
               
                     <!-- Call Behavior Action -->
                     <ValueChecker property="modelType" operator="equals" value="CallBehaviorAction">
                        <Text style="Table Contents">Call action:</Text>
                        <HasValueChecker property="behavior" flag="true">
                           <ModelElementProperty property="behavior">
                              <Property property="name" style="TableContents" isBold="true"/>
                          </ModelElementProperty>
                        </HasValueChecker>
                        <HasValueChecker property="behavior" flag="false">
                           <Text style="Table Contents"><Unspecified></Text>
                        </HasValueChecker>
                     </ValueChecker>
                 
                     <!-- Call Operation Action -->
                     <ValueChecker property="modelType" operator="equals" value="CallOperationAction">
                        <Text style="Table Contents">Call operation:</Text>
                        <HasValueChecker property="operation" flag="true">
                 
                           <ModelElementProperty property="operation">
                              <ParentModel>
                                 <Property property="name" style="Table Contents"  isBold="true"/>
                              </ParentModel>
                              <Text style="Table Contents">.</Text>
                              <Property property="name" style="Table Contents"  isBold="true"/>
                           </ModelElementProperty>
                        </HasValueChecker>
                        <HasValueChecker property="operation" flag="false">
                           <Text style="Table Contents"><Unspecified></Text>
                        </HasValueChecker>
                     </ValueChecker>
                  </ModelElementProperty>
                
               </TableCell>
            </TableRow>
         </ValueChecker>
      </IterationBlock>
   </TableBlock>
</HasChildElementChecker>

Working with Chart Relations

<!-- Show the Chart Relations details -->
<HasValueChecker property="chartRelations">
   <Text style="@heading+">Chart Relations</Text>
   <ParagraphBreak/>

   <TableBlock tableStyle="Summaries" colWidths="20, 80">
      <TableRow>
         <TableCell>
            <Text>Code</Text>
            </TableCell>
            <TableCell>
            <Text>Begins</Text>
         </TableCell>
         <TableCell>
            <Text>Ends</Text>
         </TableCell>
      </TableRow>

      <ForEach property="chartRelations">
         <TableRow>
            <TableCell>
               <ModelElementProperty property="code">
                  <Property property="code"/>
               </ModelElementProperty>
            </TableCell>
            <TableCell>
               <ModelElementProperty property="from">
                  <Icon/>
                  <Property property="name"/>
               </ModelElementProperty>
            </TableCell>
            <TableCell>
               <ModelElementProperty property="to">
                  <Icon/>
                  <Property property="name"/>
               </ModelElementProperty>
            </TableCell>
         </TableRow>
      </ForEach>

   </TableBlock>
</HasValueChecker>

Working with Model Transitor

<!-- Check if the querying element has transition, either from/to -->
<HasValueChecker property="Traceability">
   <Text>Traceability detected.</Text>
   <ParagraphBreak/>
</HasValueChecker>
<ParagraphBreak/>

<!-- List out the Transit From elements -->
<Text isBold="true">Transit From:</Text>
<ParagraphBreak/>
<ForEach property="transitFrom">
   <Property property="name"/>
   <ParagraphBreak/>
</ForEach>
<ParagraphBreak/>

<!-- List out the Transit To elements -->
<Text isBold="true">Transit To:</Text>
<ParagraphBreak/>
<ForEach property="transitTo">
   <Property property="name"/>
   <ParagraphBreak/>
</ForEach>
<ParagraphBreak/>

<!-- List out the Transit From diagrams -->
<Text isBold="true">Transit From (Diagram):</Text>
<ParagraphBreak/>
<ForEachDiagram property="transitFrom">
   <Property property="name"/>
   <ParagraphBreak/>
</ForEachDiagram>
<ParagraphBreak/>

<!-- List out the Transit To diagrams -->
<Text isBold="true">Transit To (Diagram):</Text>
<ParagraphBreak/>
<ForEachDiagram property="transitTo">
   <Property property="name"/>
   <ParagraphBreak/>
</ForEachDiagram>
<ParagraphBreak/>

Working with InstanceSpecification in an Object Diagram

<!-- Print the description of instanceSpecifications and their classifiers, in a given object diagram-->
<DiagramBaseInitiationBlock>
    <IterationBlock modelType="InstanceSpecification">
        <!-- Name of instance (in ${instance_name} : ${classifier} format)-->
        <Property property="name"/>
        <Text> : </Text>
        <HasValueChecker property="classifiers">
            <ForEach property="classifiers">
                <Property property="name" />
            </ForEach>
        </HasValueChecker>

        <!-- Description of class-->
        <ParagraphBreak/>
        <Text isBold="true">Description of classifier: </Text>
        <HasValueChecker property="classifiers">
            <ForEach property="classifiers">
                <Property property="description" />
            </ForEach>
        </HasValueChecker>    

        <!-- Description of instance-->
        <ParagraphBreak/>
        <Text isBold="true">Description of instance: </Text>
        <Property property="description"/>
        <ParagraphBreak/>
        <ParagraphBreak/>
    </IterationBlock>
</DiagramBaseInitiationBlock>