Package com.nomagic.magicdraw.teamwork2
Class TeamworkService
- java.lang.Object
-
- com.nomagic.magicdraw.teamwork2.TeamworkService
-
- All Implemented Interfaces:
ITeamworkService
@OpenApiAll public abstract class TeamworkService extends java.lang.Object implements ITeamworkService
Implementation of teamwork service.
-
-
Field Summary
-
Fields inherited from interface com.nomagic.magicdraw.teamwork2.ITeamworkService
ESI_SERVICE
-
-
Constructor Summary
Constructors Constructor Description TeamworkService()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract boolean
autoLoginFromOptions(ProgressStatus status)
Auto logs into last successful server using last successful input data.boolean
autoLoginOnTask(java.util.function.Consumer<Task> taskRunner)
Auto logs into last successful server using last successful input data with task runnerstatic ITeamworkService
getActiveInstance()
Returns active server service, according to current connected state.static ITeamworkService
getInstance(Project project)
Returns server service, according to current project.static ITeamworkService
getInstance(java.lang.String id)
Return instance by service id.ServerLoginInfo
getLastUsedLoginInfo()
Returns list of input data, which was entered on last successful connection.protected TeamworkOptionsGroup
getTeamworkOptions()
com.nomagic.ci.persistence.versioning.IVersionDescriptor
getVersion(Project project)
Current versions of given projectboolean
login(boolean useLastLoginData)
Logs into last successful server using last successful input data.void
login(ServerLoginInfo info, boolean encryptPassword)
Login with given dataprotected abstract boolean
loginFromOptions(java.util.Map<java.lang.String,java.lang.Boolean> options, ProgressStatus status)
Logs into last successful server using last successful input data.protected boolean
loginOnTask(java.util.Map<java.lang.String,java.lang.Boolean> options)
boolean
loginOnTask(java.util.Map<java.lang.String,java.lang.Boolean> options, java.util.function.Consumer<Task> taskRunner)
static ITeamworkService
setActiveInstance(ITeamworkService activeTeamworkService)
Set active Teamwork Service instance.void
setLastUsedTeamworkInfo(ServerLoginInfo info, boolean encryptPassword)
Saves given input data, as last successful user connection info.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.nomagic.magicdraw.teamwork2.ITeamworkService
getConnectedUser, getProjectDescriptorById, getProjectDescriptorByQualifiedName, getProjectDescriptors, getProjectIdByQualifiedName, getServiceID, getVersions, isConnected, isLiveConnection, logout, setAsLastUsedService
-
-
-
-
Method Detail
-
getInstance
@Nonnull public static ITeamworkService getInstance(@Nonnull java.lang.String id)
Return instance by service id.- Parameters:
id
- service id- Returns:
- service instance or null
-
setActiveInstance
@CheckForNull public static ITeamworkService setActiveInstance(@CheckForNull ITeamworkService activeTeamworkService)
Set active Teamwork Service instance. If set to null uses first found connected instance (default behavior).- Parameters:
activeTeamworkService
- active service- Returns:
- old active instance
-
getActiveInstance
@CheckForNull public static ITeamworkService getActiveInstance()
Returns active server service, according to current connected state. - whether it connected (to MU or CI) or not.- Returns:
- if it is connected to MU server, returns Teamwork service, if to Cameo Team server, returns cameo service.
-
getInstance
@CheckForNull public static ITeamworkService getInstance(Project project)
Returns server service, according to current project.- Parameters:
project
- project- Returns:
- if it is teamwork server project, returns Teamwork service, if Cameo Team server project, returns cameo service.
-
login
public final boolean login(boolean useLastLoginData)
Description copied from interface:ITeamworkService
Logs into last successful server using last successful input data.- Specified by:
login
in interfaceITeamworkService
- Parameters:
useLastLoginData
- true use last login data, false - specify new login data.- Returns:
- return true if log-in was successful.
- See Also:
ITeamworkService.setLastUsedTeamworkInfo(ServerLoginInfo, boolean)
-
loginOnTask
protected boolean loginOnTask(@CheckForNull java.util.Map<java.lang.String,java.lang.Boolean> options)
-
loginOnTask
public boolean loginOnTask(@CheckForNull java.util.Map<java.lang.String,java.lang.Boolean> options, java.util.function.Consumer<Task> taskRunner)
-
autoLoginOnTask
public boolean autoLoginOnTask(java.util.function.Consumer<Task> taskRunner)
Auto logs into last successful server using last successful input data with task runner- Parameters:
taskRunner
- runs auto login task- Returns:
- return true if log-in was successful.
-
loginFromOptions
protected abstract boolean loginFromOptions(@CheckForNull java.util.Map<java.lang.String,java.lang.Boolean> options, ProgressStatus status)
Logs into last successful server using last successful input data.- Parameters:
options
- options.status
- progress status- Returns:
- return true if log-in was successful.
-
autoLoginFromOptions
protected abstract boolean autoLoginFromOptions(ProgressStatus status)
Auto logs into last successful server using last successful input data.- Parameters:
status
- progress status- Returns:
- return true if log-in was successful.
-
getTeamworkOptions
protected TeamworkOptionsGroup getTeamworkOptions()
-
login
public void login(@Nonnull ServerLoginInfo info, boolean encryptPassword)
Description copied from interface:ITeamworkService
Login with given data- Specified by:
login
in interfaceITeamworkService
- Parameters:
info
- login infoencryptPassword
- encrypt password from given info
-
setLastUsedTeamworkInfo
public void setLastUsedTeamworkInfo(@Nonnull ServerLoginInfo info, boolean encryptPassword)
Description copied from interface:ITeamworkService
Saves given input data, as last successful user connection info.- Specified by:
setLastUsedTeamworkInfo
in interfaceITeamworkService
- Parameters:
info
- login infoencryptPassword
- encrypt password from given info
-
getLastUsedLoginInfo
public ServerLoginInfo getLastUsedLoginInfo()
Description copied from interface:ITeamworkService
Returns list of input data, which was entered on last successful connection. Array of: login username, pass, servername.- Specified by:
getLastUsedLoginInfo
in interfaceITeamworkService
- Returns:
- array of username, pass, servername.
-
getVersion
public com.nomagic.ci.persistence.versioning.IVersionDescriptor getVersion(@Nonnull Project project)
Description copied from interface:ITeamworkService
Current versions of given project- Specified by:
getVersion
in interfaceITeamworkService
- Parameters:
project
- project- Returns:
- versions
-
-