Class RightAssignationContext


  • public class RightAssignationContext
    extends Object
    This class permits to specify the context of a right assignation operations (copy or replace for now).
    It simplifies significantly all the method definition that perform right assignation operations.
    Author:
    Yohann Chastagnier
    • Method Detail

      • copy

        public static RightAssignationContext copy()
        Initializes a right assignation context by specifying directly a copy operation.
        Returns:
        the instance of the right assignation context.
      • replace

        public static RightAssignationContext replace()
        Initializes a right assignation context by specifying directly a copy operation.
        Returns:
        the instance of the right assignation context.
      • verifySourceAndTargetAreDefined

        public void verifySourceAndTargetAreDefined()
        Verifies that source and target resources are defined. If not, IllegalArgumentException is thrown.
      • areSourceAndTargetEqual

        public boolean areSourceAndTargetEqual()
        Indicates if the source and target are equal. This method calls firstly verifySourceAndTargetAreDefined() method in order to be sure working on defined data.
        Returns:
        true if source and target are equal, false otherwise.
      • fromUserId

        public RightAssignationContext fromUserId​(String userId)
        Indicates the source identifier of a user.
        Parameters:
        userId - the identifier of a user that represents the source of rights.
        Returns:
        the instance of the right assignation context.
      • fromGroupId

        public RightAssignationContext fromGroupId​(String groupId)
        Indicates the source identifier of a group.
        Parameters:
        groupId - the identifier of a group that represents the source of rights.
        Returns:
        the instance of the right assignation context.
      • toUserId

        public RightAssignationContext toUserId​(String userId)
        Indicates the target identifier of a user.
        Parameters:
        userId - the identifier of a user that represents the target of rights.
        Returns:
        the instance of the right assignation context.
      • toGroupId

        public RightAssignationContext toGroupId​(String groupId)
        Indicates the target identifier of a group.
        Parameters:
        groupId - the identifier of a group that represents the target of rights.
        Returns:
        the instance of the right assignation context.
      • withoutAssigningComponentObjectRights

        public RightAssignationContext withoutAssigningComponentObjectRights()
        Indicates that component object rights must not be assigned.
        Returns:
        the instance of the right assignation context.
      • setAuthor

        public RightAssignationContext setAuthor​(String author)
        Sets the author behind the action.
        Parameters:
        author - the identifier of a user.
        Returns:
        the instance of the right assignation context.
      • getSourceId

        public String getSourceId()
        Gets the identifier of the resource source.
        Returns:
        the identifier of the resource source.
      • getSourceType

        public org.silverpeas.core.admin.service.RightAssignationContext.RESOURCE_TYPE getSourceType()
        Gets the RightAssignationContext.RESOURCE_TYPE of the resource source.
        Returns:
        the RightAssignationContext.RESOURCE_TYPE of the resource source.
      • getTargetId

        public String getTargetId()
        Gets the identifier of the resource target.
        Returns:
        the identifier of the resource target.
      • getTargetType

        public org.silverpeas.core.admin.service.RightAssignationContext.RESOURCE_TYPE getTargetType()
        Gets the RightAssignationContext.RESOURCE_TYPE of the resource target.
        Returns:
        the RightAssignationContext.RESOURCE_TYPE of the resource target.
      • isAssignObjectRights

        public boolean isAssignObjectRights()
        Indicates if component object rights must also be assigned.
        Returns:
        true if the component object rights must be also assigned, false otherwise.
      • getAuthor

        public String getAuthor()
        Gets the identifier of the user behind the assignation operation.
        Returns:
        the identifier of the user behind the assignation operation.