Interface ILockProjectService

  • All Known Implementing Classes:
    LockService

    @OpenApiAll
    public interface ILockProjectService
    Project data locking service. Provides api to check, request and release locks on various project data
    • Method Detail

      • isLocked

        boolean isLocked​(Element element)
        Check if element is locked
        Parameters:
        element - element
        Returns:
        true if element is locked
      • hasLockedElements

        boolean hasLockedElements()
        Check if project has some locked data
        Returns:
        true if locked data exists in project
      • isLockedBy

        boolean isLockedBy​(Element element,
                           java.lang.String user)
        Check if given element is locked by a user
        Parameters:
        element - element
        user - user
        Returns:
        true if user has lock on this element
      • getLockInfo

        @CheckForNull
        LockInfo getLockInfo​(Element element)
        Return lock information on given element
        Parameters:
        element - element
        Returns:
        lock information or null of element is not locked
      • getLockInfo

        LockInfo getLockInfo​(ModuleUsage moduleUsage)
        Return lock information on given usage
        Parameters:
        moduleUsage - module usage
        Returns:
        lock information or null of usage is not locked
      • isLocked

        boolean isLocked​(ModuleUsage moduleUsage)
        Check if usage is locked
        Parameters:
        moduleUsage - usage
        Returns:
        true is usage is locked
      • isLockedByMe

        boolean isLockedByMe​(Element element)
        Check if the given element has lock on it, and this lock owner is current user.
        Parameters:
        element - element to check for locked user.
        Returns:
        true when given element is locked by the current user.
      • isLockedByMe

        boolean isLockedByMe​(ModuleUsage moduleUsage)
        Check if the given usage has lock on it, and this lock owner is current user.
        Parameters:
        moduleUsage - usage to check for locked user.
        Returns:
        true when given usage is locked by the current user.
      • getLockedBy

        java.util.Collection<Element> getLockedBy​(java.lang.String user)
        Collect all elements locked by given user
        Parameters:
        user - user
        Returns:
        locked elements
      • getLockedByMe

        java.util.Collection<Element> getLockedByMe()
        Collect all elements locked by current user
        Returns:
        locked elements
      • getModulesLockedBy

        java.util.Collection<ModuleUsage> getModulesLockedBy​(@CheckForNull
                                                             java.lang.String user)
        Collect all usages locked by given user
        Parameters:
        user - user
        Returns:
        locked usages
      • getModulesLockedByMe

        java.util.Collection<ModuleUsage> getModulesLockedByMe()
        Collect all usages locked by current user
        Returns:
        locked usages
      • getLockedModules

        java.util.Collection<ModuleUsage> getLockedModules()
        Collect all usages locked by any user
        Returns:
        locked usages
      • canBeLocked

        boolean canBeLocked​(Element element)
        Check if given element can be locked by current user. Includes checking resource lock, granularity, user rights and if object is locked already.
        Parameters:
        element - element
        Returns:
        true if user can lock given element.
      • canBeUnlocked

        boolean canBeUnlocked​(Element element)
        Check if given element can be unlocked by current user. Includes checking resource lock, granularity, user rights and if object is locked already.
        Parameters:
        element - element
        Returns:
        true if user can unlock given element.
      • canBeLocked

        boolean canBeLocked​(ModuleUsage moduleUsage)
        Check if given usage can be locked by current user. Includes checking resource lock, granularity, user rights and if object is locked already.
        Parameters:
        moduleUsage - usage
        Returns:
        true if user can lock given usage.
      • canBeUnlocked

        boolean canBeUnlocked​(ModuleUsage moduleUsage)
        Check if given usage can be unlocked by current user. Includes checking resource lock, granularity, user rights and if object is locked already.
        Parameters:
        moduleUsage - usage
        Returns:
        true if user can unlock given usage.
      • lockElements

        default boolean lockElements​(java.util.Collection<? extends Element> elements,
                                     boolean lockRecursively,
                                     @CheckForNull
                                     ProgressStatus status)
        Lock given elements. Can lock children of given elements also.
        Parameters:
        elements - elements
        lockRecursively - lock children recursively
        status - progress status
        Returns:
        true if all given elements where locked
      • lockElements

        default boolean lockElements​(java.util.Collection<? extends Element> elements,
                                     @CheckForNull
                                     ProgressStatus status)
        Lock given elements. Children are not locked
        Parameters:
        elements - elements
        status - progress status
        Returns:
        true if all elements where locked
      • lockElements

        boolean lockElements​(java.util.Collection<? extends Element> elements,
                             ILockProjectService.LockOptions options,
                             @CheckForNull
                             ProgressStatus status)
        Lock given elements. Children are not locked
        Parameters:
        elements - elements
        status - progress status
        options - lock operation options
        Returns:
        true if all elements where locked
      • unlockElements

        boolean unlockElements​(java.util.Collection<? extends Element> elements,
                               boolean unlockRecursively,
                               @CheckForNull
                               ProgressStatus status,
                               boolean unlockOnlyMyLocks)
        Unlock given elements. Can unlock children of given elements also.
        Parameters:
        elements - elements
        unlockRecursively - children recursively
        status - progress status
        unlockOnlyMyLocks - unlock only my locked elements (used for ESI projects)
        Returns:
        true if all given elements where unlocked
      • unlockElements

        boolean unlockElements​(java.util.Collection<? extends Element> elements,
                               boolean unlockRecursively,
                               @CheckForNull
                               ProgressStatus status,
                               java.util.Collection<Element> elementsToUnlock,
                               boolean unlockOnlyMyLocks)
        Unlock given elements. Can unlock children of given elements also.
        Parameters:
        elements - elements
        unlockRecursively - children recursively
        status - progress status
        elementsToUnlock - elements to unlock
        unlockOnlyMyLocks - unlock only my locked elements (used for ESI projects)
        Returns:
        true if all given elements where unlocked
      • unlockModules

        boolean unlockModules​(java.util.Collection<ModuleUsage> moduleUsages,
                              @CheckForNull
                              ProgressStatus status)
        Unlock given usages.
        Parameters:
        moduleUsages - elements
        status - progress status
        Returns:
        true if all usages where unlocked
      • lockModules

        boolean lockModules​(java.util.Collection<ModuleUsage> moduleUsages,
                            boolean checkForNewVersion,
                            @CheckForNull
                            ProgressStatus status)
        Lock given usages.
        Parameters:
        moduleUsages - elements
        checkForNewVersion - check if new project version exists on server before locking
        status - progress status
        Returns:
        true if all usages where locked
      • lockModules

        boolean lockModules​(java.util.Collection<ModuleUsage> moduleUsages,
                            boolean checkForNewVersion,
                            boolean lockAsManyAsPossible,
                            @CheckForNull
                            ProgressStatus status)
        Lock given usages.
        Parameters:
        moduleUsages - elements
        checkForNewVersion - check if new project version exists on server before locking
        lockAsManyAsPossible - stop without locking any usages if there is at least one usage which cannot be locked
        status - progress status
        Returns:
        true if all usages where locked
      • updateLocks

        void updateLocks​(@CheckForNull
                         ProgressStatus status)
        Update local information about locks from server. In other words retrieve latest locks information from server.
        Parameters:
        status - progress
      • getLockedElements

        java.util.Collection<Element> getLockedElements()
        Returns collection of locked elements.
        Returns:
        locked elements
      • getLockedElementUsers

        java.util.Collection<java.lang.String> getLockedElementUsers()
        Returns collection of locked elements owners in the server.
        Returns:
        users whose have locked elements in the server
      • isDecompositionLockedByMe

        boolean isDecompositionLockedByMe​(IProject project)
        Checks for decomposition model lock
        Parameters:
        project - project which decomposition model is locked
        Returns:
        true if given project decomposition model is locked by me
      • isDecompositionLocked

        boolean isDecompositionLocked​(IProject project)
        Check if decomposition model is locked
        Parameters:
        project - project
        Returns:
        true if decomposition is locked by any user
      • setDecompositionLockedByMe

        boolean setDecompositionLockedByMe​(IProject project,
                                           boolean locked,
                                           @CheckForNull
                                           ProgressStatus status)
        Lock/Unlock decomposition model.
        Parameters:
        project - project which decomposition model is locked
        locked - new lock value
        status - progress status
        Returns:
        true if decomposition is locked by me
      • getDecompositionLock

        LockInfo getDecompositionLock​(IProject project)
        Return decomposition lock
        Parameters:
        project - project
        Returns:
        lock or null
      • canBeDecompositionLocked

        boolean canBeDecompositionLocked​(IProject project)
        Check if project decomposition can be locked by current user
        Parameters:
        project - project
        Returns:
        true if can be locked
      • canBeDecompositionUnlocked

        boolean canBeDecompositionUnlocked​(IProject project)
        Check if project decomposition can be unlocked by current user
        Parameters:
        project - project
        Returns:
        true if can be unlocked
      • isOptionsLocked

        boolean isOptionsLocked​(IProject project,
                                java.lang.String options)
        Check if given options are locked.
        Parameters:
        project - project.
        options - options.
        Returns:
        true - locked.
      • isOptionsLockedByMe

        boolean isOptionsLockedByMe​(IProject project,
                                    java.lang.String options)
        Check if options locked by current user.
        Parameters:
        project - project.
        options - options.
        Returns:
        true - locked by current user.
      • canBeOptionsLocked

        boolean canBeOptionsLocked​(IProject project,
                                   java.lang.String options)
        Check if options can be locked.
        Parameters:
        project - project.
        options - options.
        Returns:
        true if can be locked.
      • canBeOptionsUnlocked

        boolean canBeOptionsUnlocked​(IProject project,
                                     java.lang.String options)
        Check if options can be unlocked.
        Parameters:
        project - project.
        options - options.
        Returns:
        true if can be unlocked.
      • setOptionsLockedByMe

        boolean setOptionsLockedByMe​(IProject project,
                                     java.lang.String options,
                                     boolean locked,
                                     @CheckForNull
                                     ProgressStatus status)
        Lock/unlock options.
        Parameters:
        project - project.
        options - option
        locked - true to lock, false to unlock
        status - status.
        Returns:
        true if operation succeeds.
      • getOptionsLock

        @CheckForNull
        LockInfo getOptionsLock​(IProject project,
                                java.lang.String options)
        Get options lock data.
        Parameters:
        project - project
        options - options
        Returns:
        lock.
      • setCacheOptionsLock

        void setCacheOptionsLock​(boolean value)
        Sets whether options lock should be cached or not.
        Parameters:
        value - if true then options lock should be cached on the first call.
      • unlockElements

        boolean unlockElements​(java.util.Collection<? extends Element> elements,
                               ProgressStatus status,
                               boolean unlockOnlyMyLocks)
        Unlock given elements. Can unlock children of given elements also.
        Parameters:
        elements - elements
        status - progress status
        unlockOnlyMyLocks - unlock only my locked elements (used for ESI projects)
        Returns:
        true if all given elements where unlocked
      • unlockElements

        boolean unlockElements​(java.util.Collection<? extends Element> elements,
                               boolean unlockRecursively,
                               @CheckForNull
                               ProgressStatus status)
        Unlock given elements. Can unlock children of given elements also.
        Parameters:
        elements - elements
        unlockRecursively - children recursively
        status - progress status
        Returns:
        true if all given elements where unlocked
      • unlockElements

        boolean unlockElements​(java.util.Collection<? extends Element> elements,
                               @CheckForNull
                               ProgressStatus status)
        Unlock given elements. Children are not unlocked
        Parameters:
        elements - elements
        status - progress status
        Returns:
        true if all elements where unlocked
      • hasPermissionToLock

        boolean hasPermissionToLock​(Element element)
        Check permissions for element.
        Parameters:
        element - element to check
        Returns:
        true because of not available package permissions