Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Content layer
id1776059845

$project.getModuleList(includeAuxiliary)

Returns a list of used server and local modules as well as auxiliary resources from a current
modules from a server project.
Content column
id1776059851
Content block
id1776059842

On this page

Table of Contents

This function is only for local projects

.

Content block
id1776059849

$project is a project reference enabling a template to return the project information.

$project.getName()

Returns a project name.


NameTypeDescription
Parameter(s)---
Return-java.lang.StringA project name.

$project.getTitle()

Gets a project title.



NameTypeDescription
Parameter(s)---
Return-java.lang.StringA project title.

$project.getFileName()

Gets a project filename.


NameTypeDescription
Parameter(s)---
Return-java.lang.StringA project filename.

$project.getExtension()

Gets a project filename extension.

Note
titleNote

This function is only for local projects.


NameTypeDescription
Parameter(s)---
Return-java.lang.StringA project filename extension.

$project.getDirectory()

Get a project directory name

.
Note
titleNote

NameTypeDescription
Parameter(s)---
Return-java.lang.StringA project directory name.

$project.getVersionList()

Returns a list of version information from an open Server project.


NameTypeDescription
Return-java.util.List<ProjectVersion>A list of com.nomagic.magicdraw.magicreport.tools.ProjectsVersion.
Info
titleInfo
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
languagetext
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

NameTypeDescription
Return-intThe value of a file type.

$project.getDiagrams()

Returns all existing diagrams stored in a particular project, including diagrams in auxiliary resources.


NameTypeDescription
Return-java.util.CollectionA collection of diagram instances.
Note
titleNote

$project.getDiagrams() returns all the diagrams in the selected scope, including diagrams in auxiliary resources.

$project.getDiagrams(type)

Returns existing diagrams of a given type stored in a particular project.


NameTypeDescription
Parameter(s)typejava.lang.StringA diagram type.
Return-java.util.CollectionA collection of diagram instances.



Code Block
languagetext
titleSample 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.


NameTypeDescription
Return

-

java.util.CollectionA collection of diagram views.


$project.getPresentationDiagrams(type)

Returns all existing presentation diagrams of a given type stored in a particular project.


NameTypeDescription
Parameter(s)typejava.lang.StringA diagram type.
Return-java.util.CollectionA collection of diagram views.
Code Block
languagetext
titleSample 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.


NameTypeDescription
Return-java.lang.BooleanReturn 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.


NameTypeDescription
Return

-

java.lang.BooleanReturn true if a
project was modified
after it had been
saved/loaded,
otherwise false.

$project.getElementByID(id)

Returns an element with a given ID.

 NameTypeDescription
Parameter(s)IDjava.lang.StringAn element ID.
Return-com.nomagic.magicdraw.uml.BaseElementAn element with a given ID or null
if the element with such ID is not
registered in the project.
Code Block
languagetext
titleSample code
#set($ele = $project.getElementByID("_9_0_62a020a_1105704887361_983947_8206"))
$ele.name
$ele
#ele.humanType


  • “_9_0_62a020a_1105704887361_983947_8206” is the element’s ID number.

$project.getAllElementId()

Returns a collection of all element IDs in a project.


NameTypeDescription
Return-java.util.CollectionA collection of all element IDs in a project.

$project.getXmiVersion()

Returns the XMI version of a project.


NameTypeDescription
Return-intAn XMI version.

$project.getVersion()

Return a project version number.


NameTypeDescription
Return-longA project version number.

$project.getModel()

Returns a model (the root container of all model structures).


NameTypeDescription
Return-com.nomagic.uml2.ext.magicdraw.auxiliaryconstructs.mdmodels.ModelA model.
Warning

$project.getModel() is deprecated since MagicDraw 18.2, please use $project.getPrimaryModel() instead

$project.getPrimaryModel()

Returns the primary (main) model of the project (not including the ones from modules (attached projects)).


NameTypeDescription
Return-com.nomagic.uml2.ext.magicdraw.classes.mdkernel.PackageThe primary model
of the project.


$project.getAllModels()

Returns a list of models in the project (the primary model of the project and all the models of the modules(attached projects)).


NameTypeDescription
Return-Java.util.ListA list of
models.

-------


$project.getModuleList(auxiliary)

Returns a list of used server and local
from a current project.
NameTypeDescription
Return-java.util.CollectionA collection of com.nomagic.magicdraw.magicreport.tools.ProjectModule

