@OpenApi
public class TeamworkUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static boolean |
addProjectToTeamwork(Project project,
java.lang.String name,
java.lang.String path,
java.lang.String category,
java.lang.String comment,
java.util.List<java.lang.String> tags,
java.util.Collection<ResolveLocalModuleInfo> resolveInfos)
Add local project to teamwork.
|
static boolean |
authenticate(java.lang.String server,
int port,
boolean secure,
java.lang.String user,
java.lang.String password)
Authenticate to the Teamwork Server.
|
static java.util.Map<java.lang.String,java.lang.String> |
branchProject(ProjectDescriptor projectDescriptor,
java.util.Set<java.lang.String> modules,
java.lang.String branchName,
java.lang.String comment)
Create branch for project.
|
static void |
changeModuleBranch(ModuleUsage usage,
java.lang.String moduleBranchQualifiedName,
int versionNumber,
ProgressStatus progressStatus)
Change used module branch.
|
static boolean |
commitProject(Project project,
java.lang.String comment)
Commit project.
|
static boolean |
commitProject(Project project,
java.lang.String comment,
java.util.List<java.lang.String> tags,
java.util.Collection<Element> unlockElements,
java.util.Collection<ModuleUsage> unlockModules)
Commit project.
|
static void |
convertToLocal(Project project,
java.io.File projectFile)
Convert(save) teamwork project to local project.
|
static java.lang.String |
createCategory(java.lang.String categoryName)
Creates project category with the given name.
|
static ProjectDescriptor |
createTeamworkProject(java.lang.String name,
java.lang.String path,
java.lang.String category)
Create teamwork project.
|
static void |
deleteCategory(java.lang.String categoryID)
Deletes the given category, however projects assigned to the given category
are retained.
|
static void |
exportTeamworkModule(Project project,
java.util.Collection packages,
java.lang.String moduleQualifiedName)
|
static void |
exportTeamworkModule(Project project,
java.util.Collection packages,
java.lang.String description,
java.lang.String moduleQualifiedName)
Exports teamwork module.
|
static java.lang.String |
generateProjectQualifiedName(java.lang.String projectName,
java.lang.String[] branches)
Creates unique qualified name from project name and it's branch path.
|
static BranchData |
getBranchedFrom(ProjectDescriptor projectDescriptor)
Get info the project is branched from.
|
static java.util.Set<BranchData> |
getBranches(ProjectDescriptor projectDescriptor)
Get all project branches.
|
static java.util.Map<java.lang.String,java.lang.String> |
getCategories()
Gets remote project categories from the Teamwork server.
|
static java.lang.String |
getCategoryIDByName(java.lang.String categoryName)
Finds ID of the category by the given name.
|
static java.util.Collection<RemoteProjectDescriptor> |
getCategoryProjects(java.lang.String categoryID)
Gets all projects that belong to given category.
|
static int |
getLastVersion(ProjectDescriptor descriptor)
Get last project version number.
|
static java.util.Collection<Element> |
getLockedElement(Project project,
java.lang.String user)
Returns a collection of locked elements.
|
static java.util.Collection<ModuleUsage> |
getLockedModules(Project project,
java.lang.String user)
Returns a collection of locked modules.
|
static java.lang.String |
getLoggedUserName()
Returns the currently logged teamwork 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.lang.String |
getProjectCategory(RemoteProjectDescriptor project)
Gets the project category that the project belongs to.
|
static ProjectDescriptor |
getRemoteProjectDescriptor(java.lang.String projectID)
Returns remote project descriptor for given project id.
|
static ProjectDescriptor |
getRemoteProjectDescriptorByQualifiedName(java.lang.String qualifiedName)
Returns remote (teamwork) project descriptor.
|
static java.util.List |
getRemoteProjectDescriptors()
Returns descriptors of projects stored on server.
|
static java.lang.String |
getRemoteProjectIDByQualifiedName(java.lang.String qualifiedName)
Returns remote project id for given project name.
|
static java.util.List<java.lang.String> |
getTags(ProjectDescriptor descriptor,
int versionNumber)
Get tags of given project version.
|
static java.util.Map<java.lang.String,java.lang.Integer> |
getUsedModules(ProjectDescriptor descriptor,
boolean directlyUsedOnly)
Get modules being used by given project.
|
static java.util.Set<java.lang.String> |
getUserNames()
Get all users if current user has rights to access user list.
|
static java.util.List<VersionData> |
getVersions(ProjectDescriptor descriptor)
Get list of teamwork project (or branch) versions.
|
static boolean |
lockElement(Project project,
BaseElement element,
boolean recursively)
|
static boolean |
lockElement(Project project,
Element element,
boolean recursively)
Locks given element.
|
static boolean |
login(java.lang.String server,
int port,
java.lang.String user,
java.lang.String password)
Deprecated.
|
static com.nomagic.teamwork.common.users.SessionInfo |
loginWithSession(java.lang.String server,
int port,
boolean secure,
java.lang.String user,
java.lang.String password)
Login to the teamwork server.
|
static com.nomagic.teamwork.common.users.SessionInfo |
loginWithSession(java.lang.String server,
int port,
java.lang.String user,
java.lang.String password)
Deprecated.
|
static boolean |
logout()
Logout current/active user from teamwork server.
|
static void |
openModuleAsProject(ProjectDescriptor descriptor)
Opens module as project.
|
static void |
removeTeamworkProject(ProjectDescriptor projectDescriptor)
Remove teamwork project.
|
static void |
setCategoryName(java.lang.String categoryID,
java.lang.String categoryName)
Sets the new name for the given category.
|
static void |
setProjectCategory(RemoteProjectDescriptor project,
java.lang.String categoryID)
Assigns the project to the given category.
|
static void |
setTags(ProjectDescriptor descriptor,
java.util.List<java.lang.String> tags,
int versionNumber)
Set tags for given project version.
|
static ProjectDescriptor |
setTeamworkProjectBranchName(ProjectDescriptor projectDescriptor,
java.lang.String name)
Set teamwork project branch name.
|
static ProjectDescriptor |
setTeamworkProjectName(ProjectDescriptor projectDescriptor,
java.lang.String name)
Set teamwork project name.
|
static void |
unlockElement(Project project,
BaseElement element,
boolean recursively,
boolean discard)
|
static void |
unlockElement(Project project,
BaseElement element,
boolean recursively,
boolean discard,
boolean silent)
|
static void |
unlockElement(Project project,
Element element,
boolean recursively,
boolean discard)
Unlock given element.
|
static void |
unlockElement(Project project,
Element element,
boolean recursively,
boolean discard,
boolean silent)
Unlock given element.
|
static void |
updateProject(Project project)
Updates given teamwork project project.
|
@OpenApi @Deprecated public static void exportTeamworkModule(Project project, java.util.Collection packages, java.lang.String moduleQualifiedName) throws java.lang.Exception
exportTeamworkModule(com.nomagic.magicdraw.core.Project, java.util.Collection, String, String)
project
- project.packages
- packages to export.moduleQualifiedName
- qualified teamwork module (project) name.java.lang.Exception
- in case of some problem@OpenApi public static void exportTeamworkModule(Project project, java.util.Collection packages, java.lang.String description, java.lang.String moduleQualifiedName) throws java.lang.Exception
project
- project.packages
- packages to export.description
- module description.moduleQualifiedName
- qualified teamwork module (project) name.java.lang.Exception
- in case of some problem@OpenApi public static java.util.List getRemoteProjectDescriptors() throws java.rmi.RemoteException
java.rmi.RemoteException
- in case of some problem@OpenApi @CheckForNull public static ProjectDescriptor getRemoteProjectDescriptor(java.lang.String projectID) throws java.rmi.RemoteException
projectID
- project id.java.rmi.RemoteException
- in case of some problem@OpenApi @CheckForNull public static java.lang.String getRemoteProjectIDByQualifiedName(java.lang.String qualifiedName) throws java.rmi.RemoteException
qualifiedName
- Teamwork Project qualified name, unique name constructed from project name and it's branches.
Examples:
"MyProject" with no branches = "MyProject"
"MyProject" branch ["release"] = "MyProject##release"
"MyProject" branch with subbranch ["release", "sp1"] = "MyProject##release##sp1"java.rmi.RemoteException
- in case of some problemgenerateProjectQualifiedName(String, String[])
@OpenApi public static java.lang.String generateProjectQualifiedName(java.lang.String projectName, java.lang.String[] branches)
projectName
- Teamwork Project namebranches
- branch name path. Array is constructed in this way:
[project branch, project branch subbranch, project branch subbranch subbranch ..., active branch]@CheckForNull @OpenApi public static ProjectDescriptor getRemoteProjectDescriptorByQualifiedName(java.lang.String qualifiedName) throws java.rmi.RemoteException
qualifiedName
- Teamwork Project qualified name, unique name constructed from project name and it's branches.
E.g:
"MyProject" with no branches = "MyProject"java.rmi.RemoteException
- in case of some problemgenerateProjectQualifiedName(String, String[])
@OpenApi public static void openModuleAsProject(ProjectDescriptor descriptor)
descriptor
- module project descriptor.com.nomagic.magicdraw.core.project.ProjectsManager#loadProject(com.nomagic.magicdraw.core.project.ProjectDescriptor, boolean)}
@OpenApi @CheckForNull public static java.util.List<VersionData> getVersions(@Nonnull ProjectDescriptor descriptor) throws java.rmi.RemoteException
descriptor
- project descriptor.java.rmi.RemoteException
- in case of some problem@OpenApi @CheckForNull public static java.util.List<java.lang.String> getTags(@Nonnull ProjectDescriptor descriptor, int versionNumber) throws java.rmi.RemoteException
descriptor
- project descriptor.versionNumber
- version number, or -1 to get last version tags.java.rmi.RemoteException
- in case of some problem@OpenApi public static void setTags(@Nonnull ProjectDescriptor descriptor, java.util.List<java.lang.String> tags, int versionNumber) throws java.rmi.RemoteException
descriptor
- project descriptor.tags
- list of tags to set.versionNumber
- version number, or -1 to set tags for last version.java.rmi.RemoteException
- in case of some problem@OpenApi @CheckForNull public static java.util.Map<java.lang.String,java.lang.Integer> getUsedModules(ProjectDescriptor descriptor, boolean directlyUsedOnly) throws java.rmi.RemoteException
descriptor
- project descriptor.directlyUsedOnly
- true - get only modules used directly by project, false - get all modules used by project and modules.java.rmi.RemoteException
- in case of some problem@OpenApi public static int getLastVersion(@Nonnull ProjectDescriptor descriptor) throws java.rmi.RemoteException
descriptor
- project descriptor.java.rmi.RemoteException
- in case of some problem@OpenApi @Deprecated public static boolean lockElement(Project project, BaseElement element, boolean recursively)
lockElement(com.nomagic.magicdraw.core.Project, com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element, boolean)
project
- project that locks element.element
- element to lock.recursively
- lock owned elements recursively.@OpenApi @Deprecated public static void unlockElement(Project project, BaseElement element, boolean recursively, boolean discard)
unlockElement(com.nomagic.magicdraw.core.Project, com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element, boolean, boolean)
project
- project that locked element.element
- element to unlock.recursively
- unlock owned elements recursively.discard
- discard changes, if false project will be committed.@OpenApi public static boolean lockElement(Project project, Element element, boolean recursively)
project
- project that locks element.element
- element to lock.recursively
- lock owned elements recursively.@OpenApi public static void unlockElement(Project project, Element element, boolean recursively, boolean discard)
project
- project that locked element.element
- element to unlock.recursively
- unlock owned elements recursively.discard
- discard changes, if false project will be committed.@OpenApi @Deprecated public static void unlockElement(Project project, BaseElement element, boolean recursively, boolean discard, boolean silent)
unlockElement(com.nomagic.magicdraw.core.Project, com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element, boolean, boolean, boolean)
project
- project that locked element.element
- element to unlock.recursively
- unlock owned elements recursively.discard
- discard changes, if false project will be committed.silent
- true if no UI should be shown while executing method.@OpenApi public static void unlockElement(Project project, Element element, boolean recursively, boolean discard, boolean silent)
project
- project that locked element.element
- element to unlock.recursively
- unlock owned elements recursively.discard
- discard changes, if false project will be committed.silent
- true if no UI should be shown while executing method.@OpenApi public static java.util.Collection<Element> getLockedElement(@Nonnull Project project, @CheckForNull java.lang.String user)
project
- project.user
- locked by the user, or null to get the all locked elements.@OpenApi public static java.util.Collection<ModuleUsage> getLockedModules(Project project, java.lang.String user)
project
- project.user
- locked by the user, or null to get the all locked elements.@OpenApi public static boolean commitProject(@Nonnull Project project, @CheckForNull java.lang.String comment)
project
- projectcomment
- comment.java.lang.IllegalStateException
- if given project uses local modules.@OpenApi public static boolean commitProject(@Nonnull Project project, @CheckForNull java.lang.String comment, @CheckForNull java.util.List<java.lang.String> tags, @CheckForNull java.util.Collection<Element> unlockElements, @CheckForNull java.util.Collection<ModuleUsage> unlockModules)
project
- projectcomment
- comment.tags
- tags to set.unlockElements
- collection of elements to unlock.unlockModules
- collection of modules to unlock.java.lang.IllegalStateException
- if given project uses local modules.@OpenApi public static void updateProject(Project project)
project
- teamwork project to update.@OpenApi @CheckForNull public static ProjectDescriptor createTeamworkProject(@Nonnull java.lang.String name, @CheckForNull java.lang.String path, @CheckForNull java.lang.String category) throws java.rmi.RemoteException
name
- project name.path
- project path, null for Native (default) repository Teamwork server.category
- project category.java.rmi.RemoteException
- in case of some problem@OpenApi @CheckForNull public static ProjectDescriptor setTeamworkProjectName(@Nonnull ProjectDescriptor projectDescriptor, @Nonnull java.lang.String name) throws java.rmi.RemoteException, java.lang.IllegalArgumentException
projectDescriptor
- project to rename.name
- new name.java.rmi.RemoteException
- in case of some problemjava.lang.IllegalArgumentException
- if project with given name already exists.@OpenApi @CheckForNull public static ProjectDescriptor setTeamworkProjectBranchName(@Nonnull ProjectDescriptor projectDescriptor, @Nonnull java.lang.String name) throws java.rmi.RemoteException, java.lang.IllegalArgumentException
projectDescriptor
- branched project to rename branch.name
- new name.java.rmi.RemoteException
- in case of some problemjava.lang.IllegalArgumentException
- if project branch with given name already exists, if given descriptor does not represent branched project.@OpenApi public static void removeTeamworkProject(ProjectDescriptor projectDescriptor) throws java.rmi.RemoteException
projectDescriptor
- teamwork project descriptor.java.rmi.RemoteException
- in case of some problem@OpenApi @CheckForNull public static java.util.Map<java.lang.String,java.lang.String> branchProject(@Nonnull ProjectDescriptor projectDescriptor, @CheckForNull java.util.Set<java.lang.String> modules, @Nonnull java.lang.String branchName, @CheckForNull java.lang.String comment) throws java.rmi.RemoteException
projectDescriptor
- project descriptor to create branch for.modules
- ids of modules to branch with project (null - all used modules are branched too, empty set - no modules branched)branchName
- name of the branch.comment
- commentjava.rmi.RemoteException
- in case of some problem@OpenApi @CheckForNull public static java.util.Set<BranchData> getBranches(ProjectDescriptor projectDescriptor) throws java.rmi.RemoteException
projectDescriptor
- project descriptor.java.rmi.RemoteException
- in case of some problem@OpenApi @CheckForNull public static BranchData getBranchedFrom(ProjectDescriptor projectDescriptor) throws java.rmi.RemoteException
projectDescriptor
- project descriptor.java.rmi.RemoteException
- in case of some problem@OpenApi public static void changeModuleBranch(ModuleUsage usage, java.lang.String moduleBranchQualifiedName, int versionNumber, ProgressStatus progressStatus) throws java.lang.Exception
usage
- module usage.moduleBranchQualifiedName
- module branch qualified name.progressStatus
- progress status.java.lang.Exception
- exception.@OpenApi public static boolean addProjectToTeamwork(@Nonnull Project project, @Nonnull java.lang.String name, @CheckForNull java.lang.String path, @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 java.lang.Exception
project
- project.name
- teamwork project name.path
- repository path.category
- categorycomment
- comment.tags
- tags.resolveInfos
- local module resolve info.java.lang.Exception
- exception.@OpenApi public static void convertToLocal(@Nonnull Project project, @Nonnull java.io.File projectFile) throws java.lang.Exception
project
- teamwork project to convert to local project.projectFile
- file to save project.java.lang.IllegalArgumentException
- if project is not teamwork project.java.lang.Exception
@OpenApi @CheckForNull public static java.lang.String getLoggedUserName()
@OpenApi public static java.util.Set<java.lang.String> getUserNames()
@OpenApi public static java.util.Set<java.lang.String> getLoggedUserNames()
@OpenApi @Deprecated public static boolean login(java.lang.String server, int port, java.lang.String user, java.lang.String password)
loginWithSession(String, int, String, String)
server
- server address.port
- server port (-1 to use default port).user
- user to login.password
- user password.@CheckForNull @OpenApi @Deprecated public static com.nomagic.teamwork.common.users.SessionInfo loginWithSession(java.lang.String server, int port, java.lang.String user, java.lang.String password)
loginWithSession(String, int, boolean, String, String)
server
- server address.port
- server port (-1 to use default port).user
- user to login.password
- user password.@CheckForNull @OpenApi public static com.nomagic.teamwork.common.users.SessionInfo loginWithSession(java.lang.String server, int port, boolean secure, java.lang.String user, java.lang.String password)
server
- server address.port
- server port (-1 to use default port).secure
- Use SSL connection type.user
- user to login.password
- user password.@OpenApi public static boolean authenticate(java.lang.String server, int port, boolean secure, java.lang.String user, java.lang.String password)
server
- server address.port
- server port (-1 to use default port).secure
- Use SSL connection type.user
- user to login.password
- user password.@OpenApi public static boolean logout()
@OpenApi public static java.util.Map<java.lang.String,java.lang.String> getCategories() throws java.rmi.RemoteException
java.rmi.RemoteException
- connection problems with Teamwork server.@OpenApi public static java.util.Collection<RemoteProjectDescriptor> getCategoryProjects(java.lang.String categoryID) throws java.rmi.RemoteException
categoryID
- the category IDjava.rmi.RemoteException
- connection problems with Teamwork server or category with given
ID does not exist.@OpenApi @CheckForNull public static java.lang.String getCategoryIDByName(java.lang.String categoryName) throws java.rmi.RemoteException
categoryName
- category name.java.rmi.RemoteException
- connection problems with Teamwork server.@OpenApi public static java.lang.String createCategory(java.lang.String categoryName) throws java.rmi.RemoteException
categoryName
- the new category namejava.rmi.RemoteException
- connection problems with Teamwork server or
when category already exists with the given name or the user has no
sufficient permissions to create a category.@OpenApi public static void setCategoryName(java.lang.String categoryID, java.lang.String categoryName) throws java.rmi.RemoteException
categoryID
- the category to renamecategoryName
- the new category namejava.rmi.RemoteException
- connection problems with Teamwork server or
when category already exists with the given name or user has no
sufficient permissions to rename a category.@OpenApi public static void deleteCategory(java.lang.String categoryID) throws java.rmi.RemoteException
categoryID
- ID of the category to deletejava.rmi.RemoteException
- connection problems with Teamwork server or the
user has no sufficient permissions to delete a category.@OpenApi @CheckForNull public static java.lang.String getProjectCategory(RemoteProjectDescriptor project) throws java.rmi.RemoteException
project
- given projectjava.rmi.RemoteException
- connection problems with Teamwork server@OpenApi public static void setProjectCategory(RemoteProjectDescriptor project, java.lang.String categoryID) throws java.rmi.RemoteException
project
- given projectcategoryID
- id of the categoryjava.rmi.RemoteException
- connection problems with Teamwork server or the
user has no sufficient permissions to assign a project to a category.