Package com.nomagic.magicdraw.core
Class ProjectUtilities
- java.lang.Object
-
- com.nomagic.magicdraw.core.ProjectUtilities
-
@OpenApiAll public class ProjectUtilities extends java.lang.Object
Project decomposition related utility class.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
EXPORTER_DESCRIPTION
Property for XmiExporterDescriptionprotected static java.util.Map<com.nomagic.ci.persistence.IProject,XmiExporterDescription>
mExporterDescriptions
protected static java.lang.String
REMOTE_ID_ENCODING
-
Constructor Summary
Constructors Constructor Description ProjectUtilities()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods 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/projectsstatic int
compareVersionNumber(java.lang.String versionNumber1, java.lang.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 java.lang.String
decodeTeamworkRemoteId(java.lang.String remoteId)
Decodes Teamwork remote IDstatic java.lang.String
encodeTeamworkRemoteId(java.lang.String remoteId)
Encodes Teamwork remote IDstatic com.nomagic.ci.persistence.IAttachedProject
findAttachedProjectByID(com.nomagic.ci.persistence.IProject project, java.lang.String moduleID, boolean recursively)
Find attached project by given id in a given projectstatic com.nomagic.ci.persistence.IAttachedProject
findAttachedProjectByID(Project project, java.lang.String moduleID)
Find attached project by given id in a given project.static com.nomagic.ci.persistence.IAttachedProject
findAttachedProjectByID(Project project, java.lang.String moduleID, boolean recursively)
Find attached project by given id in a given projectstatic com.nomagic.ci.persistence.IAttachedProject
findAttachedProjectByName(com.nomagic.ci.persistence.IProject project, java.lang.String name)
Find attached project by given name in a given projectstatic com.nomagic.ci.persistence.IAttachedProject
findAttachedProjectByName(Project project, java.lang.String name)
Find attached project by given name in a given project.static com.nomagic.ci.persistence.IAttachedProject
findAttachedProjectByName(Project project, java.lang.String name, boolean recursively)
Find attached project by given name in a given projectstatic com.nomagic.ci.persistence.IAttachedProject
findAttachedProjectByProjectID(com.nomagic.ci.persistence.IProject project, java.lang.String projectID, boolean recursively)
Find attached project by given project idstatic com.nomagic.ci.persistence.IProject
findProjectByResourceID(com.nomagic.ci.persistence.IPrimaryProject primaryProject, java.lang.String resourceId)
Search for project with given resource IDstatic java.util.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 java.util.Collection<com.nomagic.ci.persistence.IAttachedProject>
getAllAttachedProjects(Project project)
Return all modules in a given projectstatic java.util.Collection<com.nomagic.ci.persistence.IAttachedProject>
getAllAttachedProjects(java.util.Collection<com.nomagic.ci.persistence.IAttachedProject> projects)
Returns projects those are attached directly or indirectly to a given project.static java.util.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 java.util.Set<com.nomagic.ci.persistence.mounting.IMountPoint>
getAllMountPoints(com.nomagic.ci.persistence.IPrimaryProject project)
Deprecated.IMountPoint is not exposed into Open APIstatic java.util.Collection<com.nomagic.ci.persistence.IProject>
getAllProjects(Project project)
Return all modules and primary project in a given projectstatic 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 elementstatic java.util.Collection<com.nomagic.ci.persistence.IAttachedProject>
getAttachedProjects(com.nomagic.ci.persistence.IProject project)
Returns projects those are attached directly to a given project.static java.util.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 java.util.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 anotherstatic AutoLoadKind
getAutoLoadKind(com.nomagic.ci.persistence.decomposition.ProjectAttachmentConfiguration attachment)
Deprecated.use public static AutoLoadKind getAutoLoadKind( AbstractProjectAttachmentConfiguration attachment )static AutoLoadKind
getAutoLoadKind(com.nomagic.ci.persistence.IProject owner, com.nomagic.ci.persistence.IProject project)
Return load kind of given module in a given projectstatic AutoLoadKind
getAutoLoadKind(com.nomagic.ci.persistence.spi.decomposition.AbstractProjectAttachmentConfiguration attachment)
Return load kind of module from given attachmentstatic java.lang.String
getCompatibleVersion(com.nomagic.ci.persistence.IProject project)
Get compatible version of the projectstatic Element
getElementFor(BaseElement element)
Return element for a given base element.static org.eclipse.emf.common.util.URI
getEMFURI(java.net.URI uri)
Convert java net URI to emf uristatic java.lang.String
getESIRemoteId(com.nomagic.ci.persistence.IProject project)
Gets ESI remote ID for given projectstatic java.lang.String
getESIRemoteId(org.eclipse.emf.common.util.URI uri)
Gets ESI remote IDstatic XmiExporterDescription
getExporterDescription(com.nomagic.ci.persistence.IProject project)
Provide information about project version and required resources/plugins for that project.static java.lang.String
getInternalVersion(com.nomagic.ci.persistence.IProject project)
Get internal version of projectstatic java.util.Set<Element>
getModifiedElements(Project project)
Get modified elements.static com.nomagic.ci.persistence.mounting.IMountPoint
getMountPoint(java.util.Collection<com.nomagic.ci.persistence.mounting.IMountPoint> points, Package element)
Deprecated.com.nomagic.ci.persistence.mounting.IMountPoint is not exposed into Open APIstatic java.util.Collection<com.nomagic.ci.persistence.mounting.IMountPoint>
getMountPoints(com.nomagic.ci.persistence.IProject project)
Gets all mount points in given project.static java.util.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)
Deprecated.static java.util.Collection<com.nomagic.ci.persistence.IProject>
getOwners(com.nomagic.ci.persistence.IProject project)
Deprecated.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
getProjectFor(BaseElement element)
Find IProject for a given elementstatic java.lang.String
getRemoteId(org.eclipse.emf.common.util.URI uri)
Retrieves project remote id from given uri.static java.lang.String
getRemoteID(com.nomagic.ci.persistence.IProject project)
Return remote id for a given projectstatic java.lang.String
getRemoteID(org.eclipse.emf.common.util.URI uri)
Extract remote project id from a given uri.static java.lang.String
getResourceID(com.nomagic.ci.persistence.IProject project)
Gets simplified resource id for given project.static java.lang.String
getResourceID(ProjectDescriptor pd)
Gets simplified resource id for given project descriptor.static java.lang.String
getResourceID(org.eclipse.emf.common.util.URI uri)
Gets simplified resource id for given project location URI.static java.lang.String
getSaveID(com.nomagic.ci.persistence.IProject project)
Gets current save/commit id for given project.static java.util.Collection<Package>
getSharedPackages(com.nomagic.ci.persistence.IProject project)
Return shared packages of a given project.static java.util.Collection<Package>
getSharedPackagesIncludingReshared(com.nomagic.ci.persistence.IProject project)
Return shared packages of a given project.static java.util.Collection<Package>
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 APIstatic java.net.URI
getURI(org.eclipse.emf.common.util.URI emfUFI)
Convert EMF uri to java.net.URIstatic com.nomagic.ci.persistence.versioning.IVersionDescriptor
getVersion(com.nomagic.ci.persistence.IProject project)
Return version of given project.static java.lang.String
getVisibleURI(java.net.URI uri)
Creates uri that can be shown in UI componentsstatic java.lang.String
getVisibleURI(org.eclipse.emf.common.util.URI uri)
Creates uri that can be shown in UI componentsstatic boolean
isAttachedProjectIDRelevant(Project project, java.lang.String moduleID, com.nomagic.ci.persistence.IProject attachedProject)
Checks if moduleID relevant to attached projectstatic boolean
isAttachedProjectRoot(Element element)
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
isElementInAttachedProject(Element element)
Check if given element belongs to some modulestatic boolean
isElementProxy(BaseElement element)
Checks if given element is proxy or orphan proxy.static boolean
isESIUri(java.net.URI uri)
Checks if givenURI
is ESI projectURI
static boolean
isESIUri(org.eclipse.emf.common.util.URI uri)
Checks if givenURI
is ESI projectURI
static boolean
isFromEsiServer(com.nomagic.ci.persistence.IProject project)
Check if given project is from ESI.static boolean
isFromStandardProfile(Element element)
Checks, if the given element is a part of the Standard Profilestatic boolean
isFromStandardProfile(org.eclipse.emf.ecore.EObject element)
Checks if element comes from standard profilestatic boolean
isFromTeamworkServer()
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 APIprotected 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
isMountedPackage(Package pck)
Check if given package is a mounted(or is a shared root from some module)static boolean
isProjectNameValid(java.lang.String projectName)
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 projectstatic boolean
isStandardSystemProfile(com.nomagic.ci.persistence.DecompositionDescriptor project)
Deprecated.DecompositionDescriptor is not exposed into Open APIstatic boolean
isStandardSystemProfile(com.nomagic.ci.persistence.IProject project)
Check if given project is a standard system profilestatic 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 valuesstatic int
versionToInt(java.lang.String version)
Deprecated.static long
versionToLong(java.lang.String version)
Utility method to convert string representation of version into longstatic java.lang.String
versionToString(int version)
Utility method to convert int representation of version into string
-
-
-
Field Detail
-
mExporterDescriptions
protected static java.util.Map<com.nomagic.ci.persistence.IProject,XmiExporterDescription> mExporterDescriptions
-
EXPORTER_DESCRIPTION
public static final java.lang.String EXPORTER_DESCRIPTION
Property for XmiExporterDescription- See Also:
- Constant Field Values
-
REMOTE_ID_ENCODING
protected static final java.lang.String REMOTE_ID_ENCODING
- See Also:
- Constant Field Values
-
-
Method Detail
-
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, java.lang.String moduleID, boolean recursively)
Find attached project by given id in a given project- Parameters:
project
- project to search inmoduleID
- module idrecursively
- search in primary project only or recursively in whole project- Returns:
- found module
-
isAttachedProjectIDRelevant
public static boolean isAttachedProjectIDRelevant(Project project, java.lang.String moduleID, com.nomagic.ci.persistence.IProject attachedProject)
Checks if moduleID relevant to attached project- Parameters:
project
- projectmoduleID
- expected module idattachedProject
- 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, java.lang.String moduleID, boolean recursively)
Find attached project by given id in a given project- Parameters:
project
- project to search inmoduleID
- module idrecursively
- 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, java.lang.String projectID, boolean recursively)
Find attached project by given project id- Parameters:
project
- project to search inprojectID
- module idrecursively
- 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, java.lang.String resourceId)
Search for project with given resource ID- Parameters:
primaryProject
- scope of searchingresourceId
- resource ID.- Returns:
- found project or null.
-
findAttachedProjectByName
@CheckForNull public static com.nomagic.ci.persistence.IAttachedProject findAttachedProjectByName(Project project, java.lang.String name, boolean recursively)
Find attached project by given name in a given project- Parameters:
project
- project to search inname
- module namerecursively
- 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, java.lang.String name)
Find attached project by given name in a given project- Parameters:
project
- project to search inname
- module name- Returns:
- found module
-
findAttachedProjectByName
@CheckForNull public static com.nomagic.ci.persistence.IAttachedProject findAttachedProjectByName(Project project, java.lang.String name)
Find attached project by given name in a given project. Does recursive search.- Parameters:
project
- project to search inname
- module name- Returns:
- found module
-
findAttachedProjectByID
@CheckForNull public static com.nomagic.ci.persistence.IAttachedProject findAttachedProjectByID(Project project, java.lang.String moduleID)
Find attached project by given id in a given project. Does recursive search.- Parameters:
project
- project to search inmoduleID
- 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
- elementproject
- module- Returns:
- true if given element is root for module
-
getSharedPackages
public static java.util.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 java.util.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 java.util.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 java.util.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 java.util.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
- projectelement
- element- Returns:
- true if element belongs to shared package
-
getRemoteID
@CheckForNull public static java.lang.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 java.lang.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 java.lang.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 java.lang.String version)
Utility method to convert string representation of version into long- Parameters:
version
- version- Returns:
- version as long
-
versionToString
@CheckForNull public static java.lang.String versionToString(int version)
Utility method to convert int representation of version into string- Parameters:
version
- version- Returns:
- version as string
-
getResourceID
public static java.lang.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 java.lang.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 java.lang.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 java.util.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 java.util.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 java.util.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 java.util.Collection<com.nomagic.ci.persistence.IAttachedProject> getAllAttachedProjects(java.util.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 java.util.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
- projectproject
- 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 java.util.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)
Deprecated.
-
getOwners
@Deprecated public static java.util.Collection<com.nomagic.ci.persistence.IProject> getOwners(com.nomagic.ci.persistence.IProject project)
Deprecated.
-
getEMFURI
public static org.eclipse.emf.common.util.URI getEMFURI(java.net.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) orEsiProjectAttachmentConfiguration
(for Teamwork Cloud projects) or null if such not found.
-
getURI
public static java.net.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(java.util.Collection<com.nomagic.ci.persistence.mounting.IMountPoint> points, Package element)
Deprecated.com.nomagic.ci.persistence.mounting.IMountPoint is not exposed into Open APIFind mount point in a given collection which mounts a given package.- Parameters:
points
- mount pointselement
- 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 APIFind share point corresponding given mount point- Parameters:
point
- mount point- Returns:
- share point
-
encodeTeamworkRemoteId
public static java.lang.String encodeTeamworkRemoteId(java.lang.String remoteId)
Encodes Teamwork remote ID- Parameters:
remoteId
- the raw (not encoded) remote ID- Returns:
- encoded ID
-
decodeTeamworkRemoteId
public static java.lang.String decodeTeamworkRemoteId(java.lang.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 givenURI
is ESI projectURI
- Parameters:
uri
- theURI
to check- Returns:
true
if givenURI
is ESI,false
otherwise
-
isESIUri
public static boolean isESIUri(java.net.URI uri)
Checks if givenURI
is ESI projectURI
- Parameters:
uri
- theURI
to check- Returns:
true
if givenURI
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 java.lang.String getESIRemoteId(org.eclipse.emf.common.util.URI uri)
Gets ESI remote ID- Parameters:
uri
- theURI
to get remote ID for- Returns:
- the remote ID
-
getESIRemoteId
@CheckForNull public static java.lang.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 java.lang.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 java.util.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 allmount points
-
getMountPointsFor
public static java.util.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
- ownerattachedProject
- the project to get mount points for- Returns:
- non-
null
set ofmount points
for specific project
-
getAllMountPoints
@Deprecated public static java.util.Set<com.nomagic.ci.persistence.mounting.IMountPoint> getAllMountPoints(com.nomagic.ci.persistence.IPrimaryProject project)
Deprecated.IMountPoint is not exposed into Open APIReturn 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 java.lang.String versionNumber1, @CheckForNull java.lang.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
- projecturi
- 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 java.lang.String getInternalVersion(com.nomagic.ci.persistence.IProject project)
Get internal version of project- Parameters:
project
- project- Returns:
- version
-
getCompatibleVersion
@CheckForNull public static java.lang.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 APICheck 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 APIReturns 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 java.util.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 java.lang.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/modulexmiExporterDescription
- 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 returnsfalse
in that case.- Parameters:
attachedProject
- theIProject
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). Returnfalse
otherwise
-
getVisibleURI
public static java.lang.String getVisibleURI(java.net.URI uri)
Creates uri that can be shown in UI components- Parameters:
uri
- project location uri- Returns:
- visible uri
-
getVisibleURI
public static java.lang.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(java.lang.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
-
-