Class ProjectTool
- java.lang.Object
-
- java.util.Observable
-
- com.nomagic.magicreport.engine.Tool
-
- com.nomagic.magicdraw.magicreport.tools.ProjectTool
-
- All Implemented Interfaces:
com.nomagic.magicreport.engine.ITool
,com.nomagic.magicreport.IVariable
,java.io.Serializable
,java.lang.Cloneable
@OpenApiAll public class ProjectTool extends com.nomagic.magicreport.engine.Tool
A MagicDraw project wrapper.- Since:
- Dec 7, 2007
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CONTEXT_NAME
Contains a context name.
-
Constructor Summary
Constructors Constructor Description ProjectTool()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.util.Collection<java.lang.String>
getAllElementId()
Return the collection of all element id in the project.java.util.List<Package>
getAllModels()
Returns a list of models in the project (the primary model of the project and all the models of the modules (attached projects)).java.util.Collection<ProjectModule>
getAuxiliaryResource()
Get list of auxiliary resource modules in the project.java.lang.String
getDescription()
Get project description.java.lang.String
getDescription(com.nomagic.ci.persistence.IAttachedProject attachedProject)
Get project description from specified attached project.java.lang.String
getDescription(ProjectModule projectModule)
Get project description from specified project module.java.util.Collection<Diagram>
getDiagrams()
Return all existing diagrams stored in this Project.java.util.Collection<Diagram>
getDiagrams(java.lang.String type)
Return existing diagrams of given type stored in Project.java.lang.String
getDirectory()
Return project directory.BaseElement
getElementByID(java.lang.String id)
Return the Element with given id.java.lang.String
getExtension()
Return project file extension.java.lang.String
getFileName()
Method returns file name of this project.java.lang.String
getLatestVersion(com.nomagic.ci.persistence.IAttachedProject attachedProject)
Get latest version of attached projectjava.lang.String
getLatestVersion(ProjectModule projectModule)
Get latest version of project modulejava.util.Collection<ProjectModule>
getLocalModule()
Get list of used local modules in the project.java.util.Collection<ProjectModule>
getLocalModule(boolean includeAuxiliary)
Get list of used local modules in the project.Model
getModel()
Deprecated.use ProjectTool#getPrimaryModel()java.util.Collection<ProjectModule>
getModuleList()
Get list of used local modules excluding auxiliary resource in the project.java.util.Collection<ProjectModule>
getModuleList(boolean includeAuxiliary)
Get list of used server and local modules in the project.java.lang.String
getName()
Return project name.java.util.Collection<DiagramPresentationElement>
getPresentationDiagrams()
Return all existing presentation diagrams stored in this Project.java.util.Collection<DiagramPresentationElement>
getPresentationDiagrams(java.lang.String type)
Return existing presentation diagrams of given type stored in Project.Package
getPrimaryModel()
Returns the primary (main) model of the project (not including the ones from modules).ProjectVersion
getProjectVersion()
Get current project version of current projectProjectVersion
getProjectVersion(com.nomagic.ci.persistence.IAttachedProject attachedProject)
Return project version of attached Project.ProjectVersion
getProjectVersion(ProjectModule projectModule)
Get a project version of project modulejava.lang.String
getRepresentationString(com.nomagic.ci.persistence.IAttachedProject attachedProject)
Return user friendly representation string about given attached projectjava.lang.String
getRepresentationString(ProjectModule projectModule)
Return user friendly representation string about given project modulejava.lang.String
getRequiredVersion(com.nomagic.ci.persistence.IAttachedProject attachedProject)
Get required version of attached projectjava.lang.String
getRequiredVersion(ProjectModule projectModule)
Get required version of project modulejava.util.Collection<ProjectModule>
getServerModule()
Get list of used server modules in the project exclude auxiliary resource.java.util.Collection<ProjectModule>
getServerModule(boolean includeAuxiliary)
Get list of used server modules in the project.java.util.Collection<ProjectModule>
getSharedModule()
Return a list of shared module from current project.java.util.Collection<ProjectModule>
getSharedModule(com.nomagic.ci.persistence.IAttachedProject attachedProject)
Return a list of shared moduleProjectModule
from specified module.java.util.Collection<ProjectModule>
getSharedModule(ProjectModule projectModule)
Return a list of shared module from specified module.java.lang.String
getTitle()
Return project title.java.lang.String
getUsedVersion(com.nomagic.ci.persistence.IAttachedProject attachedProject)
Get used version of attached projectjava.lang.String
getUsedVersion(ProjectModule projectModule)
Get used version of project modulelong
getVersion()
Return project version number.long
getVersion(com.nomagic.ci.persistence.IAttachedProject attachedProject)
Get current version of attached project.long
getVersion(ProjectModule projectModule)
Get current version of project modulejava.util.List<ProjectVersion>
getVersionList()
Return a list of project version information from opened server project.java.util.List<ProjectVersion>
getVersionList(com.nomagic.ci.persistence.IAttachedProject attachedProject)
Return all project versions of attached project.java.util.List<ProjectVersion>
getVersionList(ProjectModule projectModule)
Return all project versions of project module.java.util.List<ProjectVersion>
getVersions()
Return a list of project version information from opened server project.java.util.List<ProjectVersion>
getVersions(boolean ascendingOrder)
Return a list of project version information from opened server project.
if ascendingOrder is true, the result will be sorted in ascending order.static java.util.List<ProjectVersion>
getVersions(ProjectDescriptor projectDescriptor)
java.util.List<ProjectVersion>
getVersions(java.lang.String sortType)
Return a list of project version information from opened server project.
The result will be sorted by specified sortType.int
getXmiVersion()
Return the projects XMI version.boolean
isDirty()
Return true if this project was modified after last save/load.boolean
isRemote()
Return the remote or not remote state of the project.-
Methods inherited from class com.nomagic.magicreport.engine.Tool
clone, getContext, getProperties, getProperty, getProperty, notifyObservers, setContext, setProperties
-
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, setChanged
-
-
-
-
Field Detail
-
CONTEXT_NAME
public static final java.lang.String CONTEXT_NAME
Contains a context name.- See Also:
- Constant Field Values
-
-
Method Detail
-
getDiagrams
public java.util.Collection<Diagram> getDiagrams()
Return all existing diagrams stored in this Project.- Returns:
- collection of Diagram instance.
-
getDiagrams
public java.util.Collection<Diagram> getDiagrams(java.lang.String type)
Return existing diagrams of given type stored in Project.- Parameters:
type
- the given diagrams type.- Returns:
- collection of Diagram instance.
-
getPresentationDiagrams
public java.util.Collection<DiagramPresentationElement> getPresentationDiagrams()
Return all existing presentation diagrams stored in this Project.- Returns:
- collection of diagram views.
-
getPresentationDiagrams
public java.util.Collection<DiagramPresentationElement> getPresentationDiagrams(java.lang.String type)
Return existing presentation diagrams of given type stored in Project.- Parameters:
type
- the given diagrams type.- Returns:
- collection of diagram views.
-
getName
public java.lang.String getName()
Return project name.- Returns:
- project name.
-
getTitle
public java.lang.String getTitle()
Return project title.- Returns:
- project title
-
getExtension
public java.lang.String getExtension()
Return project file extension.- Returns:
- project file extension.
-
getDirectory
public java.lang.String getDirectory()
Return project directory.- Returns:
- project location directory.
-
getFileName
@CheckForNull public java.lang.String getFileName()
Method returns file name of this project. If file name is undefined returns project name.- Returns:
- file name of this project.
-
isRemote
public boolean isRemote()
Return the remote or not remote state of the project.- Returns:
- true if project is a remote project, false otherwise.
-
isDirty
public boolean isDirty()
Return true if this project was modified after last save/load.- Returns:
- true if this project was modified after last save/load.
-
getElementByID
@CheckForNull public BaseElement getElementByID(java.lang.String id)
Return the Element with given id.- Parameters:
id
- the id of the element.- Returns:
- the Element with given id or null if Element with such id is not registered in the project.
-
getAllElementId
public java.util.Collection<java.lang.String> getAllElementId()
Return the collection of all element id in the project.- Returns:
- the collection of all element id in the project.
-
getXmiVersion
public int getXmiVersion()
Return the projects XMI version.- Returns:
- xmi version
-
getModel
@Deprecated @CheckForNull public Model getModel()
Deprecated.use ProjectTool#getPrimaryModel()Returns the primary (main) model of the project (not including the ones from modules). This method should not be called anymore for Cameo Enterprise Data Warehouse projects, because the returned model does not include the root models of modules (attached projects).getPrimaryModel()
should be used instead as needed.- Returns:
- Model
-
getPrimaryModel
@CheckForNull public Package getPrimaryModel()
Returns the primary (main) model of the project (not including the ones from modules).- Returns:
- Model
-
getAllModels
public java.util.List<Package> getAllModels()
Returns a list of models in the project (the primary model of the project and all the models of the modules (attached projects)).- Returns:
- models.
-
getVersion
public long getVersion()
Return project version number.- Returns:
- project version number
-
getProjectVersion
public ProjectVersion getProjectVersion()
Get current project version of current project- Returns:
- a current
ProjectVersion
of current project
-
getVersions
public java.util.List<ProjectVersion> getVersions()
Return a list of project version information from opened server project. The result will be sorted in descending order.- Returns:
- List of
ProjectVersion
-
getVersions
public java.util.List<ProjectVersion> getVersions(java.lang.String sortType)
Return a list of project version information from opened server project.
The result will be sorted by specified sortType.- Parameters:
sortType
- type of sorting. Specify "asc" sort in ascending order. Default is descending sort.- Returns:
- List of
ProjectVersion
-
getVersions
public java.util.List<ProjectVersion> getVersions(boolean ascendingOrder)
Return a list of project version information from opened server project.
if ascendingOrder is true, the result will be sorted in ascending order.- Parameters:
ascendingOrder
- true to sort in ascending order- Returns:
- List of
ProjectVersion
-
getVersionList
public java.util.List<ProjectVersion> getVersionList()
Return a list of project version information from opened server project.- Returns:
- List of
ProjectVersion
-
getVersions
public static java.util.List<ProjectVersion> getVersions(ProjectDescriptor projectDescriptor)
-
getVersion
public long getVersion(ProjectModule projectModule)
Get current version of project module- Parameters:
projectModule
- aProjectModule
- Returns:
- current version
-
getVersionList
public java.util.List<ProjectVersion> getVersionList(com.nomagic.ci.persistence.IAttachedProject attachedProject)
Return all project versions of attached project.- Parameters:
attachedProject
- anIAttachedProject
- Returns:
- list of
ProjectVersion
of attached project
-
getVersionList
public java.util.List<ProjectVersion> getVersionList(ProjectModule projectModule)
Return all project versions of project module.- Parameters:
projectModule
- aProjectModule
- Returns:
- list of
ProjectVersion
of project module
-
getVersion
public long getVersion(com.nomagic.ci.persistence.IAttachedProject attachedProject)
Get current version of attached project.- Parameters:
attachedProject
- anIAttachedProject
- Returns:
- current version
-
getProjectVersion
public ProjectVersion getProjectVersion(ProjectModule projectModule)
Get a project version of project module- Parameters:
projectModule
- aProjectModule
- Returns:
- a
ProjectVersion
of project module
-
getProjectVersion
public ProjectVersion getProjectVersion(com.nomagic.ci.persistence.IAttachedProject attachedProject)
Return project version of attached Project.- Parameters:
attachedProject
- anIAttachedProject
- Returns:
- a
ProjectVersion
of specified attached project
-
getRepresentationString
public java.lang.String getRepresentationString(ProjectModule projectModule)
Return user friendly representation string about given project module- Parameters:
projectModule
- aProjectModule
- Returns:
- user friendly project representation
-
getRepresentationString
public java.lang.String getRepresentationString(com.nomagic.ci.persistence.IAttachedProject attachedProject)
Return user friendly representation string about given attached project- Parameters:
attachedProject
- anIAttachedProject
- Returns:
- user friendly project representation
-
getUsedVersion
public java.lang.String getUsedVersion(ProjectModule projectModule)
Get used version of project module- Parameters:
projectModule
- aProjectModule
- Returns:
- used version
-
getUsedVersion
public java.lang.String getUsedVersion(com.nomagic.ci.persistence.IAttachedProject attachedProject)
Get used version of attached project- Parameters:
attachedProject
- anIAttachedProject
- Returns:
- used version
-
getRequiredVersion
public java.lang.String getRequiredVersion(ProjectModule projectModule)
Get required version of project module- Parameters:
projectModule
- aProjectModule
- Returns:
- required version
-
getRequiredVersion
public java.lang.String getRequiredVersion(com.nomagic.ci.persistence.IAttachedProject attachedProject)
Get required version of attached project- Parameters:
attachedProject
- anIAttachedProject
- Returns:
- required version
-
getLatestVersion
public java.lang.String getLatestVersion(ProjectModule projectModule)
Get latest version of project module- Parameters:
projectModule
- aProjectModule
- Returns:
- required version
-
getLatestVersion
public java.lang.String getLatestVersion(com.nomagic.ci.persistence.IAttachedProject attachedProject)
Get latest version of attached project- Parameters:
attachedProject
- anIAttachedProject
- Returns:
- required version
-
getDescription
public java.lang.String getDescription()
Get project description.- Returns:
- project description
-
getDescription
public java.lang.String getDescription(com.nomagic.ci.persistence.IAttachedProject attachedProject)
Get project description from specified attached project.- Parameters:
attachedProject
- anIAttachedProject
- Returns:
- project description
-
getDescription
public java.lang.String getDescription(ProjectModule projectModule)
Get project description from specified project module.- Parameters:
projectModule
- projectModuleProjectModule
- Returns:
- project description
-
getSharedModule
public java.util.Collection<ProjectModule> getSharedModule()
Return a list of shared module from current project.- Returns:
- a list of
ProjectModule
-
getSharedModule
public java.util.Collection<ProjectModule> getSharedModule(ProjectModule projectModule)
Return a list of shared module from specified module.- Parameters:
projectModule
- aProjectModule
- Returns:
- a list of
ProjectModule
-
getSharedModule
public java.util.Collection<ProjectModule> getSharedModule(com.nomagic.ci.persistence.IAttachedProject attachedProject)
Return a list of shared moduleProjectModule
from specified module.- Parameters:
attachedProject
- anIAttachedProject
- Returns:
- a list of
ProjectModule
-
getModuleList
public java.util.Collection<ProjectModule> getModuleList()
Get list of used local modules excluding auxiliary resource in the project.- Returns:
- list of used server and local
ProjectModule
-
getModuleList
public java.util.Collection<ProjectModule> getModuleList(boolean includeAuxiliary)
Get list of used server and local modules in the project.- Parameters:
includeAuxiliary
- if true, the auxiliary resources will be included.
Default value is False.- Returns:
- list of used server and local
ProjectModule
-
getServerModule
public java.util.Collection<ProjectModule> getServerModule()
Get list of used server modules in the project exclude auxiliary resource.- Returns:
- list of used server modules
ProjectModule
-
getServerModule
public java.util.Collection<ProjectModule> getServerModule(boolean includeAuxiliary)
Get list of used server modules in the project.- Parameters:
includeAuxiliary
- if true, the auxiliary resources will be included.
Default value is False.- Returns:
- list of used server
ProjectModule
-
getLocalModule
public java.util.Collection<ProjectModule> getLocalModule()
Get list of used local modules in the project.- Returns:
- list of used local
ProjectModule
-
getLocalModule
public java.util.Collection<ProjectModule> getLocalModule(boolean includeAuxiliary)
Get list of used local modules in the project.- Parameters:
includeAuxiliary
- if true, the auxiliary resources will be included.
Default value is False.- Returns:
- list of used local
ProjectModule
-
getAuxiliaryResource
public java.util.Collection<ProjectModule> getAuxiliaryResource()
Get list of auxiliary resource modules in the project.- Returns:
- list of
ProjectModule
that are auxiliary resources.
-
-