com.stratelia.webactiv.beans.admin
Class RightAssignationContext

java.lang.Object
  extended by com.stratelia.webactiv.beans.admin.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

Nested Class Summary
static class RightAssignationContext.MODE
           
 
Method Summary
 boolean areSourceAndTargetEqual()
          Indicates if the source and target are equal.
static RightAssignationContext copy()
          Initializes a right assignation context by specifying directly a copy operation.
 RightAssignationContext fromGroupId(String groupId)
          Indicates the source identifier of a group.
 RightAssignationContext fromUserId(String userId)
          Indicates the source identifier of a user.
 String getAuthor()
          Gets the identifier of the user behind the assignation operation.
 RightAssignationContext.MODE getMode()
          Gets the operation mode (copy or replace for now)
 String getSourceId()
          Gets the identifier of the resource source.
 com.stratelia.webactiv.beans.admin.RightAssignationContext.RESOURCE_TYPE getSourceType()
          Gets the RightAssignationContext.RESOURCE_TYPE of the resource source.
 String getTargetId()
          Gets the identifier of the resource target.
 com.stratelia.webactiv.beans.admin.RightAssignationContext.RESOURCE_TYPE getTargetType()
          Gets the RightAssignationContext.RESOURCE_TYPE of the resource target.
 boolean isAssignObjectRights()
          Indicates if component object rights must also be assigned.
static RightAssignationContext replace()
          Initializes a right assignation context by specifying directly a copy operation.
 RightAssignationContext setAuthor(String author)
          Sets the author behind the action.
 RightAssignationContext toGroupId(String groupId)
          Indicates the target identifier of a group.
 RightAssignationContext toUserId(String userId)
          Indicates the target identifier of a user.
 void verifySourceAndTargetAreDefined()
          Verifies that source and target resources are defined.
 RightAssignationContext withoutAssigningComponentObjectRights()
          Indicates that component object rights must not be assigned.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.

getMode

public RightAssignationContext.MODE getMode()
Gets the operation mode (copy or replace for now)

Returns:
the mode.

getSourceId

public String getSourceId()
Gets the identifier of the resource source.

Returns:
the identifier of the resource source.

getSourceType

public com.stratelia.webactiv.beans.admin.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 com.stratelia.webactiv.beans.admin.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.


Copyright © 2016 Silverpeas. All Rights Reserved.