# UML Output

📐 Generate an XML file for graphing your application via Eclipse UML2Tools

{% hint style="warning" %}
UML2 Tools hasn't been developed for Eclipse since 2008. This strategy is now more for reference than anything else.
{% endhint %}

This is a documentation strategy that ultimately lets you generate UML diagrams from the CFCs that you have written. That being said, it does not actually generate diagrams.

What this template startegy does is generate the XML file the Eclipse UML2 Tools that stores the information about your domain - the classes, the associations, the inheritence hierarchy, etc. From there it is very easy with [UML2 Tools](http://wiki.eclipse.org/MDT-UML2Tools) to generate UML diagrams like Class Diagrams, Sequence Diagrams, etc.

![](/files/-MPjQDoz-GpMTDztgYpq)

To get started, you need to download and install the Eclipe plugin UML2 Tools in your Eclipse install.

1. Go to: <http://www.eclipse.org/modeling/mdt/downloads/?showAll=1&hlbuild=I200907241018&project=uml2tools>
2. We are actually going to use the *0.9.1 Integration Builds* plugin, simply because it is more stable, and has several key bug fixes.
3. Download the *All-In-One Update Site* and save the .zip file
4. In Eclipse, go to *Help > Install New Software*
5. Click *Add*
6. Enter the name *UML2 Tools* in *Name*
7. Click *Archive* and select the .zip file you downloaded.

   1 . Click *OK*, and continue through the installation process

Once that process is complete, the Eclipse UML2 Tools plugin should now be installed and working.

To get DocBox to generate the `.uml` file that UML2Tools needs, we use the `UML`strategy. For example:

```javascript
docBox = new DocBox();
docBox.addStrategy( "UML", { projectFile = expandPath( "./uml/docbox.uml" ) });
docbox.generate( expandPath("/docbox"), "docbox" );
```

This will generate the `.uml` (in this case `docbox.uml`) file which we can then use.

To view and edit the UML diagrams from here:

1. Browse to the .uml file that you generated in the *Navigator* Pane
2. Right click on the .uml file
3. Select *Initialise Class Diagram*
4. Select the root package that you wish to model
5. Click *OK*

You will now be presented with a UML Class diagram of your CFC model.

There are other types of UML2 diagrams that can be created. Have a look at the UML2 Tools documentation for more options.

## Strategy Assumptions

There are some assumptions that are made by this strategy, when converting from CFCs to UML diagrams, as some meta data on CFCS are not provided and/or cannot be specified.

* A property/field is determined for a class when a *get* and *set* function exist with the same name (or *set* and *is* for boolean values) and the argument type of the *set* function matches the return type of the *get*/*is* function.
* The scope for the property/field is selected by highest level of exposure between the *getÂ* and *set* functions. I.e. if *getFoo()* is public, and *setFoo()* is private, then the property *foo* is marked as public.
* All associations are of type *aggregation*, rather than *composition*


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docbox.ortusbooks.com/output-formats/uml-output.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
