Class EsiUtils


  • @OpenApiAll
    public class EsiUtils
    extends java.lang.Object
    API to work with Teamwork Cloud server. Before working with users and projects there must be established connection to Teamwork Cloud server. Connection is established with this code:


    EsiUtils.getTeamworkService().login(new ServerLoginInfo("localhost", "user", "password", false), false);

    • Field Detail

      • mProjectRepository

        private static final com.nomagic.magicdraw.esi.project.project.EsiProjectRepository mProjectRepository
      • NOTIFY_TAG_SEPARATOR

        private static final java.lang.String NOTIFY_TAG_SEPARATOR
    • Constructor Detail

      • EsiUtils

        public EsiUtils()
    • Method Detail

      • getTeamworkService

        public static ITeamworkService getTeamworkService()
        Get service for working with Teamwork Cloud.
        Returns:
        service for working with Teamwork Cloud.
      • getLockService

        @CheckForNull
        public static ILockProjectService getLockService​(@CheckForNull
                                                         Project project)
        Provides api to check, request and release locks on various project data.
        Returns:
        lock service.
      • createProject

        @CheckForNull
        public static Project createProject​(@Nonnull
                                            java.lang.String name,
                                            @CheckForNull
                                            java.lang.String category)
                                     throws com.nomagic.ci.persistence.PersistenceException
        Create Teamwork Cloud project. Project is created only if currently logged user rights allows to create projects.
        Parameters:
        name - project name.
        category - project category.
        Returns:
        crated project.
        Throws:
        com.nomagic.ci.persistence.PersistenceException
      • renameProject

        private static void renameProject​(@Nonnull
                                          java.lang.String name,
                                          org.eclipse.emf.common.util.URI locationURI)
                                   throws com.nomagic.ci.persistence.PersistenceException
        Throws:
        com.nomagic.ci.persistence.PersistenceException
      • commitProject

        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)
        Commit project.
        Parameters:
        project - project
        comment - 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.
      • exportEsiModule

        @CheckForNull
        public static IAttachedProject exportEsiModule​(Project project,
                                                       java.util.Collection<Package> packages,
                                                       java.lang.String description,
                                                       java.lang.String moduleName)
                                                throws java.lang.Exception
        Exports module.
        Parameters:
        project - project.
        packages - packages to export.
        description - module description.
        moduleName - name of module.
        Returns:
        exported module attached project.
        Throws:
        java.lang.Exception - in case of some problem
      • getRemoteProjectDescriptors

        public static java.util.List<ProjectDescriptor> getRemoteProjectDescriptors()
                                                                             throws java.lang.Exception
        Returns descriptors of projects stored on server.
        Returns:
        list of remote project descriptors.
        Throws:
        java.rmi.RemoteException - in case of some problem
        java.lang.Exception
      • getVersions

        public static java.util.List<IVersionDescriptor> getVersions​(@Nonnull
                                                                     ProjectDescriptor descriptor)
        Get all versions of given project.
        Parameters:
        descriptor - project descriptor.
        Returns:
        list of version information.
      • getEMFURI

        private static org.eclipse.emf.common.util.URI getEMFURI​(@Nonnull
                                                                 ProjectDescriptor descriptor)
      • getResourceID

        private static java.util.UUID getResourceID​(ProjectDescriptor projectDescriptor)
      • addCommitTags

        public static void addCommitTags​(java.util.List<java.lang.String> tags,
                                         ProjectDescriptor descriptor,
                                         long version)
        Add tags for given version.
        Parameters:
        tags - tags to add.
        descriptor - project for which version tags is set.
        version - version for which tags will be added.
      • getCommitTags

        public static java.util.List<java.lang.String> getCommitTags​(ProjectDescriptor descriptor,
                                                                     long version)
        Get tags names for project version.
        Parameters:
        descriptor - project descriptor.
        version - version.
        Returns:
        list of tags for given version.
      • getCommitTagsInfo

        public static java.util.List<com.nomagic.esi.api.info.TagInfo> getCommitTagsInfo​(ProjectDescriptor descriptor,
                                                                                         long version)
        Get tags for project version.
        Parameters:
        descriptor - project descriptor.
        version - version.
        Returns:
        list of tags for given version.
      • getAllCommitTagsInfo

        public static java.util.List<com.nomagic.esi.api.info.TagInfo> getAllCommitTagsInfo​(ProjectDescriptor descriptor)
        Get all tags for project.
        Parameters:
        descriptor - project descriptor.
        Returns:
        list of tags for given version.
      • removeCommitTags

        public static void removeCommitTags​(ProjectDescriptor descriptor,
                                            long version)
        Remove all tags from project version.
        Parameters:
        descriptor - project descriptor.
        version - version.
      • updateProject

        public static void updateProject​(Project project)
        Updates given project. Project is activated before update.
        Parameters:
        project - teamwork project to update.
      • getProjectName

        @CheckForNull
        public static java.lang.String getProjectName​(org.eclipse.emf.common.util.URI locationURI)
        Return project name for given URI.
        Parameters:
        locationURI - project location.
        Returns:
        project name.
      • setProjectName

        public static void setProjectName​(ProjectDescriptor project,
                                          java.lang.String newName)
                                   throws com.nomagic.ci.persistence.PersistenceException
        Rename project.
        Parameters:
        project - project descriptor
        newName - new project name.
        Throws:
        com.nomagic.ci.persistence.PersistenceException - in case of some problem
      • deleteProject

        public static void deleteProject​(ProjectDescriptor project)
                                  throws com.nomagic.ci.persistence.PersistenceException
        Delete project from repository.
        Parameters:
        project - project to delete.
        Throws:
        com.nomagic.ci.persistence.PersistenceException
      • getCategories

        public static java.util.Set<CategoryInfo> getCategories()
        Returns:
        all categories from server.
      • getCategoriesToProjects

        public static java.util.Map<java.lang.String,​java.util.List<ProjectDescriptor>> getCategoriesToProjects()
                                                                                                               throws java.lang.Exception
        Get categories for projects.
        Returns:
        projects in categories.
        Throws:
        java.lang.Exception - in case of some problem
      • getCategory

        @CheckForNull
        public static java.util.UUID getCategory​(java.lang.String resourceID)
        Gets category ID for specified twc project resource ID.
        Parameters:
        resourceID - twc project resource ID
        Returns:
        category ID or null if project is not in category
      • getCategoryID

        @Deprecated
        @CheckForNull
        public static java.lang.String getCategoryID​(java.lang.String resourceID)
        Deprecated.
        Gets category ID for specified twc project resource ID.
        Parameters:
        resourceID - twc project resource ID
        Returns:
        category ID or null if project is not in category
      • getCategoryInfoByResourceID

        @CheckForNull
        public static CategoryInfo getCategoryInfoByResourceID​(java.lang.String resourceID)
        Get CategoryInfo for specified twc project resource ID.
        Parameters:
        resourceID - twc project resource ID
        Returns:
        instance of CategoryInfo or null
      • createCategory

        public static void createCategory​(java.lang.String name,
                                          java.lang.String description)
        Create projects category in the server.
        Parameters:
        name - category name
        description - category description
      • getMDEsiSession

        private static com.nomagic.magicdraw.esi.session.RepositorySession getMDEsiSession()
      • assignProjectToCategory

        public static void assignProjectToCategory​(ProjectDescriptor project,
                                                   java.lang.String... categories)
                                            throws java.lang.Exception
        Adds or remove project to/from categories. After this method project belongs only to categories specified for this method.
        Parameters:
        project - project to assign or remove from category.
        categories - categories to which project will be assigned.
        Throws:
        java.lang.Exception - in case of some problem
      • deleteCategory

        public static void deleteCategory​(java.lang.String name)
        Delete category with given name.
        Parameters:
        name - category name.
      • getBranches

        public static java.util.Collection<EsiUtils.EsiBranchInfo> getBranches​(ProjectDescriptor descriptor)
        Get all branches for given project.
        Parameters:
        descriptor - project descriptor.
        Returns:
        branches for given project.
      • createBranch

        public static void createBranch​(ProjectDescriptor descriptor,
                                        long version,
                                        java.lang.String branchName,
                                        java.lang.String branchDescription)
        Create new branch for given project.
        Parameters:
        descriptor - project descriptor.
        version - version from which branch
        branchName - new branch name.
        branchDescription - description of new branch.
        Throws:
        java.lang.RuntimeException - in case network or server error occurs when creating branch.
        InsufficientPermissionsException - if currently logged in user does not have Administer Resources permission
      • getNewBranch

        public static com.nomagic.esi.api.info.BranchInfo getNewBranch​(ProjectDescriptor descriptor,
                                                                       long version,
                                                                       java.lang.String branchName,
                                                                       java.lang.String branchDescription)
        Create new branch for given project.
        Parameters:
        descriptor - project descriptor.
        version - version from which branch
        branchName - new branch name.
        branchDescription - description of new branch.
        Returns:
        branch info for specified branch
        Throws:
        java.lang.RuntimeException - in case network or server error occurs when creating branch.
        InsufficientPermissionsException - if currently logged in user does not have Administer Resources permission
      • getDescriptorByBranchID

        public static ProjectDescriptor getDescriptorByBranchID​(ProjectDescriptor project,
                                                                java.util.UUID branchID)
        Get project descriptor for given branch. This descriptor can be used to load project from branch.
        Parameters:
        project - project descriptor.
        branchID - branch id.
        Returns:
        project descriptor for given branch.
      • getDescriptorForBranch

        public static ProjectDescriptor getDescriptorForBranch​(ProjectDescriptor project,
                                                               java.lang.String branchName)
        Get project descriptor for given branch. This descriptor can be used to load project from branch.
        Parameters:
        project - project descriptor.
        branchName - branch name.
        Returns:
        project descriptor for given branch.
      • getDescriptorForVersion

        public static ProjectDescriptor getDescriptorForVersion​(ProjectDescriptor projectDescriptor,
                                                                IVersionDescriptor versionDescriptor)
        Get descriptor for specific version. Can be used to open historic project version.
        Parameters:
        projectDescriptor - project descriptor.
        versionDescriptor - version.
        Returns:
        descriptor for specific version.
      • deleteBranch

        public static void deleteBranch​(ProjectDescriptor descriptor,
                                        java.lang.String branchName)
        Delete project branch.
        Parameters:
        descriptor - project which branch will be deleted.
        branchName - branch name to delete.
        Throws:
        InsufficientPermissionsException - if currently logged in user does not have Administer Resources permission
      • getBranchInfo

        private static com.nomagic.esi.api.info.BranchInfo getBranchInfo​(java.lang.String branchName,
                                                                         java.util.UUID resourceID)
      • checkForSufficientPermissions

        private static void checkForSufficientPermissions​(com.nomagic.magicdraw.esi.session.RepositorySession activeSession)
      • addToESI

        public static IPrimaryProject addToESI​(Project project,
                                               java.lang.String esiProjectName)
                                        throws com.nomagic.ci.persistence.PersistenceException
        Add project to the Teamwork Cloud server and open it.
        Parameters:
        project - project to add.
        esiProjectName - project name in teamwork cloud server.
        Returns:
        opened teamwork cloud project.
        Throws:
        com.nomagic.ci.persistence.PersistenceException - in case of some problem
      • addToESI

        public 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
        Add project to the Teamwork Cloud server and open it
        Parameters:
        project - the project to add
        esiProjectName - the name for the new Teamwork Cloud project
        category - the category to add the project to
        comment - the commit comment
        tags - the commit tags
        resolveInfos - the module resolve info list
        Returns:
        the added project
        Throws:
        com.nomagic.ci.persistence.PersistenceException - exception if add fails
      • convertToLocal

        @CheckForNull
        public static Project convertToLocal​(Project project,
                                             java.io.File file)
        Convert given project to local, save and reopen it.
        Parameters:
        project - project to convert
        file - project file
        Returns:
        local project
      • getLoggedUserName

        @CheckForNull
        public static java.lang.String getLoggedUserName()
        Returns the currently logged Teamwork Cloud user name.
        Returns:
        user name
      • getLoggedUserNames

        public static java.util.Set<java.lang.String> getLoggedUserNames()
        Get logged in users if current user has rights to access user list.
        Returns:
        all user names.
      • getUserNames

        public static java.util.Set<java.lang.String> getUserNames()
        Get all users if current user has rights to access user list.
        Returns:
        logged in user names.
      • updateModule

        public static void updateModule​(Project project,
                                        IAttachedProject module,
                                        ProjectDescriptor descriptor,
                                        long version)
                                 throws java.lang.Exception
        Change given module to another version or branch.
        Parameters:
        project - project which module is switched.
        module - module to switch.
        descriptor - new module descriptor.
        version - new module version
        Throws:
        java.lang.Exception - in case of some problem
      • updateModule

        public static void updateModule​(Project project,
                                        IAttachedProject module,
                                        org.eclipse.emf.common.util.URI updateFrom,
                                        long version)
                                 throws java.lang.Exception
        Change given module to another version or branch.
        Parameters:
        project - project which module is switched.
        module - module to switch.
        updateFrom - project location URI.
        version - new module version
        Throws:
        java.lang.Exception - in case of some problem
      • setNotifyOnNew

        public static void setNotifyOnNew​(Project project,
                                          IAttachedProject iAttachedProject,
                                          boolean notifyOnNew)
        Method sets if application should notify about available project usage update.
        Parameters:
        project - Project to which's usage setting is applied.
        iAttachedProject - Usage's attached project to which setting is applied.
        notifyOnNew - Should notification be shown.
      • isNotifyOnNew

        public static boolean isNotifyOnNew​(Project project,
                                            IAttachedProject iAttachedProject)
        Method returns if application should notify about available project usage update. Return false by default.
        Parameters:
        project - Project to which's usage setting is applied.
        iAttachedProject - Usage's attached project to which setting is applied.
        Returns:
        Should notification be shown. Returns false by default.
      • setNotifyOnNewTags

        public static void setNotifyOnNewTags​(Project project,
                                              IAttachedProject iAttachedProject,
                                              @CheckForNull
                                              java.util.Collection<java.lang.String> tags)
        Method sets application's notify tags about available project usage update.
        Parameters:
        project - Project to which's usage setting is applied.
        iAttachedProject - Usage's attached project to which setting is applied.
        tags - Notify tags.
      • setNotifyOnNewTags

        public static void setNotifyOnNewTags​(com.nomagic.magicdraw.esi.project.project.EsiPrimaryProject project,
                                              IAttachedProject iAttachedProject,
                                              @CheckForNull
                                              java.util.Collection<java.lang.String> tags)
        Method sets application's notify tags about available project usage update.
        Parameters:
        project - Project to which's usage setting is applied.
        iAttachedProject - Usage's attached project to which setting is applied.
        tags - Notify tags.
      • getDecompositionProperties

        private static org.eclipse.emf.common.util.EMap<java.lang.String,​java.lang.String> getDecompositionProperties​(Project project)
      • getDecompositionProperties

        private static org.eclipse.emf.common.util.EMap<java.lang.String,​java.lang.String> getDecompositionProperties​(com.nomagic.magicdraw.esi.project.project.EsiPrimaryProject project)
      • getNotificationTagsID

        private static java.lang.String getNotificationTagsID​(IAttachedProject iAttachedProject)
      • getNotifyOnNewTags

        @CheckForNull
        public static java.util.List<java.lang.String> getNotifyOnNewTags​(Project project,
                                                                          IAttachedProject iAttachedProject)
        Method returns application's notify tags about available project usage update.
        Parameters:
        project - Project to which's usage setting is applied.
        iAttachedProject - Usage's attached project to which setting is applied.
        Returns:
        Notify tags.
      • isModuleUsageNew

        public static boolean isModuleUsageNew​(IProject fromProject,
                                               IProject toProject)
        Checks if the project usage exists and is new (not yet committed to server).
        Parameters:
        fromProject - the project the usage should be from
        toProject - the project the usage should be to
        Returns:
        true if the usage from specifed project exists to specified to project and if the specified to project is not null and if the usage is new (as defined above). Return false othewise
      • getProjectUsage

        @CheckForNull
        private static com.nomagic.ci.metamodel.project.AbstractProjectUsage getProjectUsage​(IProject fromProject,
                                                                                             @CheckForNull
                                                                                             IProject toProject)
      • applyProjectState

        public static EsiUtils.ApplyProjectStateResult applyProjectState​(Project source,
                                                                         Project target)
                                                                  throws java.lang.IllegalArgumentException,
                                                                         ElementLockAcquisitionException,
                                                                         ModuleUsageLockAcquisitionException,
                                                                         OptionsLockAcquisitionException
        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. The elements that are matched are updated, the not existing elements are removed, and new elements are added. Module usages are copied and modules are updated accordingly. To perform the operation successfully, all elements of the project, module usages, and options are locked. Any lock failure terminates the operation with a specific exception
        Parameters:
        source - the source project from which the state is copied
        target - the target project to which the state is copied
        Returns:
        a structure that holds the result of the operation
        Throws:
        java.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 Teamwork Cloud project, 4. the project IDs differ, 5. the target project is not editable
        ElementLockAcquisitionException - if specific element could not be locked
        ModuleUsageLockAcquisitionException - if specific module usage could not be locked
        OptionsLockAcquisitionException - if specific options could not be locked
      • applyDisconnectedProjectState

        public static EsiUtils.ApplyProjectStateResult applyDisconnectedProjectState​(Project source,
                                                                                     Project target)
                                                                              throws java.lang.IllegalArgumentException,
                                                                                     ElementLockAcquisitionException,
                                                                                     ModuleUsageLockAcquisitionException,
                                                                                     OptionsLockAcquisitionException
        Applies the state of the source project (local project) to the target project (TWCloud server project), or in other words, overwrites the content of the target project with the contents of the source project. The elements that are matched are updated, the not existing elements are removed, and new elements are added. Module usages are copied and modules are updated accordingly. To perform the operation successfully, all elements of the project, module usages, and options are locked. Any lock failure terminates the operation with a specific exception
        Parameters:
        source - the source project (local project) from which the state is copied
        target - the target project (server project) to which the state is copied
        Returns:
        a structure that holds the result of the operation
        Throws:
        java.lang.IllegalArgumentException - if: 1. the projects are the same, 2. any of the projects are not ready, 3. the project IDs differ, 4. the target project is not editable
        ElementLockAcquisitionException - if specific element could not be locked
        ModuleUsageLockAcquisitionException - if specific module usage could not be locked
        OptionsLockAcquisitionException - if specific options could not be locked
      • getLastVersion

        public static long getLastVersion​(ProjectDescriptor descriptor)
        Get last project version number.
        Parameters:
        descriptor - project descriptor for Teamwork Cloud server project.
        Returns:
        last project version number, -1 - there is no such project or application is not connected to the server.
        Throws:
        java.lang.RuntimeException - in case provided descriptor is not valid for current server.
      • getProjectDescriptorsWithBranches

        public static java.util.Collection<ProjectDescriptor> getProjectDescriptorsWithBranches​(java.lang.Iterable<ProjectDescriptor> projectDescriptors)
        Invocation of this method returns a Collection of ProjectDescriptors of each branch in the given projectDescriptors.
        Parameters:
        projectDescriptors - descriptors of the projects, whose branch ProjectDescriptors should be returned
        Returns:
        project descriptors for each branch of the given projectDescriptors
      • cloneProject

        @CheckForNull
        public static org.eclipse.emf.common.util.URI cloneProject​(org.eclipse.emf.common.util.URI sourceURI,
                                                                   java.lang.String targetName,
                                                                   java.lang.String targetDescription)
                                                            throws java.lang.Exception
        Clones project, new project is created it contains copy of source project with regenerated element ids. Application must be logged in the server, logged in user should have permission to create new project and read source project.
        Parameters:
        sourceURI - source project URI
        targetName - target project name
        targetDescription - target project description
        Returns:
        cloned project URI
        Throws:
        java.lang.Exception - exception in case clone fails
      • cloneProject

        @Deprecated
        @CheckForNull
        public static org.eclipse.emf.common.util.URI cloneProject​(org.eclipse.emf.common.util.URI sourceURI,
                                                                   java.lang.String targetName,
                                                                   java.lang.String targetDescription,
                                                                   @CheckForNull
                                                                   java.lang.String targetCategoryID)
                                                            throws java.lang.Exception
        Clones project, new project is created it contains copy of source project with regenerated element ids. Application must be logged in the server, logged in user should have permission to create new project and read source project.
        Parameters:
        sourceURI - source project URI
        targetName - target project name
        targetDescription - target project description
        targetCategoryID - target project category ID
        Returns:
        cloned project URI
        Throws:
        java.lang.Exception - exception in case clone fails
      • cloneProject

        @CheckForNull
        public static org.eclipse.emf.common.util.URI cloneProject​(org.eclipse.emf.common.util.URI sourceURI,
                                                                   java.lang.String targetName,
                                                                   java.lang.String targetDescription,
                                                                   @CheckForNull
                                                                   java.util.UUID targetCategoryID)
                                                            throws java.lang.Exception
        Clones project, new project is created it contains copy of source project with regenerated element ids. Application must be logged in the server, logged in user should have permission to create new project and read source project.
        Parameters:
        sourceURI - source project URI
        targetName - target project name
        targetDescription - target project description
        targetCategoryID - target project category ID
        Returns:
        cloned project URI
        Throws:
        java.lang.Exception - exception in case clone fails
      • getProjectDescriptorsWithBranches

        public 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.
        Parameters:
        descriptor - project descriptor for which to collect project descriptors with branch info
        descriptorsWithBranches - collection where to add the result
      • getBranchID

        public static java.util.UUID getBranchID​(org.eclipse.emf.common.util.URI locationURI)
        Gets project branch ID.
        Parameters:
        locationURI - project location URI
        Returns:
        branch ID
      • moveToUsedProject

        public static void moveToUsedProject​(Project project,
                                             java.util.Map<PackageableElement,​Element> moveMap,
                                             boolean silentMode)
                                      throws java.lang.Exception
        Moves elements to used project(s). The moved elements must be lockable by user, and must have an owner. The target package(s) must be in the directly used project, and be lockable by user. Each moved element can be moved to a different target package. In addition to the specified elements, additional elements (such as interrelations) might be selected to be moved together. See MoveRelationManager.collectRelationsToMove(java.util.Map<com.nomagic.uml2.ext.magicdraw.classes.mdkernel.PackageableElement, com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element>).
        Parameters:
        project - the main project
        moveMap - elements move map
        silentMode - if true, will move in silent mode
        Throws:
        java.lang.Exception - in case moving elements fails
      • getCurrentBranch

        @CheckForNull
        public static EsiUtils.EsiBranchInfo getCurrentBranch​(IProject project)
        Gets branch information for the given TWC project part. If TWC project part is not linked with TWC project (like standard profiles) or user has no permission to read then null will be returned.
        Parameters:
        project - project part
        Returns:
        branch information
      • createEsiBranchInfo

        private static EsiUtils.EsiBranchInfo createEsiBranchInfo​(com.nomagic.esi.api.info.BranchInfo currentBranch)
      • getCommandLinePasswordManager

        @CheckForNull
        public static CommandLinePasswordManager getCommandLinePasswordManager​(ProjectDescriptor descriptor)
        Gets password manager for command line utilities If session is not present then null will be returned.
        Parameters:
        descriptor - versionable project descriptor
        Returns:
        CommandLinePasswordManager or null if session is not initialized
      • saveToOffline

        public static EsiUtils.OfflineProjectDescriptor saveToOffline​(Project project,
                                                                      ProgressStatus status,
                                                                      boolean delete)
                                                               throws java.io.IOException,
                                                                      com.nomagic.ci.persistence.PersistenceException
        Saves the specified project to offline.
        Parameters:
        project - a project.
        status - a progress status.
        delete - delete previous saved offline project if true.
        Returns:
        offline project descriptor.
        Throws:
        java.lang.IllegalArgumentException - if the specified project is not a TWC project.
        java.io.IOException - if any I/O errors occurs.
        com.nomagic.ci.persistence.PersistenceException - if persistence related problem occurs.
      • loadFromOffline

        @CheckForNull
        public static Project loadFromOffline​(EsiUtils.OfflineProjectDescriptor descriptor,
                                              ProgressStatus status)
                                       throws java.lang.Exception
        Loads the offline project.
        Parameters:
        descriptor - specifies which offline project to load.
        status - progress status.
        Returns:
        loaded project or null if the offline project was not loaded.
        Throws:
        java.lang.Exception - if offline project loading fails.
      • getOfflineProject

        @CheckForNull
        public static EsiUtils.OfflineProjectDescriptor getOfflineProject​(Project project)
        Returns offline project descriptor of the specified project or null if the project is not saved to offline.
        Parameters:
        project - a project.
        Returns:
        offline project descriptor.
        Throws:
        java.lang.IllegalArgumentException - if the specified project is not a TWC project.
      • getOfflineProjects

        public static java.util.Collection<EsiUtils.OfflineProjectDescriptor> getOfflineProjects()
        Returns all available offline project descriptors.
        Returns:
        collection of offline project descriptors.