Generating by Templates

StarUML

Generating by Templates

Top  Previous  Next

Generating Artifacts

To generate artifacts by template, it must be applicable to current working UML model.

1.Select [Tools]->[StarUML Generator...] Menu

 

ch08.h58

2.In the [Select templates for generation] Page, Check templates to generate in the ListBox and Click [Next] Button.

 

ch08.h59

3.To bind values with parameters, Click ch08.h60 Button of each template item in the ListBox, and set values of parameter as you want. (Refer to Registering Template for more information about template parameters)

 

ch08.h61

4.In the [Select target path] Page, Select a folder that generated artifacts will be placed and click [Next] button.

 

ch08.h62

 

If you want to create a new folder, click [New Folder...] button and input name of the new folder.

 

ch08.h63

5.In the [Generating...] Page, click [Generate] button. You can check the progress of generation and it will be logged on Logs. If you want to cancel the generation process, click [Cancel] button. When all artifacts are successfully generated, [Finish] will be enabled and clicking it will finish the artifact generation. To see generated artifacts, double-click the item that want to see in the [Generation List] then the generated artifact will be opened.

 

ch08.h64

Registering a Template

Your own templates can be registered in StarUML Generator.

1.In the [Select templates for generation] Page, click [Register Template] button.

 

ch08.h65

2.In the [Register Template] Dialog, click ch08.h66 button and select a folder that the template files will be placed.

 

ch08.h67

3.Input template information on [Properties:] and click [OK] button to complete registering a template.

[Basic] property section

Basic properties for template registration.

 

Property

Description

Template Name

Name for the template to register.

Group

Group name for the template. There is no restriction to name a group but to group a set of template, give the same group name for the set of templates. (it is used for horizontal classification like as RUP, CBD, <ModuleName>, <CompanyName>, ...)

Category

Category name for the template. There is no restriction to name a category but to categorize a set of template, give the same category name for the set of templates. (it is used for vertical classification like as Requirements, Design, Code, Analysis, ...)

Description

Brief description of the template.

[Detail] property section

Detailed properties for template registration.

Property

Description

Document Type

Type of the template. Select DOCUMENT or CODE.

Format

Type of generated artifact. Input the format name or select one of the already defined formats (TXT, DOC, PPT, XLS)

Version

Version of the template

(e.g) 1.0

Related Profile

Profiles related to the template.

Related Approach

Approach related to the template. (it is a declarative property, so it will not effect anything)

Translator Type

Kind of translator for the template. Select one of the following: WORD, EXCEL, POWERPOINT, TEXT, COM(user-defined COM-based generator), SCRIPT(user-defined scripts like as JScript, VBScript, ...), EXE(user-defined .EXE-based generator).

Translator

Specify filename of user-defined translator. It is used only for user want to use his/her own translator not built-in translators(WORD, EXCEL, POWERPOINT, TEXT)

Example

If any, specify an example model for the template.

Parameters

Parameters required for the template.

Related files

If any, specify all related files to the template.

[Parameters] property

1.Click ch08.h68 button in Parameters property.

 

ch08.h69

2.In the [Parameters] Dialog, click ch08.h70 button to create a new parameter and click ch08.h71 button to delete a existing parameter.

 

ch08.h72

3.In the [New Parameter] Dialog, specify Name, Type and Default Value for the parameter and click [OK] button.

 

ch08.h73

Default parameters are different according to the Translator Type. Following are the default parameters for each Translator Types.

Property

Type

Translator Type

Description

TemplateFile

FILENAME or STRING

WORD,EXCEL,

POWERPOINT

Specify file name of the template document.

OutputFile

FILENAME or STRING

WORD,EXCEL,

POWERPOINT,

TEXT

Specify file name of the generated artifact.

Keep Comment

BOOLEAN

WORD,EXCEL,

POWERPOINT

Specify whether to remain the comment used for generation or to delete it.

ShowGenerationProcess

BOOLEAN

WORD,EXCEL,

POWERPOINT

Specify whether to show the progress of generation or not. It may affect the performance of the generation.

Normal Generation

BOOLEAN

WORD

If true, the template is applied to top-level package (Project). if false, the template is applied to the package (or element) that is currently selected in StarUML.

Generate Index

BOOLEAN

WORD

Specify whether to generate Index or not.

intermediate

STRING

TEXT

Specify file name of intermediate file used for generation.

target

STRING

TEXT

If more than two artifacts are generated, specify the pathname the artifacts are placed.

Note:

To specify file name in the parameters, environment variables is required of StarUML Generator. The variable is as follow.

Variable

Description

$PATH$

The path that the template files are placed.

(e.g.) $PATH$\BusinessActorReport.doc

$GROUP$

Group name of the template.

$CATEGORY$

Category name of the template.

$NAME$

Name of the template.

$TARGET$

Output path that the user selected.

Cloning a Template

You can start to define a template by cloning an existing template without defining from the scratch.

1.In the [Select templates for generation] Dialog, select a template to clone and click [Clone Template] button, or click mouse right button on the template to clone and then click [Clone Template] menu on the popup menu.

 

ch08.h74

2.Specify the name of cloned template and click [OK] button.

 

ch08.h75

3.You can find the cloned template in the [List of templates]. You can edit more information of the cloned template (click [Template Properties] button).

Template Properties

You can edit properties of a registered template.

1.In the [Select templates for generation] Dialog, select a template want to edit properties and click [Template properties] button, or click mouse right button on the template to edit properties and then click [Show Template Properties] menu on the popup menu.

 

ch08.h76

2.Edit properties in the[Modify Template] Dialog and click [OK] button. (Please refer to Registering Template > Basic/Detail Parameters for detailed information of each property)

 

ch08.h77

Opening a Template

You can open and edit a registered template.

1.In the [Select templates for generation] Dialog, select a template to open and click [Open Template] button, or click mouse right button on the template to open and then click [Open Template] menu on the popup menu.

 

ch08.h78

2.And then, the default application associated with each file extension (.cot, .doc, .xls, .ppt) will be executed and you can edit in the application. (Please refer to StarUML 5.0 Developer Guides > Chapter 11. Writing Template for how to write template)

Deleing a Template

·In the [Select templates for generation] Dialog, select a template to delete and click mouse right button and click [Delete Template] menu in the popup menu.

 

ch08.h79

·Deleting a template causes deletion of the template folder and all files in the folder, so you must take care about deleting template.