com.waveset.object
Class ResourceAssignment

java.lang.Object
  extended bycom.waveset.object.ResourceAssignment

public class ResourceAssignment
extends java.lang.Object

A ResourceAssignment represents an assignment of an account on a resource. It does not specify the exact account, but may optionally specify a type of account. This provides a model of assigning multiple accounts on a resource to the same object (User, Role, or Application) and providing an unambiguous reference to a single account (in absence of knowing the accountId) for multiple objects.


Field Summary
static int ACCOUNT_TYPE
          The index into the array returned by parseNameComponents which contains the account type.
static java.lang.String ACCOUNT_TYPE_MARKER
           
static java.lang.String ID_RULE_SUBTYPE
           
static int RESOURCE_NAME
          The index into the array returned by parseNameComponents which contains the resource name.
 
Constructor Summary
ResourceAssignment(Resource r)
           
ResourceAssignment(Resource r, java.lang.String accountType)
           
 
Method Summary
 boolean equals(java.lang.Object o)
           
 java.lang.String getAccountType()
          Get the type of account this assignment is for.
 java.lang.String getName()
          Get the name of this assignment.
static java.lang.String getName(Resource r, java.lang.String accountType)
          Get the name of the specified assignment.
static java.lang.String getName(java.lang.String resName, java.lang.String accountType)
          Get the name of the specified assignment.
static java.util.Collection getNames(java.util.Collection assignments, java.util.Collection names)
          Given a Collection of ResourceAssignments, add their names to the specified output Collection.
 Resource getResource()
          Get the resource this assignment is for.
 int hashCode()
           
static java.lang.String[] parseNameComponents(java.lang.String srcName)
          Decompose the name of an assignment into its constituent pieces.
 boolean refersTo(ObjectRef ref)
          Check whether an ObjectRef refers to the same account type qualified resource as this ResourceAssignment.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACCOUNT_TYPE_MARKER

public static final java.lang.String ACCOUNT_TYPE_MARKER
See Also:
Constant Field Values

ID_RULE_SUBTYPE

public static final java.lang.String ID_RULE_SUBTYPE
See Also:
Constant Field Values

RESOURCE_NAME

public static final int RESOURCE_NAME
The index into the array returned by parseNameComponents which contains the resource name.

See Also:
Constant Field Values

ACCOUNT_TYPE

public static final int ACCOUNT_TYPE
The index into the array returned by parseNameComponents which contains the account type. This may be null.

See Also:
Constant Field Values
Constructor Detail

ResourceAssignment

public ResourceAssignment(Resource r,
                          java.lang.String accountType)

ResourceAssignment

public ResourceAssignment(Resource r)
Method Detail

equals

public boolean equals(java.lang.Object o)

hashCode

public int hashCode()

getResource

public Resource getResource()
Get the resource this assignment is for.

Returns:
the Resource this assignment references.

getAccountType

public java.lang.String getAccountType()
Get the type of account this assignment is for.

Returns:
the name of an account type on the assigned resource which this assignment references. If null, it refers to the "default" type.

getName

public java.lang.String getName()
Get the name of this assignment.

Returns:
the account type qualified resource name.

getName

public static java.lang.String getName(Resource r,
                                       java.lang.String accountType)
Get the name of the specified assignment.

Returns:
the account type qualified resource name.

getName

public static java.lang.String getName(java.lang.String resName,
                                       java.lang.String accountType)
Get the name of the specified assignment.

Returns:
the account type qualified resource name.

parseNameComponents

public static java.lang.String[] parseNameComponents(java.lang.String srcName)
Decompose the name of an assignment into its constituent pieces.

Returns:
a two element array containing the pieces of the name.

refersTo

public boolean refersTo(ObjectRef ref)
Check whether an ObjectRef refers to the same account type qualified resource as this ResourceAssignment.

Returns:
whether these are the same assignment.

getNames

public static java.util.Collection getNames(java.util.Collection assignments,
                                            java.util.Collection names)
Given a Collection of ResourceAssignments, add their names to the specified output Collection.

Returns:
the specified output Collection