NameTypeDescription
Parameter(s)
includeAuxiliary

auxiliary

booleanReturns
module including
auxiliary resources
when
only if this value is True.
Default is
false
False.
Return-java.util.CollectionA
collection
list of com.nomagic.magicdraw.
magicreport.tools.ProjectModule

$project.getSharedModule()

Returns a list of shared modules from a current project.

NameTypeDescription
Return-java.util.CollectionA collection of com.nomagic.magicdraw.magicreport.tools.ProjectModule
core.modules.ModuleDescriptor


$project.getSharedModule(

projectModule

module)

Returns a list of shared modules from a specified

project

module.

 NameTypeDescription
Parameter(s)
projectModule
modulecom.nomagic.magicdraw.
magicreport
core.
tools
modules.
ProjectModule
ModuleDescriptorA
project
module.
Return-java.util.CollectionA
collection
list of com.nomagic.magicdraw.
magicreport.tools.ProjectModule

$project.getServerModule()

This function returns the list of used server modules.

NameTypeDescriptionReturn-java.util.CollectionA collection of com.nomagic.magicdraw.magicreport.tools.ProjectModule
core.modules.ModuleDescriptor.


$project.getServerModule(

includeAuxiliary

auxiliary)

This function returns the list of used server modules as well as auxiliary resources.


NameTypeDescription
Parameter(s)
includeAuxiliary
auxiliarybooleanReturns
server modules including
auxiliary resources when this value is True.
Default is false.
Return-java.util.CollectionA
collection
list of com.nomagic.magicdraw.
magicreport.tools.ProjectModule

$project.getLocalModule()

This function returns the list of used local modules.

NameTypeDescriptionReturn-java.util.CollectionA collection of com.nomagic.magicdraw.magicreport.tools.ProjectModule
core.modules.ModuleDescriptor.


$project.getLocalModule(

includeAuxiliary

auxiliary)

This function returns

the

a list of used local modules as well as auxiliary resources.


NameTypeDescription
Parameter(s)
includeAuxiliary
auxiliarybooleanReturns
local modules including
auxiliary resources when this value is True.
Default is false.
Return
Type-java.util.CollectionA
collection
list of com.nomagic.magicdraw.
magicreport
core.modules.
tools
ModuleDescriptor.
ProjectModule


$project.getAuxiliaryResource()

This function returns a list of auxiliary resources.


NameTypeDescription
Return
Type-java.util.CollectionA
collection
list of com.nomagic.magicdraw.
magicreport
core.
tools.ProjectModule

ProjectVersion

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, and number, etc.
ProjectVersion contains following properties:

PropertyReturn TypeDescriptioncommentjava.lang.StringReturn a version committed commentdatejava.util.DateReturn a committed datedateAsStringjava.lang.StringReturn a committed date as textnumberlongReturn a committed versionnumberAsStringjava.lang.StringReturn a committed version as textuserjava.lang.StringReturn a committer’s nameversionjava.lang.ObjectReturn 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.tagsjava.util.List<java.lang.String>Return all tags

Sample code

Code Block
modules.ModuleDescriptor.
Code Block
languagetext
titleSample code
Current version : $project.version All version:
#foreach (
$version
$module in $project.
getVersionList
getModuleList())
Date :
name			
$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

ProjectModule

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 project that is used as a component in current project.
Example properties and methods of ProjectModule:

Property / MethodReturn TypeDescriptionrepresentationStringjava.lang.StringReturn user friendly representation string about the moduledescriptionjava.lang.StringReturn project description of the module.versionlongReturn version number of the module.requiredVersionjava.lang.StringReturn required version of the module. This property works for Teamwork Server project. It will return -1 when module is latest version and required version is not set.remoteIDjava.lang.StringReturn remote id for the moduleURIjava.net.URIConvert EMF uri to java.net.URIversionListjava.util.List<com.nomagic.magicdraw.magicreport.tools.ProjectVersionReturn list of version descriptors of the moduleisRemote()booleanCheck if the module is remote - from Teamwork server or TW Cloud.

Sample code

Code Block
languagetext
titleSample 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:
$module.representationString
description			: $module.description
version				: $module.version
required version	: $module.requiredVersion
shared module		: 
#foreach ($child in $project.getSharedModule($module)) 
- 
$child.representationString
#end
#end
  • $module is the module from Teamwork Server.