Class 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 Detail

      • CONTEXT_NAME

        public static final java.lang.String CONTEXT_NAME
        Contains a context name.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ProjectTool

        public ProjectTool()
    • 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
      • getVersion

        public long getVersion​(ProjectModule projectModule)
        Get current version of project module
        Parameters:
        projectModule - a ProjectModule
        Returns:
        current version
      • getVersion

        public long getVersion​(IAttachedProject attachedProject)
        Get current version of attached project.
        Parameters:
        attachedProject - an IAttachedProject
        Returns:
        current version
      • getRepresentationString

        public java.lang.String getRepresentationString​(ProjectModule projectModule)
        Return user friendly representation string about given project module
        Parameters:
        projectModule - a ProjectModule
        Returns:
        user friendly project representation
      • getRepresentationString

        public java.lang.String getRepresentationString​(IAttachedProject attachedProject)
        Return user friendly representation string about given attached project
        Parameters:
        attachedProject - an IAttachedProject
        Returns:
        user friendly project representation
      • getUsedVersion

        public java.lang.String getUsedVersion​(ProjectModule projectModule)
        Get used version of project module
        Parameters:
        projectModule - a ProjectModule
        Returns:
        used version
      • getUsedVersion

        public java.lang.String getUsedVersion​(IAttachedProject attachedProject)
        Get used version of attached project
        Parameters:
        attachedProject - an IAttachedProject
        Returns:
        used version
      • getRequiredVersion

        public java.lang.String getRequiredVersion​(ProjectModule projectModule)
        Get required version of project module
        Parameters:
        projectModule - a ProjectModule
        Returns:
        required version
      • getRequiredVersion

        public java.lang.String getRequiredVersion​(IAttachedProject attachedProject)
        Get required version of attached project
        Parameters:
        attachedProject - an IAttachedProject
        Returns:
        required version
      • getLatestVersion

        public java.lang.String getLatestVersion​(ProjectModule projectModule)
        Get latest version of project module
        Parameters:
        projectModule - a ProjectModule
        Returns:
        required version
      • getLatestVersion

        public java.lang.String getLatestVersion​(IAttachedProject attachedProject)
        Get latest version of attached project
        Parameters:
        attachedProject - an IAttachedProject
        Returns:
        required version
      • getDescription

        public java.lang.String getDescription()
        Get project description.
        Returns:
        project description
      • getDescription

        public java.lang.String getDescription​(IAttachedProject attachedProject)
        Get project description from specified attached project.
        Parameters:
        attachedProject - an IAttachedProject
        Returns:
        project description
      • getDescription

        public java.lang.String getDescription​(ProjectModule projectModule)
        Get project description from specified project module.
        Parameters:
        projectModule - projectModule ProjectModule
        Returns:
        project description
      • getSharedModule

        public java.util.Collection<ProjectModule> getSharedModule()
        Return a list of shared module from current project.
        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.