Class TeamworkService

  • All Implemented Interfaces:
    ITeamworkService

    @OpenApiAll
    public abstract class TeamworkService
    extends java.lang.Object
    implements ITeamworkService
    Implementation of teamwork service.
    • Constructor Detail

      • TeamworkService

        public TeamworkService()
    • 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.
      • 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.
      • login

        public void login​(@Nonnull
                          ServerLoginInfo info,
                          boolean encryptPassword)
        Description copied from interface: ITeamworkService
        Login with given data
        Specified by:
        login in interface ITeamworkService
        Parameters:
        info - login info
        encryptPassword - 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 interface ITeamworkService
        Parameters:
        info - login info
        encryptPassword - 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 interface ITeamworkService
        Returns:
        array of username, pass, servername.