$project is a project reference enabling a template to return the project information.
$project.getName()
Returns a project name.
Name
Type
Description
Parameter(s)
-
-
-
Return
-
java.lang.String
A project name.
$project.getTitle()
Gets a project title.
Name
Type
Description
Parameter(s)
-
-
-
Return
-
java.lang.String
A project title.
$project.getFileName()
Gets a project filename.
Name
Type
Description
Parameter(s)
-
-
-
Return
-
java.lang.String
A project filename.
$project.getExtension()
Gets a project filename extension.
Note
title
Note
This function is only for local projects.
Name
Type
Description
Parameter(s)
-
-
-
Return
-
java.lang.String
A project filename extension.
$project.getDirectory()
Get a project directory name.
Note
title
Note
This function is only for local projects.
Name
Type
Description
Parameter(s)
-
-
-
Return
-
java.lang.String
A project directory name.
$project.getVersionList()
Returns a list of version information from an open Server project.
Name
Type
Description
Return
-
java.util.List<ProjectVersion>
A list of com.nomagic.magicdraw.magicreport.tools.ProjectsVersion.
Info
title
Info
Version information consists of the following attributes:
comment: a version committed comment
date: a committed date
dateAsString: a committed date as text
number: a committed version
numberAsString: a committed version as text
user: a committer’s name
version: a version object that can be com.nomagic.teamwork.common.projects.Version for Teamwork project or com.nomagic.magicdraw.esi.project.project.IEsiVersionDescriptor for Teamwork Cloud project.
Following is the sample code.
Code Block
language
text
Current version : $project.version
All version:
----------------
#foreach ($version in $project.versionList)
Date : $version.date
Number : $version.number
Number as String : $version.numberAsString
User : $version.user
Comment : $version.comment
----------------
#end
$project.getType()
Returns a file type. A file type is one of the following values:
0 – UNDEF
2 – XML_NATIVE
3 – UNSIYS_XMI
Name
Type
Description
Return
-
int
The value of a file type.
$project.getDiagrams()
Returns all existing diagrams stored in a particular project.
Name
Type
Description
Return
-
java.util.Collection
A collection of diagram instances.
$project.getDiagrams(type)
Returns existing diagrams of a given type stored in a particular project.
Name
Type
Description
Parameter(s)
type
java.lang.String
A diagram type.
Return
-
java.util.Collection
A collection of diagram instances.
Code Block
language
text
title
Sample code
#set($classDiagram = $project.getDiagrams("Class Diagram"))
#foreach($cl in $classDiagram)
$cl.name
#end
“Class Diagram” is a diagram type
.
$project.getPresentationDiagrams()
Returns all existing presentation diagrams stored in a particular project.
Name
Type
Description
Return
-
java.util.Collection
A collection of diagram views.
$project.getPresentationDiagrams(type)
Returns all existing presentation diagrams of a given type stored in a particular project.
Name
Type
Description
Parameter(s)
type
java.lang.String
A diagram type.
Return
-
java.util.Collection
A collection of diagram views.
Code Block
language
text
title
Sample code
#set($classDiagram = $project.getPresentationDiagrams("Class Diagram"))
#foreach($cl in $classDiagram)
$cl.name
#end
“Class Diagram” is a diagram type.
$project.isRemote()
Returns the remote or non-remote state of a project.
Name
Type
Description
Return
-
java.lang.Boolean
Return true if a project is a remote project, otherwise false.
$project.isDirty()
Returns true if that particular project was modified after it had been saved or loaded.
Name
Type
Description
Return
-
java.lang.Boolean
Return true if a project was modified after it had been saved/loaded, otherwise false.
$project.getElementByID(id)
Returns an element with a given ID.
Name
Type
Description
Parameter(s)
ID
java.lang.String
An element ID.
Return
-
com.nomagic.magicdraw.uml.BaseElement
An element with a given ID or null if the element with such ID is not registered in the project.
Returns a list of models in the project (the primary model of the project and all the models of the modules(attached projects)).
Name
Type
Description
Return
-
Java.util.List
A list of models.
$project.getModuleList(auxiliary)
Returns a list of used server and local modules from a
current project.
Name
Type
Description
Return
-
java.util.Collection
A collection of com.nomagic.magicdraw.magicreport.tools.ProjectModule.
$project.getModuleList(includeAuxiliary)
Returns a list of used
server
and local modules as well as auxiliary resources from a current
project.
Name
Type
Description
Parameter(s)
includeAuxiliary
auxiliary
boolean
Returns
modules including
auxiliary resources only if this value is
true (false by default).
Return
-
java.util.Collection
A collection of com.nomagic.magicdraw.magicreport.tools.ProjectModule.
$project.getSharedModule()
Returns a list of shared modules from a current project.
Name
Type
Description
True. Default is False.
Return
-
java.util.Collection
A
collection
list of com.nomagic.magicdraw.
magicreport
core.
tools
modules.
ProjectModule.
ModuleDescriptor
$project.getSharedModule(
projectModule
module)
Returns a list of shared modules from a specified
project
module.
Name
Type
Description
Parameter(s)
projectModule
module
com.nomagic.magicdraw.
magicreport
core.
tools
modules.
ProjectModule
ModuleDescriptor
A
project
module.
Return
-
java.util.Collection
A
collection
list of com.nomagic.magicdraw.
magicreport.tools.ProjectModule.
$project.getServerModule()
Returns a list of used server modules.
Name
Type
Description
Return
-
java.util.Collection
A collection of com.nomagic.magicdraw.magicreport.tools.ProjectModule.
core.modules.ModuleDescriptor.
$project.getServerModule(
includeAuxiliary
auxiliary)
Returns a
This function returns the list of used server modules as well as auxiliary resources.
Name
Type
Description
Parameter(s)
includeAuxiliary
auxiliary
boolean
Returns
server modules including
auxiliary resources
if
when this value is True. Default is
true (
false
by default)
.
Return
-
java.util.Collection
A
collection
list of com.nomagic.magicdraw.
magicreport.tools.ProjectModule.
$project.getLocalModule()
Returns a list of used local modules.
Name
Type
Description
Return
-
java.util.Collection
A collection of com.nomagic.magicdraw.magicreport.tools.ProjectModule.
core.modules.ModuleDescriptor.
$project.getLocalModule(
includeAuxiliary
auxiliary)
Returns
This function returns a list of used local modules as well as auxiliary resources.
Name
Type
Description
Parameter(s)
includeAuxiliary
auxiliary
boolean
Returns
local modules including
auxiliary resources
if
when this value is True. Default is
true (
false
by default)
.
Return
Type
-
java.util.Collection
A
collection
list of com.nomagic.magicdraw.
magicreport
core.
tools
modules.
ProjectModule
ModuleDescriptor.
$project.getAuxiliaryResource()
Returns
This function returns a list of auxiliary resources.
Name
Type
Description
Return
Type
-
java.util.Collection
A
collection
list of com.nomagic.magicdraw.
magicreport
core.
tools.ProjectModule.
Project Version
The full class name is com.nomagic.magicdraw.magicreport.tools.ProjectVersion. ProjectVersion is a class that represents some version of the project or module. It contains date, user, number, etc.
ProjectVersion contains the following properties:
Property
Return type
Description
comment
java.lang.String
Returns a version committed comment.
date
java.util.Date
Returns a committed date.
dateAsString
java.lang.String
Returns a committed date as text.
number
long
Returns a committed version.
numberAsString
java.lang.String
Returns a committed version as text.
user
java.lang.String
Returns a committer’s name.
version
java.lang.Object
Returns a version object that can be com.nomagic.teamwork.common.projects.Version for a Teamwork project or com.nomagic.magicdraw.esi.project.project.IEsiVersionDescriptor for a Teamwork Cloud project.
tags
java.util.List<java.lang.String>
Returns all tags.
modules.ModuleDescriptor.
Code Block
language
text
title
Sample code
Current version : $project.version
All version:
#foreach (
$version
$module in $project.
getVersionList
getModuleList())
Date : $version.date
Number : $version.number
Number As String : $version.numberAsString
User : $version.user
Comment : $version.comment
Tags:
#foreach($tag in $version.tags)
- tag
#end
---
#end
Project Module
The full class name is com.nomagic.magicdraw.magicreport.tools.ProjectModule. ProjectModule is a wrapper Class of an attached project (com.nomagic.ci.persistence.IAttachedProject) that represents a special kind of the project that is used as a component in the current project.
The following are some properties and methods of ProjectModule:
Property / Method
Return type
Description
representationString
java.lang.String
Returns user-friendly representation string about the module.
description
java.lang.String
Returns project description of the module.
version
long
Returns a version number of the module.
requiredVersion
java.lang.String
Returns a required version of the module. This property works for Teamwork Server projects. It will return -1 when the module is the latest version, and the required version is not set.
Returns a list of version descriptors of the module.
isRemote()
boolean
Checks if the module is remote - from Teamwork server or Teamwork Cloud.
Code Block
language
text
title
Sample code
#foreach($module in $project.getModuleList())
Name : $module.representationString
Description : $module.description
Version : $module.version
RemoteID : $module.remoteID
URI : $module.URI
#if($module.isRemote())
#set($version = $module.projectVersion)
Current module version :
date : $version.date
number : $version.number
numberAsString : $version.numberAsString
user : $version.user
comment : $version.comment
tags:
#foreach($tag in $version.tags)
- $tag
#end
All module versions :
#foreach($version in $module.versionList)
date : $version.date
number : $version.number
numberAsString : $version.numberAsString
user : $version.usercomment : $version.comment
tags:
#foreach($tag in $version.tags)
- $tag
#end
----------
#end
#end
Shared module:
#foreach
name : $module.representationSpring
description : $module.description
version : $module.version
required version : $module.requiredVersion
shared module :
#foreach ($child in $project.getSharedModule($module))