@OpenApiAll
public class EsiUtils
extends java.lang.Object
EsiUtils.getTeamworkService().login(new ServerLoginInfo("localhost", "user", "password", false), false);
Modifier and Type | Class and Description |
---|---|
static interface |
EsiUtils.ApplyProjectStateResult
A structure that is produced by the
applyProjectState(Project, Project) and
which holds information about the result of the operation |
static interface |
EsiUtils.EsiBranchInfo
Branch information.
|
Constructor and Description |
---|
EsiUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
addCommitTags(java.util.List<java.lang.String> tags,
ProjectDescriptor descriptor,
long version)
Add tags for given version.
|
static IPrimaryProject |
addToESI(Project project,
java.lang.String esiProjectName)
Add project to the ESI server and open it.
|
static IPrimaryProject |
addToESI(Project project,
java.lang.String esiProjectName,
java.lang.String category,
java.lang.String comment,
java.util.List<java.lang.String> tags,
java.util.Collection<ResolveLocalModuleInfo> resolveInfos)
Add project to the ESI server and open it
|
static EsiUtils.ApplyProjectStateResult |
applyProjectState(Project source,
Project target)
Applies the state of the source project to the target project, or in other words, overwrites
the content of the target project with the contents of the source project.
|
static void |
assignProjectToCategory(ProjectDescriptor project,
java.lang.String... categories)
Adds or remove project to/from categories.
|
static void |
commitProject(Project project,
java.lang.String comment,
java.util.Collection<Element> unlockElements,
java.util.Collection<ModuleUsage> unlockModules,
boolean unlockDecomposition,
java.util.List<java.lang.String> tags)
Commit project.
|
static Project |
convertToLocal(Project project,
java.io.File file)
Convert given project to local, save and reopen it.
|
static void |
createBranch(ProjectDescriptor descriptor,
long version,
java.lang.String branchName,
java.lang.String branchDescription)
Create new branch for given project.
|
static void |
createCategory(java.lang.String name,
java.lang.String description)
Create projects category in the server.
|
static Project |
createProject(java.lang.String name,
java.lang.String category)
Create ESI project.
|
static void |
deleteBranch(ProjectDescriptor descriptor,
java.lang.String branchName)
Delete project branch.
|
static void |
deleteCategory(java.lang.String name)
Delete category with given name.
|
static void |
deleteProject(ProjectDescriptor project)
Delete project from repository.
|
static IAttachedProject |
exportEsiModule(Project project,
java.util.Collection<Package> packages,
java.lang.String description,
java.lang.String moduleName)
Exports module.
|
static java.util.List<com.nomagic.esi.api.info.TagInfo> |
getAllCommitTagsInfo(ProjectDescriptor descriptor)
Get all tags for project.
|
static java.util.Collection<EsiUtils.EsiBranchInfo> |
getBranches(ProjectDescriptor descriptor)
Get all branches for given project.
|
static java.util.UUID |
getBranchID(org.eclipse.emf.common.util.URI locationURI)
Gets project branch ID.
|
static java.util.Set<com.nomagic.teamwork.common.projects.CategoryInfo> |
getCategories() |
static java.util.Map<java.lang.String,java.util.List<ProjectDescriptor>> |
getCategoriesToProjects()
Get categories for projects.
|
static java.lang.String |
getCategoryID(java.lang.String resourceID)
Gets category ID for specified twc project resource ID.
|
static java.util.List<java.lang.String> |
getCommitTags(ProjectDescriptor descriptor,
long version)
Get tags names for project version.
|
static java.util.List<com.nomagic.esi.api.info.TagInfo> |
getCommitTagsInfo(ProjectDescriptor descriptor,
long version)
Get tags for project version.
|
static EsiUtils.EsiBranchInfo |
getCurrentBranch(IProject project)
Gets branch information for the given TWC project part.
|
static ProjectDescriptor |
getDescriptorByBranchID(ProjectDescriptor project,
java.util.UUID branchID)
Get project descriptor for given branch.
|
static ProjectDescriptor |
getDescriptorForBranch(ProjectDescriptor project,
java.lang.String branchName)
Get project descriptor for given branch.
|
static ProjectDescriptor |
getDescriptorForVersion(ProjectDescriptor projectDescriptor,
IVersionDescriptor versionDescriptor)
Get descriptor for specific version.
|
static long |
getLastVersion(ProjectDescriptor descriptor)
Get last project version number.
|
static ILockProjectService |
getLockService(Project project)
Provides api to check, request and release locks on various project data.
|
static java.lang.String |
getLoggedUserName()
Returns the currently logged ESI user name.
|
static java.util.Set<java.lang.String> |
getLoggedUserNames()
Get logged in users if current user has rights to access user list.
|
static java.util.Collection<ProjectDescriptor> |
getProjectDescriptorsWithBranches(java.lang.Iterable<ProjectDescriptor> projectDescriptors)
Invocation of this method returns a
Collection of ProjectDescriptor s of each
branch in the given projectDescriptors . |
static void |
getProjectDescriptorsWithBranches(ProjectDescriptor descriptor,
java.util.Collection<ProjectDescriptor> descriptorsWithBranches)
Collects all project descriptors with branch info for the given project descriptor into the provided collection.
|
static java.lang.String |
getProjectName(org.eclipse.emf.common.util.URI locationURI)
Return project name for given URI.
|
static java.util.List<ProjectDescriptor> |
getRemoteProjectDescriptors()
Returns descriptors of projects stored on server.
|
static ITeamworkService |
getTeamworkService()
Get service for working with CEDW.
|
static java.util.Set<java.lang.String> |
getUserNames()
Get all users if current user has rights to access user list.
|
static java.util.List<IVersionDescriptor> |
getVersions(ProjectDescriptor descriptor)
Get all versions of given project.
|
static boolean |
isNotifyOnNew(Project project,
IAttachedProject iAttachedProject)
Method returns if MagicDraw should notify about available project usage update.
|
static void |
removeCommitTags(ProjectDescriptor descriptor,
long version)
Remove all tags from project version.
|
static void |
setNotifyOnNew(Project project,
IAttachedProject iAttachedProject,
boolean notifyOnNew)
Method sets if MagicDraw should notify about available project usage update.
|
static void |
setProjectName(ProjectDescriptor project,
java.lang.String newName)
Rename project.
|
static void |
updateModule(Project project,
IAttachedProject module,
ProjectDescriptor descriptor,
long version)
Change given module to another version or branch.
|
static void |
updateProject(Project project)
Updates given project.
|
static java.util.Map<IAttachedProject,java.lang.Boolean> |
updateRequiredProjectUsages(Project project)
This method updates project usages to newest version.
|
public static ITeamworkService getTeamworkService()
@CheckForNull public static ILockProjectService getLockService(@CheckForNull Project project)
@CheckForNull public static Project createProject(@Nonnull java.lang.String name, @CheckForNull java.lang.String category) throws com.nomagic.ci.persistence.PersistenceException
name
- project name.category
- project category.com.nomagic.ci.persistence.PersistenceException
public static void commitProject(Project project, java.lang.String comment, @CheckForNull java.util.Collection<Element> unlockElements, @CheckForNull java.util.Collection<ModuleUsage> unlockModules, boolean unlockDecomposition, @CheckForNull java.util.List<java.lang.String> tags)
project
- projectcomment
- comment.unlockElements
- elements to unlock when committing.unlockModules
- modules to unlock when committing.unlockDecomposition
- true if decomposition needs to be unlocked when committing.tags
- version tags to set.@CheckForNull public static IAttachedProject exportEsiModule(Project project, java.util.Collection<Package> packages, java.lang.String description, java.lang.String moduleName) throws java.lang.Exception
project
- project.packages
- packages to export.description
- module description.moduleName
- name of module.java.lang.Exception
- in case of some problempublic static java.util.List<ProjectDescriptor> getRemoteProjectDescriptors() throws java.lang.Exception
java.rmi.RemoteException
- in case of some problemjava.lang.Exception
public static java.util.List<IVersionDescriptor> getVersions(@Nonnull ProjectDescriptor descriptor)
descriptor
- project descriptor.public static void addCommitTags(java.util.List<java.lang.String> tags, ProjectDescriptor descriptor, long version)
tags
- tags to add.descriptor
- project for which version tags is set.version
- version for which tags will be added.public static java.util.List<java.lang.String> getCommitTags(ProjectDescriptor descriptor, long version)
descriptor
- project descriptor.version
- version.public static java.util.List<com.nomagic.esi.api.info.TagInfo> getCommitTagsInfo(ProjectDescriptor descriptor, long version)
descriptor
- project descriptor.version
- version.public static java.util.List<com.nomagic.esi.api.info.TagInfo> getAllCommitTagsInfo(ProjectDescriptor descriptor)
descriptor
- project descriptor.public static void removeCommitTags(ProjectDescriptor descriptor, long version)
descriptor
- project descriptor.version
- version.public static void updateProject(Project project)
project
- teamwork project to update.@CheckForNull public static java.lang.String getProjectName(org.eclipse.emf.common.util.URI locationURI)
locationURI
- project location.public static void setProjectName(ProjectDescriptor project, java.lang.String newName) throws com.nomagic.ci.persistence.PersistenceException
project
- project descriptornewName
- new project name.com.nomagic.ci.persistence.PersistenceException
- in case of some problempublic static void deleteProject(ProjectDescriptor project) throws com.nomagic.ci.persistence.PersistenceException
project
- project to delete.com.nomagic.ci.persistence.PersistenceException
public static java.util.Set<com.nomagic.teamwork.common.projects.CategoryInfo> getCategories()
public static java.util.Map<java.lang.String,java.util.List<ProjectDescriptor>> getCategoriesToProjects() throws java.lang.Exception
java.lang.Exception
- in case of some problem@CheckForNull public static java.lang.String getCategoryID(java.lang.String resourceID)
resourceID
- twc project resource IDnull
if project is not in categorypublic static void createCategory(java.lang.String name, java.lang.String description)
name
- category namedescription
- category descriptionpublic static void assignProjectToCategory(ProjectDescriptor project, java.lang.String... categories) throws java.lang.Exception
project
- project to assign or remove from category.categories
- categories to which project will be assigned.java.lang.Exception
- in case of some problempublic static void deleteCategory(java.lang.String name)
name
- category name.public static java.util.Collection<EsiUtils.EsiBranchInfo> getBranches(ProjectDescriptor descriptor)
descriptor
- project descriptor.public static void createBranch(ProjectDescriptor descriptor, long version, java.lang.String branchName, java.lang.String branchDescription)
descriptor
- project descriptor.version
- version from which branchbranchName
- new branch name.branchDescription
- description of new branch.java.lang.RuntimeException
- in case network or server error occurs when creating branch.InsufficientPermissionsException
- if currently logged in user does not have Administer Projects permissionpublic static ProjectDescriptor getDescriptorByBranchID(ProjectDescriptor project, java.util.UUID branchID)
project
- project descriptor.branchID
- branch id.public static ProjectDescriptor getDescriptorForBranch(ProjectDescriptor project, java.lang.String branchName)
project
- project descriptor.branchName
- branch name.public static ProjectDescriptor getDescriptorForVersion(ProjectDescriptor projectDescriptor, IVersionDescriptor versionDescriptor)
projectDescriptor
- project descriptor.versionDescriptor
- version.public static void deleteBranch(ProjectDescriptor descriptor, java.lang.String branchName)
descriptor
- project which branch will be deleted.branchName
- branch name to delete.InsufficientPermissionsException
- if currently logged in user does not have Administer Projects permissionpublic static IPrimaryProject addToESI(Project project, java.lang.String esiProjectName) throws com.nomagic.ci.persistence.PersistenceException
project
- project to add.esiProjectName
- project name in esi server.com.nomagic.ci.persistence.PersistenceException
- in case of some problempublic static IPrimaryProject addToESI(Project project, java.lang.String esiProjectName, @CheckForNull java.lang.String category, @CheckForNull java.lang.String comment, @CheckForNull java.util.List<java.lang.String> tags, @Nonnull java.util.Collection<ResolveLocalModuleInfo> resolveInfos) throws com.nomagic.ci.persistence.PersistenceException
project
- the project to addesiProjectName
- the name for the new ESI projectcategory
- the category to add the project tocomment
- the commit commenttags
- the commit tagsresolveInfos
- the module resolve info listcom.nomagic.ci.persistence.PersistenceException
- exception if add fails@CheckForNull public static Project convertToLocal(Project project, java.io.File file)
project
- project to convertfile
- project file@CheckForNull public static java.lang.String getLoggedUserName()
public static java.util.Set<java.lang.String> getLoggedUserNames()
public static java.util.Set<java.lang.String> getUserNames()
public static void updateModule(Project project, IAttachedProject module, ProjectDescriptor descriptor, long version) throws java.lang.Exception
project
- project which module is switched.module
- module to switch.descriptor
- new module descriptor.version
- new module versionjava.lang.Exception
- in case of some problempublic static void setNotifyOnNew(Project project, IAttachedProject iAttachedProject, boolean notifyOnNew)
project
- Project to which's usage setting is applied.iAttachedProject
- Usage's attached project to which setting is applied.notifyOnNew
- Should notification be shown.public static boolean isNotifyOnNew(Project project, IAttachedProject iAttachedProject)
false
by default.project
- Project to which's usage setting is applied.iAttachedProject
- Usage's attached project to which setting is applied.false
by default.public static java.util.Map<IAttachedProject,java.lang.Boolean> updateRequiredProjectUsages(Project project) throws java.lang.Exception
isNotifyOnNew(Project, IAttachedProject)
set to true
are updated. It can be changed using setNotifyOnNew(Project, IAttachedProject, boolean)
. If project
usages is locked by other user or can't be updated for other reasons its update will be skipped.project
- Project which usages are updated.java.lang.Exception
- in case of some problemisNotifyOnNew(Project, IAttachedProject)
,
setNotifyOnNew(Project, IAttachedProject, boolean)
public static EsiUtils.ApplyProjectStateResult applyProjectState(Project source, Project target) throws java.lang.IllegalArgumentException, ElementLockAcquisitionException, ModuleUsageLockAcquisitionException, OptionsLockAcquisitionException
source
- the source project from which the state is copiedtarget
- the target project to which the state is copiedjava.lang.IllegalArgumentException
- if: 1. the projects are the same, 2. any of the projects are
not ready, 3. any of the projects is not an ESI project, 4. the project IDs
differ, 5. the target project is not editableElementLockAcquisitionException
- if specific element could not be lockedModuleUsageLockAcquisitionException
- if specific module usage could not be lockedOptionsLockAcquisitionException
- if specific options could not be lockedpublic static long getLastVersion(ProjectDescriptor descriptor)
descriptor
- project descriptor for ESI server project.java.lang.RuntimeException
- in case provided descriptor is not valid for current server.public static java.util.Collection<ProjectDescriptor> getProjectDescriptorsWithBranches(java.lang.Iterable<ProjectDescriptor> projectDescriptors)
Collection
of ProjectDescriptor
s of each
branch in the given projectDescriptors
.projectDescriptors
- descriptors of the projects, whose branch ProjectDescriptor
s should
be returnedprojectDescriptors
public static void getProjectDescriptorsWithBranches(ProjectDescriptor descriptor, java.util.Collection<ProjectDescriptor> descriptorsWithBranches)
descriptor
- project descriptor for which to collect project descriptors with branch infodescriptorsWithBranches
- collection where to add the resultpublic static java.util.UUID getBranchID(org.eclipse.emf.common.util.URI locationURI)
locationURI
- project location URI@CheckForNull public static EsiUtils.EsiBranchInfo getCurrentBranch(IProject project)
null
will be returned.project
- project part