Class DefaultCMSPageLockingService

All Implemented Interfaces:
CMSPageLockingService, Serializable, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean

public class DefaultCMSPageLockingService extends AbstractCMSService implements CMSPageLockingService
Default implementation of CMSPageLockingService
See Also:
  • Field Details

    • LOG

      protected static final org.apache.log4j.Logger LOG
  • Constructor Details

    • DefaultCMSPageLockingService

      public DefaultCMSPageLockingService()
  • Method Details

    • getCmsPageService

      public CMSPageService getCmsPageService()
      Returns:
      the cmsPageService
    • getComponentLockers

      public Collection<UserModel> getComponentLockers(AbstractCMSComponentModel componentModel)
      Method returns users that locked given component by page or page template.
      Specified by:
      getComponentLockers in interface CMSPageLockingService
      Parameters:
      componentModel - - component model to check
      Returns:
      users that locked this component
    • getSlotLockers

      public Collection<UserModel> getSlotLockers(ContentSlotModel contentSlotModel)
      Method returns user that locked given content slot by page or page template, or null if slot is not locked.
      Specified by:
      getSlotLockers in interface CMSPageLockingService
      Parameters:
      contentSlotModel - - content slot model to check
      Returns:
      users that locked this slot
    • isComponentLockedForUser

      public boolean isComponentLockedForUser(AbstractCMSComponentModel componentModel, UserModel userModel)
      Method that checks if given component is locked for specified user. Should check if given component is placed in any page that is locked for given user and returns true if it is.
      Specified by:
      isComponentLockedForUser in interface CMSPageLockingService
      Parameters:
      componentModel - - abstract CMS component model to check
      userModel - - user model for which lock will be checked
      Returns:
      true if component is locked for the given user in any page
    • isContentSlotLockedForUser

      public boolean isContentSlotLockedForUser(ContentSlotModel contentSlotModel, UserModel userModel)
      Method that checks if given content slot belongs to any page that is locked for specified user.
      Specified by:
      isContentSlotLockedForUser in interface CMSPageLockingService
      Parameters:
      contentSlotModel - - content slot model to check
      userModel - - user model for which lock will be checked
      Returns:
      true if content slot is locked for the given user in any page
    • isPageLockedBy

      public boolean isPageLockedBy(AbstractPageModel pageModel, UserModel userModel)
      Method checks if page is locked by the given user. Even if user has special permission that allows him to unlock any page this method still will return true, because this administration unlock must be performed explicitly.
      Specified by:
      isPageLockedBy in interface CMSPageLockingService
      Parameters:
      pageModel - - page model for which lock will be checked
      userModel - - user model for which lock will be checked
      Returns:
      true if the page is locked by the given user.
    • isPageLockedFor

      public boolean isPageLockedFor(AbstractPageModel pageModel, UserModel userModel)
      Method checks if the page is locked for given user. If the page is locked and was locked by given user it returns false, but if it was locked by other user it returns true.
      Specified by:
      isPageLockedFor in interface CMSPageLockingService
      Parameters:
      pageModel - - page model for which lock will be checked
      userModel - - user model for which lock will be checked
      Returns:
      true if the page is locked for specified combination of user and page.
    • setCmsPageService

      public void setCmsPageService(CMSPageService cmsPageService)
      Parameters:
      cmsPageService - the cmsPageService to set
    • setPageLocked

      public void setPageLocked(AbstractPageModel pageModel, UserModel userModel, boolean lock)
      Method that allows to set and unset page lock for given combination of user and page. This method should first check if page is not locked by other user and then perform lock/unlock for given parameters. Also will perform unlock if the given user does not set lock for given page, but has permission to unlock any page.
      Specified by:
      setPageLocked in interface CMSPageLockingService
      Parameters:
      pageModel - - page model for which the lock will be set or unset
      userModel - - user model for which the lock will be set or unset
      lock - - if set to true the lock will be set for given combination, otherwise it will be unset.
    • lockPage

      protected void lockPage(AbstractPageModel pageModel, UserModel userModel)
    • unlockPage

      protected void unlockPage(AbstractPageModel pageModel, UserModel userModel)