MagicDraw 19.0 LTR SP4 Documentation

On this page


$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

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

This function is only for local projects.


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

$project.getVersionList()

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


NameTypeDescription
Parameter(s)---
Return-java.util.ListA list of com.nomagic.magicdraw.magicreport.tools.ProjectVersion.

$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

$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.
Sample code

  • “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.
Sample code


  • “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.
Sample code


  • “_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.

$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()

Returns a list of used server and local modules from a current project.


NameTypeDescription
Return-java.util.CollectionA collection of ProjectModule.

$project.getModuleList(includeAuxiliary)

Returns a list of used server and local modules as well as auxiliary resources from a current project.


NameTypeDescription
Parameter(s)includeAuxiliarybooleanReturns modules including auxiliary resources if this value is true (false by default).
Return-java.util.CollectionA collection of ProjectModule.

$project.getSharedModule()

Returns a list of shared modules from a current project.


NameTypeDescription
Return-java.util.CollectionA collection of ProjectModule.

$project.getSharedModule(projectModule)

Returns a list of shared modules from a specified project module.


NameTypeDescription
Parameter(s)projectModuleProjectModuleA project module.
Return-java.util.CollectionA collection of ProjectModule.

$project.getServerModule()

Returns a list of used server modules.


NameTypeDescription
Return-java.util.CollectionA collection of ProjectModule.

$project.getServerModule(includeAuxiliary)

Returns a list of used server modules as well as auxiliary resources.


NameTypeDescription
Parameter(s)includeAuxiliarybooleanReturns server modules including auxiliary resources if this value is true (false by default).
Return-java.util.CollectionA collection of ProjectModule.

$project.getLocalModule()

Returns a list of used local modules.


NameTypeDescription
Return-java.util.CollectionA collection of ProjectModule.

$project.getLocalModule(includeAuxiliary)

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


NameTypeDescription
Parameter(s)includeAuxiliarybooleanReturns local modules including auxiliary resources if this value is true (false by default).
Return-java.util.CollectionA collection of ProjectModule.

$project.getAuxiliaryResource()

Returns a list of auxiliary resources.


NameTypeDescription
Return-java.util.CollectionA collection of 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:

PropertyReturn typeDescription
commentjava.lang.StringReturns a version committed comment.
datejava.util.DateReturns a committed date.
dateAsStringjava.lang.StringReturns a committed date as text.
numberlongReturns a committed version.
numberAsStringjava.lang.StringReturns a committed version as text.
userjava.lang.StringReturns a committer’s name.
versionjava.lang.ObjectReturns 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.
tagsjava.util.List<java.lang.String>Returns all tags.
Sample code

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 / MethodReturn typeDescription
representationStringjava.lang.StringReturns user-friendly representation string about the module.
descriptionjava.lang.StringReturns project description of the module.
versionlongReturns a version number of the module.
requiredVersionjava.lang.StringReturns 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.
remoteIDjava.lang.StringReturns a remote ID for the module.
URIjava.net.URIConverts EMF URI to java.net.URI.
versionListjava.util.List<ProjectVersion>Returns a list of version descriptors of the module.
isRemote()booleanChecks if the module is remote - from Teamwork server or Teamwork Cloud.
Sample code


  • No labels