Class ProjectUtilities

java.lang.Object
com.nomagic.magicdraw.core.ProjectUtilities

@OpenApiAll public class ProjectUtilities extends Object
Project decomposition related utility class.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Property for XmiExporterDescription
    protected static Map<com.nomagic.ci.persistence.IProject,XmiExporterDescription>
     
    protected static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected static void
    addToCache(com.nomagic.ci.persistence.IProject project, XmiExporterDescription xmiExporterDescription)
     
    protected static void
    addToCacheLoaded(com.nomagic.ci.persistence.IProject project, XmiExporterDescription xmiExporterDescription)
    Adds to cache just loaded modules/projects
    static int
    compareVersionNumber(String versionNumber1, String versionNumber2)
    Compare given version numbers.
    static int
    compareVersions(com.nomagic.ci.persistence.versioning.IVersionDescriptor versionDescriptor1, com.nomagic.ci.persistence.versioning.IVersionDescriptor versionDescriptor2)
    Compare given versions descriptors.
    static com.nomagic.ci.persistence.decomposition.ProjectAttachmentConfiguration
    createDefaultProjectAttachmentConfiguration(org.eclipse.emf.common.util.URI uri)
    Create default project attachment configuration with default settings.
    static String
    Decodes Teamwork remote ID
    static String
    Encodes Teamwork remote ID
    static com.nomagic.ci.persistence.IAttachedProject
    findAttachedProjectByID(com.nomagic.ci.persistence.IProject project, String moduleID, boolean recursively)
    Find attached project by given id in a given project
    static com.nomagic.ci.persistence.IAttachedProject
    Find attached project by given id in a given project.
    static com.nomagic.ci.persistence.IAttachedProject
    findAttachedProjectByID(Project project, String moduleID, boolean recursively)
    Find attached project by given id in a given project
    static com.nomagic.ci.persistence.IAttachedProject
    findAttachedProjectByName(com.nomagic.ci.persistence.IProject project, String name)
    Find attached project by given name in a given project
    static com.nomagic.ci.persistence.IAttachedProject
    Find attached project by given name in a given project.
    static com.nomagic.ci.persistence.IAttachedProject
    findAttachedProjectByName(Project project, String name, boolean recursively)
    Find attached project by given name in a given project
    static com.nomagic.ci.persistence.IAttachedProject
    findAttachedProjectByNames(Collection<String> names, Collection<com.nomagic.ci.persistence.IAttachedProject> modules)
     
    static com.nomagic.ci.persistence.IAttachedProject
    findAttachedProjectByProjectID(com.nomagic.ci.persistence.IProject project, String projectID, boolean recursively)
    Find attached project by given project id
    static com.nomagic.ci.persistence.IProject
    findProjectByResourceID(com.nomagic.ci.persistence.IPrimaryProject primaryProject, String resourceId)
    Search for project with given resource ID
    static Collection<com.nomagic.ci.persistence.IAttachedProject>
    getAllAttachedProjects(com.nomagic.ci.persistence.IProject project)
    Returns projects those are attached directly or indirectly to a given project.
    static Collection<com.nomagic.ci.persistence.IAttachedProject>
    Return all modules in a given project
    static Collection<com.nomagic.ci.persistence.IAttachedProject>
    getAllAttachedProjects(Collection<com.nomagic.ci.persistence.IAttachedProject> projects)
    Returns projects those are attached directly or indirectly to a given project.
    static Collection<com.nomagic.ci.persistence.IProject>
    getAllAttachedProjectsIncludingPrimary(com.nomagic.ci.persistence.IProject project)
    Returns projects those are attached directly or indirectly to a given project including primary project.
    static Set<com.nomagic.ci.persistence.mounting.IMountPoint>
    getAllMountPoints(com.nomagic.ci.persistence.IPrimaryProject project)
    Deprecated.
    IMountPoint is not exposed into Open API
    static Collection<com.nomagic.ci.persistence.IProject>
    Return all modules and primary project in a given project
    static com.nomagic.ci.persistence.IAttachedProject
    getAttachedProject(com.nomagic.ci.persistence.IProject project, org.eclipse.emf.common.util.URI uri)
    Look for direct or not direct attached project in a primary project of a given project.
    static com.nomagic.ci.persistence.IAttachedProject
    getAttachedProject(org.eclipse.emf.ecore.EObject element)
    Find attached project (module) for a given element
    static Collection<com.nomagic.ci.persistence.IAttachedProject>
    getAttachedProjects(com.nomagic.ci.persistence.IProject project)
    Returns projects those are attached directly to a given project.
    static Collection<com.nomagic.ci.persistence.IProject>
    getAttachedProjectsIncludingPrimary(com.nomagic.ci.persistence.IProject project)
    Returns projects those are attached directly to a given project.Primary attached project can be included also.
    static com.nomagic.ci.persistence.IProject
    getAttachingProject(com.nomagic.ci.persistence.IProject project)
    Return first project where given project is attached.
    static Collection<com.nomagic.ci.persistence.IProject>
    getAttachingProjects(com.nomagic.ci.persistence.IProject project)
    Return all projects where given project is attached.
    static com.nomagic.ci.persistence.spi.decomposition.AbstractProjectAttachmentConfiguration
    getAttachment(com.nomagic.ci.persistence.IProject parent, com.nomagic.ci.persistence.IProject child)
    Return configuration which is used to attach one project to another
    getAutoLoadKind(com.nomagic.ci.persistence.decomposition.ProjectAttachmentConfiguration attachment)
    Deprecated.
    use public static AutoLoadKind getAutoLoadKind( AbstractProjectAttachmentConfiguration attachment )
    getAutoLoadKind(com.nomagic.ci.persistence.IProject owner, com.nomagic.ci.persistence.IProject project)
    Return load kind of given module in a given project
    getAutoLoadKind(com.nomagic.ci.persistence.spi.decomposition.AbstractProjectAttachmentConfiguration attachment)
    Return load kind of module from given attachment
    static String
    getCompatibleVersion(com.nomagic.ci.persistence.IProject project)
    Get compatible version of the project
    static Element
    Return element for a given base element.
    static org.eclipse.emf.common.util.URI
    Convert java net URI to emf uri
    static String
    getESIRemoteId(com.nomagic.ci.persistence.IProject project)
    Gets ESI remote ID for given project
    static String
    getESIRemoteId(org.eclipse.emf.common.util.URI uri)
    Gets ESI remote ID
    getExporterDescription(com.nomagic.ci.persistence.IProject project)
    Provide information about project version and required resources/plugins for that project.
    static String
    getInternalVersion(com.nomagic.ci.persistence.IProject project)
    Get internal version of project
    static Set<Element>
    Get modified elements.
    static com.nomagic.ci.persistence.mounting.IMountPoint
    getMountPoint(Collection<com.nomagic.ci.persistence.mounting.IMountPoint> points, Package element)
    Deprecated.
    com.nomagic.ci.persistence.mounting.IMountPoint is not exposed into Open API
    static Collection<com.nomagic.ci.persistence.mounting.IMountPoint>
    getMountPoints(com.nomagic.ci.persistence.IProject project)
    Gets all mount points in given project.
    static Set<com.nomagic.ci.persistence.mounting.IMountPoint>
    getMountPointsFor(com.nomagic.ci.persistence.IProject owner, com.nomagic.ci.persistence.IProject attachedProject)
    Gets mount points for given project, i.e.
    static com.nomagic.ci.persistence.IProject
    getOwner(com.nomagic.ci.persistence.IProject project)
    static Collection<com.nomagic.ci.persistence.IProject>
    getOwners(com.nomagic.ci.persistence.IProject project)
    static Project
    getProject(com.nomagic.ci.persistence.IProject iProject)
    Returns MagicDraw project for primary or attached project.
    static com.nomagic.ci.persistence.IProject
    getProject(org.eclipse.emf.ecore.EObject object)
    Return project in which object resists.
    static com.nomagic.ci.persistence.IProject
    getProject(org.eclipse.emf.ecore.resource.Resource resource)
    Return project for a resource.
    static com.nomagic.ci.persistence.IProject
    Find IProject for a given element
    static String
    getRemoteId(org.eclipse.emf.common.util.URI uri)
    Retrieves project remote id from given uri.
    static String
    getRemoteID(com.nomagic.ci.persistence.IProject project)
    Return remote id for a given project
    static String
    getRemoteID(org.eclipse.emf.common.util.URI uri)
    Extract remote project id from a given uri.
    static String
    getResourceID(com.nomagic.ci.persistence.IProject project)
    Gets simplified resource id for given project.
    static String
    Gets simplified resource id for given project descriptor.
    static String
    getResourceID(org.eclipse.emf.common.util.URI uri)
    Gets simplified resource id for given project location URI.
    static String
    getSaveID(com.nomagic.ci.persistence.IProject project)
    Gets current save/commit id for given project.
    getSharedPackages(com.nomagic.ci.persistence.IProject project)
    Return shared packages of a given project.
    getSharedPackagesIncludingReshared(com.nomagic.ci.persistence.IProject project)
    Return shared packages of a given project.
    getSharedPackagesIncludingResharedRecursively(com.nomagic.ci.persistence.IProject project)
    Return shared packages of a given project.
    static com.nomagic.ci.persistence.sharing.ISharePoint
    getSharePoint(com.nomagic.ci.persistence.mounting.IMountPoint point)
    Deprecated.
    com.nomagic.ci.persistence.mounting.ISharePoint is not exposed into Open API
    static URI
    getURI(org.eclipse.emf.common.util.URI emfUFI)
    Convert EMF uri to java.net.URI
    static com.nomagic.ci.persistence.versioning.IVersionDescriptor
    getVersion(com.nomagic.ci.persistence.IProject project)
    Return version of given project.
    static String
    Creates uri that can be shown in UI components
    static String
    getVisibleURI(org.eclipse.emf.common.util.URI uri)
    Creates uri that can be shown in UI components
    static boolean
    isAttachedProjectIDRelevant(Project project, String moduleID, com.nomagic.ci.persistence.IProject attachedProject)
    Checks if moduleID relevant to attached project
    static boolean
    Check if given element is a root of some module.
    static boolean
    isAttachedProjectRoot(Element element, com.nomagic.ci.persistence.IAttachedProject project)
    Check if given element is a root of given module.
    static boolean
    Check if given element belongs to some module
    static boolean
    Checks if given element is proxy or orphan proxy.
    static boolean
    Checks if given URI is ESI project URI
    static boolean
    isESIUri(org.eclipse.emf.common.util.URI uri)
    Checks if given URI is ESI project URI
    static boolean
    isFromEsiServer(com.nomagic.ci.persistence.IProject project)
    Check if given project is from ESI.
    static boolean
    Checks, if the given element is a part of the Standard Profile
    static boolean
    isFromStandardProfile(org.eclipse.emf.ecore.EObject element)
    Checks if element comes from standard profile
    static boolean
    Check if given project is from teamwork server.
    static boolean
    isLoaded(com.nomagic.ci.persistence.IProject project)
    Checks if given project loaded.
    static boolean
    isLoadedOrLoading(com.nomagic.ci.persistence.IProject project)
     
    static boolean
    isLoadIndex(com.nomagic.ci.persistence.spi.decomposition.AbstractProjectAttachmentConfiguration configuration)
    Check if to load index.
    static boolean
    isModule(com.nomagic.ci.persistence.DecompositionDescriptor r)
    Deprecated.
    DecompositionDescriptor is not exposed into Open API
    protected static boolean
    isModuleRoot(com.nomagic.ci.persistence.IAttachedProject iProject, Element element)
     
    static boolean
    isModuleUsageNew(com.nomagic.ci.persistence.IProject attachedProject)
    Check if attached project usage from primary project is new (not yet committed to server).
    static boolean
    Check if given package is a mounted(or is a shared root from some module)
    static boolean
    Checks if given project name is valid.
    static boolean
    isRemote(com.nomagic.ci.persistence.IProject project)
    Check if given project is remote - from teamwork server or ESI.
    static boolean
    isSharedElement(com.nomagic.ci.persistence.IProject project, Element element)
    Check if given element belongs to some shared (or reshared) package in a given project
    static boolean
    isStandardSystemProfile(com.nomagic.ci.persistence.DecompositionDescriptor project)
    Deprecated.
    DecompositionDescriptor is not exposed into Open API
    static boolean
    isStandardSystemProfile(com.nomagic.ci.persistence.IProject project)
    Check if given project is a standard system profile
    static void
    setLoadIndex(com.nomagic.ci.persistence.spi.decomposition.AbstractProjectAttachmentConfiguration configuration, boolean loadIndex)
    Set if to load index.
    static void
    updateConfigurationWithDefaultValues(com.nomagic.ci.persistence.decomposition.ProjectAttachmentConfiguration configuration)
    Updates attachment configuration with default values
    static int
    Deprecated.
    static long
    Utility method to convert string representation of version into long
    static String
    versionToString(int version)
    Utility method to convert int representation of version into string

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • ProjectUtilities

      public ProjectUtilities()
  • Method Details

    • createDefaultProjectAttachmentConfiguration

      public static com.nomagic.ci.persistence.decomposition.ProjectAttachmentConfiguration createDefaultProjectAttachmentConfiguration(org.eclipse.emf.common.util.URI uri)
      Create default project attachment configuration with default settings.
      Parameters:
      uri - uri
      Returns:
      attachment configuration
    • updateConfigurationWithDefaultValues

      public static void updateConfigurationWithDefaultValues(com.nomagic.ci.persistence.decomposition.ProjectAttachmentConfiguration configuration)
      Updates attachment configuration with default values
      Parameters:
      configuration - the configuration to update
    • isLoadIndex

      public static boolean isLoadIndex(com.nomagic.ci.persistence.spi.decomposition.AbstractProjectAttachmentConfiguration configuration)
      Check if to load index.
      Parameters:
      configuration - attachment configuration.
      Returns:
      true if option is set to load index.
    • setLoadIndex

      public static void setLoadIndex(com.nomagic.ci.persistence.spi.decomposition.AbstractProjectAttachmentConfiguration configuration, boolean loadIndex)
      Set if to load index.
      Parameters:
      configuration - attachment configuration.
      loadIndex - load index.
    • getAttachedProject

      @CheckReturnValue @CheckForNull public static com.nomagic.ci.persistence.IAttachedProject getAttachedProject(@CheckForNull org.eclipse.emf.ecore.EObject element)
      Find attached project (module) for a given element
      Parameters:
      element - element for which attached project will be returned
      Returns:
      project or null if element does not belong to any module
    • getProjectFor

      @CheckForNull public static com.nomagic.ci.persistence.IProject getProjectFor(@CheckForNull BaseElement element)
      Find IProject for a given element
      Parameters:
      element - element for which attached project will be returned
      Returns:
      project
    • findAttachedProjectByID

      @CheckForNull public static com.nomagic.ci.persistence.IAttachedProject findAttachedProjectByID(Project project, String moduleID, boolean recursively)
      Find attached project by given id in a given project
      Parameters:
      project - project to search in
      moduleID - module id
      recursively - search in primary project only or recursively in whole project
      Returns:
      found module
    • isAttachedProjectIDRelevant

      public static boolean isAttachedProjectIDRelevant(Project project, String moduleID, com.nomagic.ci.persistence.IProject attachedProject)
      Checks if moduleID relevant to attached project
      Parameters:
      project - project
      moduleID - expected module id
      attachedProject - module
      Returns:
      true if moduleID relevant to attached project
    • findAttachedProjectByID

      @CheckForNull public static com.nomagic.ci.persistence.IAttachedProject findAttachedProjectByID(com.nomagic.ci.persistence.IProject project, String moduleID, boolean recursively)
      Find attached project by given id in a given project
      Parameters:
      project - project to search in
      moduleID - module id
      recursively - search in primary project only or recursively in whole project
      Returns:
      found module
    • findAttachedProjectByProjectID

      @CheckForNull public static com.nomagic.ci.persistence.IAttachedProject findAttachedProjectByProjectID(com.nomagic.ci.persistence.IProject project, String projectID, boolean recursively)
      Find attached project by given project id
      Parameters:
      project - project to search in
      projectID - module id
      recursively - search in primary project only or recursively in whole project
      Returns:
      found module
    • findProjectByResourceID

      @CheckForNull public static com.nomagic.ci.persistence.IProject findProjectByResourceID(com.nomagic.ci.persistence.IPrimaryProject primaryProject, String resourceId)
      Search for project with given resource ID
      Parameters:
      primaryProject - scope of searching
      resourceId - resource ID.
      Returns:
      found project or null.
    • findAttachedProjectByName

      @CheckForNull public static com.nomagic.ci.persistence.IAttachedProject findAttachedProjectByName(Project project, String name, boolean recursively)
      Find attached project by given name in a given project
      Parameters:
      project - project to search in
      name - module name
      recursively - search in primary project only or recursively in whole project
      Returns:
      found module
    • findAttachedProjectByName

      @CheckForNull public static com.nomagic.ci.persistence.IAttachedProject findAttachedProjectByName(com.nomagic.ci.persistence.IProject project, String name)
      Find attached project by given name in a given project
      Parameters:
      project - project to search in
      name - module name
      Returns:
      found module
    • findAttachedProjectByNames

      @CheckForNull public static com.nomagic.ci.persistence.IAttachedProject findAttachedProjectByNames(Collection<String> names, Collection<com.nomagic.ci.persistence.IAttachedProject> modules)
    • findAttachedProjectByName

      @CheckForNull public static com.nomagic.ci.persistence.IAttachedProject findAttachedProjectByName(Project project, String name)
      Find attached project by given name in a given project. Does recursive search.
      Parameters:
      project - project to search in
      name - module name
      Returns:
      found module
    • findAttachedProjectByID

      @CheckForNull public static com.nomagic.ci.persistence.IAttachedProject findAttachedProjectByID(Project project, String moduleID)
      Find attached project by given id in a given project. Does recursive search.
      Parameters:
      project - project to search in
      moduleID - module id
      Returns:
      found module
    • isAttachedProjectRoot

      public static boolean isAttachedProjectRoot(@CheckForNull Element element)
      Check if given element is a root of some module.
      Parameters:
      element - element
      Returns:
      true if given element is root for module.
    • isAttachedProjectRoot

      public static boolean isAttachedProjectRoot(@CheckForNull Element element, com.nomagic.ci.persistence.IAttachedProject project)
      Check if given element is a root of given module.
      Parameters:
      element - element
      project - module
      Returns:
      true if given element is root for module
    • getSharedPackages

      public static Collection<Package> getSharedPackages(com.nomagic.ci.persistence.IProject project)
      Return shared packages of a given project. Does not include re-shared packages.
      Parameters:
      project - project
      Returns:
      shared packages.
    • getSharedPackagesIncludingReshared

      public static Collection<Package> getSharedPackagesIncludingReshared(com.nomagic.ci.persistence.IProject project)
      Return shared packages of a given project. Include also re-shared packages
      Parameters:
      project - project
      Returns:
      shared packages
    • getSharedPackagesIncludingResharedRecursively

      public static Collection<Package> getSharedPackagesIncludingResharedRecursively(com.nomagic.ci.persistence.IProject project)
      Return shared packages of a given project. Include also re-shared packages. Takes direct packages and also from attached modules recursively of a given project. For ESI project returns module model.
      Parameters:
      project - project
      Returns:
      shared packages
    • isElementInAttachedProject

      public static boolean isElementInAttachedProject(Element element)
      Check if given element belongs to some module
      Parameters:
      element - element
      Returns:
      true if element belongs to some module
    • getAllAttachedProjects

      public static Collection<com.nomagic.ci.persistence.IAttachedProject> getAllAttachedProjects(Project project)
      Return all modules in a given project
      Parameters:
      project - project
      Returns:
      all modules in the Project
    • getAllProjects

      public static Collection<com.nomagic.ci.persistence.IProject> getAllProjects(Project project)
      Return all modules and primary project in a given project
      Parameters:
      project - project
      Returns:
      all modules in the Project, collection is not modifiable
    • isSharedElement

      public static boolean isSharedElement(com.nomagic.ci.persistence.IProject project, Element element)
      Check if given element belongs to some shared (or reshared) package in a given project
      Parameters:
      project - project
      element - element
      Returns:
      true if element belongs to shared package
    • getRemoteID

      @CheckForNull public static String getRemoteID(org.eclipse.emf.common.util.URI uri)
      Extract remote project id from a given uri.
      Parameters:
      uri - uri
      Returns:
      remote if or null
    • getRemoteID

      @CheckForNull public static String getRemoteID(com.nomagic.ci.persistence.IProject project)
      Return remote id for a given project
      Parameters:
      project - project
      Returns:
      remote id
    • versionToInt

      public static int versionToInt(@CheckForNull String version)
      Deprecated.
      Utility method to convert string representation of version into int
      Parameters:
      version - version
      Returns:
      version as int
    • versionToLong

      public static long versionToLong(@CheckForNull String version)
      Utility method to convert string representation of version into long
      Parameters:
      version - version
      Returns:
      version as long
    • versionToString

      @CheckForNull public static String versionToString(int version)
      Utility method to convert int representation of version into string
      Parameters:
      version - version
      Returns:
      version as string
    • getResourceID

      public static String getResourceID(com.nomagic.ci.persistence.IProject project)
      Gets simplified resource id for given project. For remote project it returns project id, for local filename.
      Parameters:
      project - project descriptor
      Returns:
      filename or project id.
    • getResourceID

      public static String getResourceID(ProjectDescriptor pd)
      Gets simplified resource id for given project descriptor. For remote project it returns project id, for local filename.
      Parameters:
      pd - project descriptor
      Returns:
      filename or project id.
    • getResourceID

      public static String getResourceID(org.eclipse.emf.common.util.URI uri)
      Gets simplified resource id for given project location URI. For remote project it returns project id, for local filename.
      Parameters:
      uri - project location.
      Returns:
      filename or project id.
    • getAttachedProjects

      public static Collection<com.nomagic.ci.persistence.IAttachedProject> getAttachedProjects(com.nomagic.ci.persistence.IProject project)
      Returns projects those are attached directly to a given project. Primary attached project is ignored.
      Parameters:
      project - project
      Returns:
      collection of attached projects
    • getAllAttachedProjects

      public static Collection<com.nomagic.ci.persistence.IAttachedProject> getAllAttachedProjects(com.nomagic.ci.persistence.IProject project)
      Returns projects those are attached directly or indirectly to a given project. Primary attached project is ignored.
      Parameters:
      project - project
      Returns:
      collection of attached projects
    • getAllAttachedProjectsIncludingPrimary

      public static Collection<com.nomagic.ci.persistence.IProject> getAllAttachedProjectsIncludingPrimary(com.nomagic.ci.persistence.IProject project)
      Returns projects those are attached directly or indirectly to a given project including primary project.
      Parameters:
      project - project
      Returns:
      collection of attached projects
    • getAllAttachedProjects

      public static Collection<com.nomagic.ci.persistence.IAttachedProject> getAllAttachedProjects(Collection<com.nomagic.ci.persistence.IAttachedProject> projects)
      Returns projects those are attached directly or indirectly to a given project. Primary attached project is ignored.
      Parameters:
      projects - project projects
      Returns:
      collection of attached projects
    • getAttachedProjectsIncludingPrimary

      public static Collection<com.nomagic.ci.persistence.IProject> getAttachedProjectsIncludingPrimary(com.nomagic.ci.persistence.IProject project)
      Returns projects those are attached directly to a given project.Primary attached project can be included also.
      Parameters:
      project - project
      Returns:
      collection of attached projects
    • getAutoLoadKind

      public static AutoLoadKind getAutoLoadKind(com.nomagic.ci.persistence.IProject owner, com.nomagic.ci.persistence.IProject project)
      Return load kind of given module in a given project
      Parameters:
      owner - project
      project - module
      Returns:
      load kind
    • getAutoLoadKind

      @Deprecated public static AutoLoadKind getAutoLoadKind(com.nomagic.ci.persistence.decomposition.ProjectAttachmentConfiguration attachment)
      Deprecated.
      use public static AutoLoadKind getAutoLoadKind( AbstractProjectAttachmentConfiguration attachment )
      Return load kind of module from given attachment
      Parameters:
      attachment - attachment
      Returns:
      load kind
    • getAutoLoadKind

      public static AutoLoadKind getAutoLoadKind(com.nomagic.ci.persistence.spi.decomposition.AbstractProjectAttachmentConfiguration attachment)
      Return load kind of module from given attachment
      Parameters:
      attachment - attachment
      Returns:
      load kind
    • getAttachingProject

      @CheckForNull public static com.nomagic.ci.persistence.IProject getAttachingProject(com.nomagic.ci.persistence.IProject project)
      Return first project where given project is attached. Primary project has always priority.
      Parameters:
      project - given project
      Returns:
      first project where given module is attached.
    • getAttachingProjects

      public static Collection<com.nomagic.ci.persistence.IProject> getAttachingProjects(com.nomagic.ci.persistence.IProject project)
      Return all projects where given project is attached.
      Parameters:
      project - given project.
      Returns:
      all projects where given module is attached.
    • getOwner

      @CheckForNull @Deprecated public static com.nomagic.ci.persistence.IProject getOwner(com.nomagic.ci.persistence.IProject project)
    • getOwners

      @Deprecated public static Collection<com.nomagic.ci.persistence.IProject> getOwners(com.nomagic.ci.persistence.IProject project)
    • getEMFURI

      public static org.eclipse.emf.common.util.URI getEMFURI(URI uri)
      Convert java net URI to emf uri
      Parameters:
      uri - net uri
      Returns:
      emf uri
    • getAttachment

      @CheckForNull public static com.nomagic.ci.persistence.spi.decomposition.AbstractProjectAttachmentConfiguration getAttachment(com.nomagic.ci.persistence.IProject parent, com.nomagic.ci.persistence.IProject child)
      Return configuration which is used to attach one project to another
      Parameters:
      parent - project which uses another project (directly)
      child - used directly project
      Returns:
      found ProjectAttachmentConfiguration (for local and teamwork projects) or EsiProjectAttachmentConfiguration (for Teamwork Cloud projects) or null if such not found.
    • getURI

      public static URI getURI(org.eclipse.emf.common.util.URI emfUFI)
      Convert EMF uri to java.net.URI
      Parameters:
      emfUFI - emf uri
      Returns:
      java net uri
    • getVersion

      @CheckForNull public static com.nomagic.ci.persistence.versioning.IVersionDescriptor getVersion(com.nomagic.ci.persistence.IProject project)
      Return version of given project.
      Parameters:
      project - project
      Returns:
      version or null if project has no version
    • isFromTeamworkServer

      public static boolean isFromTeamworkServer()
      Check if given project is from teamwork server.
      Returns:
      true if project is from server
    • isFromEsiServer

      public static boolean isFromEsiServer(@CheckForNull com.nomagic.ci.persistence.IProject project)
      Check if given project is from ESI.
      Parameters:
      project - project
      Returns:
      true if project is from ESI
    • isRemote

      public static boolean isRemote(@CheckForNull com.nomagic.ci.persistence.IProject project)
      Check if given project is remote - from teamwork server or ESI.
      Parameters:
      project - project
      Returns:
      true if project is from server
    • isFromStandardProfile

      public static boolean isFromStandardProfile(Element element)
      Checks, if the given element is a part of the Standard Profile
      Parameters:
      element - element to check
      Returns:
      true, if the given element is a part of the Standard Profile
    • getProject

      @CheckForNull public static Project getProject(@CheckForNull com.nomagic.ci.persistence.IProject iProject)
      Returns MagicDraw project for primary or attached project.
      Parameters:
      iProject - primary or attached project
      Returns:
      Project
    • getMountPoint

      @Deprecated @CheckForNull public static com.nomagic.ci.persistence.mounting.IMountPoint getMountPoint(Collection<com.nomagic.ci.persistence.mounting.IMountPoint> points, Package element)
      Deprecated.
      com.nomagic.ci.persistence.mounting.IMountPoint is not exposed into Open API
      Find mount point in a given collection which mounts a given package.
      Parameters:
      points - mount points
      element - package
      Returns:
      found mount point
    • getSharePoint

      @Deprecated @CheckForNull public static com.nomagic.ci.persistence.sharing.ISharePoint getSharePoint(com.nomagic.ci.persistence.mounting.IMountPoint point)
      Deprecated.
      com.nomagic.ci.persistence.mounting.ISharePoint is not exposed into Open API
      Find share point corresponding given mount point
      Parameters:
      point - mount point
      Returns:
      share point
    • encodeTeamworkRemoteId

      public static String encodeTeamworkRemoteId(String remoteId)
      Encodes Teamwork remote ID
      Parameters:
      remoteId - the raw (not encoded) remote ID
      Returns:
      encoded ID
    • decodeTeamworkRemoteId

      public static String decodeTeamworkRemoteId(String remoteId)
      Decodes Teamwork remote ID
      Parameters:
      remoteId - the encoded remote ID
      Returns:
      decoded (raw) remote ID
    • isESIUri

      public static boolean isESIUri(org.eclipse.emf.common.util.URI uri)
      Checks if given URI is ESI project URI
      Parameters:
      uri - the URI to check
      Returns:
      true if given URI is ESI, false otherwise
    • isESIUri

      public static boolean isESIUri(URI uri)
      Checks if given URI is ESI project URI
      Parameters:
      uri - the URI to check
      Returns:
      true if given URI is ESI, false otherwise
    • isElementProxy

      public static boolean isElementProxy(BaseElement element)
      Checks if given element is proxy or orphan proxy.
      Parameters:
      element - the element to check
      Returns:
      true if given element is proxy or orphan proxy, otherwise - false
    • getESIRemoteId

      @CheckForNull public static String getESIRemoteId(org.eclipse.emf.common.util.URI uri)
      Gets ESI remote ID
      Parameters:
      uri - the URI to get remote ID for
      Returns:
      the remote ID
    • getESIRemoteId

      @CheckForNull public static String getESIRemoteId(com.nomagic.ci.persistence.IProject project)
      Gets ESI remote ID for given project
      Parameters:
      project - the project
      Returns:
      the remote ID
    • getRemoteId

      @CheckReturnValue @CheckForNull public static String getRemoteId(org.eclipse.emf.common.util.URI uri)
      Retrieves project remote id from given uri.
      Parameters:
      uri - remote project uri to check.
      Returns:
      remote project id from project uri.
    • getMountPoints

      public static Collection<com.nomagic.ci.persistence.mounting.IMountPoint> getMountPoints(com.nomagic.ci.persistence.IProject project)
      Gets all mount points in given project. Returns empty set if there are no mount points
      Parameters:
      project - project
      Returns:
      non-null set of all mount points
    • getMountPointsFor

      public static Set<com.nomagic.ci.persistence.mounting.IMountPoint> getMountPointsFor(com.nomagic.ci.persistence.IProject owner, com.nomagic.ci.persistence.IProject attachedProject)
      Gets mount points for given project, i.e. returns all mount points that are mounted share points of given project. Returns empty set if there are no mount points to return.
      Parameters:
      owner - owner
      attachedProject - the project to get mount points for
      Returns:
      non-null set of mount points for specific project
    • getAllMountPoints

      @Deprecated public static Set<com.nomagic.ci.persistence.mounting.IMountPoint> getAllMountPoints(com.nomagic.ci.persistence.IPrimaryProject project)
      Deprecated.
      IMountPoint is not exposed into Open API
      Return all mount points existing in given primary project (direct and not direct).
      Parameters:
      project - project
      Returns:
      all mount points from given project and from all attached
    • getProject

      @CheckForNull public static com.nomagic.ci.persistence.IProject getProject(@CheckForNull org.eclipse.emf.ecore.EObject object)
      Return project in which object resists.
      Parameters:
      object - object
      Returns:
      found project or null
    • getProject

      @CheckForNull public static com.nomagic.ci.persistence.IProject getProject(@CheckForNull org.eclipse.emf.ecore.resource.Resource resource)
      Return project for a resource.
      Parameters:
      resource - resource
      Returns:
      found project or null
    • compareVersions

      public static int compareVersions(@CheckForNull com.nomagic.ci.persistence.versioning.IVersionDescriptor versionDescriptor1, @CheckForNull com.nomagic.ci.persistence.versioning.IVersionDescriptor versionDescriptor2)
      Compare given versions descriptors. The null descriptor is larger than not null.
      Parameters:
      versionDescriptor1 - first version descriptor (can be null).
      versionDescriptor2 - second version descriptor (can be null).
      Returns:
      the value 0 if versions are equal; a value less than 0 if first version is less then second; and a value greater than 0 if first version is greater then second.
    • compareVersionNumber

      public static int compareVersionNumber(@CheckForNull String versionNumber1, @CheckForNull String versionNumber2)
      Compare given version numbers.
      Parameters:
      versionNumber1 - first version number.
      versionNumber2 - second version number.
      Returns:
      the value 0 if versions are equal; a value less than 0 if first version is less then second; and a value greater than 0 if first version is greater then second.
    • getAttachedProject

      @CheckForNull public static com.nomagic.ci.persistence.IAttachedProject getAttachedProject(com.nomagic.ci.persistence.IProject project, org.eclipse.emf.common.util.URI uri)
      Look for direct or not direct attached project in a primary project of a given project.
      Parameters:
      project - project
      uri - uri
      Returns:
      found module
    • getElementFor

      @CheckForNull public static Element getElementFor(@CheckForNull BaseElement element)
      Return element for a given base element. Returned element can be passed into other utility methods as EObject if needed.
      Parameters:
      element - base element
      Returns:
      model element
    • isMountedPackage

      public static boolean isMountedPackage(Package pck)
      Check if given package is a mounted(or is a shared root from some module)
      Parameters:
      pck - package
      Returns:
      true if package is mounted
    • isModuleRoot

      protected static boolean isModuleRoot(com.nomagic.ci.persistence.IAttachedProject iProject, Element element)
    • getInternalVersion

      @CheckForNull public static String getInternalVersion(com.nomagic.ci.persistence.IProject project)
      Get internal version of project
      Parameters:
      project - project
      Returns:
      version
    • getCompatibleVersion

      @CheckForNull public static String getCompatibleVersion(com.nomagic.ci.persistence.IProject project)
      Get compatible version of the project
      Parameters:
      project - project
      Returns:
      compatible version
    • isStandardSystemProfile

      public static boolean isStandardSystemProfile(com.nomagic.ci.persistence.IProject project)
      Check if given project is a standard system profile
      Parameters:
      project - project
      Returns:
      true if given project is a standard system profile
    • isStandardSystemProfile

      @Deprecated public static boolean isStandardSystemProfile(com.nomagic.ci.persistence.DecompositionDescriptor project)
      Deprecated.
      DecompositionDescriptor is not exposed into Open API
      Check if given project is a standard system profile
      Parameters:
      project - project
      Returns:
      true if given project is a standard system profile
    • isLoaded

      public static boolean isLoaded(com.nomagic.ci.persistence.IProject project)
      Checks if given project loaded.
      Parameters:
      project - project
      Returns:
      true if given project is loaded
    • isLoadedOrLoading

      public static boolean isLoadedOrLoading(com.nomagic.ci.persistence.IProject project)
    • isModule

      @Deprecated public static boolean isModule(com.nomagic.ci.persistence.DecompositionDescriptor r)
      Deprecated.
      DecompositionDescriptor is not exposed into Open API
      Returns true if given project has shared points.
      Parameters:
      r - project descriptor to evaluate
      Returns:
      true if given project descriptor represents a module.
    • isFromStandardProfile

      public static boolean isFromStandardProfile(@CheckForNull org.eclipse.emf.ecore.EObject element)
      Checks if element comes from standard profile
      Parameters:
      element - element to be checked
      Returns:
      true if element comes from standard profile.
    • getModifiedElements

      public static Set<Element> getModifiedElements(Project project)
      Get modified elements.
      Parameters:
      project - project to get elements of.
      Returns:
      modified elements.
    • getExporterDescription

      @CheckForNull public static XmiExporterDescription getExporterDescription(com.nomagic.ci.persistence.IProject project)
      Provide information about project version and required resources/plugins for that project.
      Parameters:
      project - project
      Returns:
      description of project
    • getSaveID

      @CheckForNull public static String getSaveID(com.nomagic.ci.persistence.IProject project)
      Gets current save/commit id for given project. The value of the Save ID is a randomly generated unique UUID.
      Parameters:
      project - project
      Returns:
      save id
    • addToCacheLoaded

      protected static void addToCacheLoaded(com.nomagic.ci.persistence.IProject project, XmiExporterDescription xmiExporterDescription)
      Adds to cache just loaded modules/projects
      Parameters:
      project - project/module
      xmiExporterDescription - project/module descriptor
    • addToCache

      protected static void addToCache(com.nomagic.ci.persistence.IProject project, @CheckForNull XmiExporterDescription xmiExporterDescription)
    • isModuleUsageNew

      public static boolean isModuleUsageNew(com.nomagic.ci.persistence.IProject attachedProject)
      Check if attached project usage from primary project is new (not yet committed to server). This method does not support checking if the usage is new for Teamwork Server Project therefore it always returns false in that case.
      Parameters:
      attachedProject - the IProject of attached project
      Returns:
      true if the provided project is attached project and it is a Teamwork Cloud Project and if the usage from primary project to attached project exists and if it is new (as defined above). Return false otherwise
    • getVisibleURI

      public static String getVisibleURI(URI uri)
      Creates uri that can be shown in UI components
      Parameters:
      uri - project location uri
      Returns:
      visible uri
    • getVisibleURI

      public static String getVisibleURI(org.eclipse.emf.common.util.URI uri)
      Creates uri that can be shown in UI components
      Parameters:
      uri - project location uri
      Returns:
      visible uri
    • isProjectNameValid

      public static boolean isProjectNameValid(String projectName)
      Checks if given project name is valid. Checks if either the given project name is reserved or has invalid characters
      Parameters:
      projectName - the project name to check
      Returns:
      true if project name is valid, false otherwise