org.n52.security.decision
Class Obligation

java.lang.Object
  extended by org.n52.security.decision.Obligation
All Implemented Interfaces:
java.io.Serializable

public class Obligation
extends java.lang.Object
implements java.io.Serializable

This class represents an obligation. An obligation could be set in an PDPResponse by an PDPProxy. Each obligation HAS to be fulfilled.

Version:
$Revision: 1748 $
Author:
Bastian Schaeffer, Marko Reiprecht
See Also:
Serialized Form

Field Summary
static int FULLFILL_ON_DENY
          Field FULLFILL_ON_DENY represents the 'deny' state of an obligation.
static int FULLFILL_ON_PERMIT
          Field FULLFILL_ON_PERMIT represents the 'permit' state of an obligation.
protected  Attributes m_attributes
          Field attributes carries a collection of attributes with type Attribute.
protected  int m_fullFillOn
          Field fullFillOn olds the fullfill on state.
protected  java.lang.String m_id
          Field id carries the id of this obligation.
 
Constructor Summary
Obligation(int fullFillOn, java.lang.String id, java.util.Collection attributes)
          Creates an obligation.
 
Method Summary
protected  void checkFullFillOn(int fullFillOn)
          Checks the fullfill on parameter in the constructor.
 boolean containsAttribute(java.lang.String key)
          Returns true if an attribute with the given key is present.
 boolean equals(java.lang.Object o)
          Method equals checks for value equality of two obligation objects.
 Attribute getAttribute(java.lang.String key)
          Gets an Attribute for a given key.
 java.util.Collection getAttributes()
          Gets the attributes.
 int getFullFillOn()
           
 java.lang.String getId()
           
 int hashCode()
          Method hashCode generates a hashcode for this obligation.
 boolean isFullFillOnDeny()
          Method gets the fullFillOnDeny.
 boolean isFullFillOnPermit()
          Method gets the fullFillOnPermit.
 java.lang.String toString()
          Method toString generates a simple object info string, used only for logging purpose.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

FULLFILL_ON_PERMIT

public static final int FULLFILL_ON_PERMIT
Field FULLFILL_ON_PERMIT represents the 'permit' state of an obligation.

See Also:
Constant Field Values

FULLFILL_ON_DENY

public static final int FULLFILL_ON_DENY
Field FULLFILL_ON_DENY represents the 'deny' state of an obligation.

See Also:
Constant Field Values

m_fullFillOn

protected int m_fullFillOn
Field fullFillOn olds the fullfill on state. It must have the value FULLFILL_ON_PERMIT or FULLFILL_ON_DENY


m_id

protected java.lang.String m_id
Field id carries the id of this obligation. The id must only be unique whithin the scope of an PDPResponse.


m_attributes

protected Attributes m_attributes
Field attributes carries a collection of attributes with type Attribute.

Constructor Detail

Obligation

public Obligation(int fullFillOn,
                  java.lang.String id,
                  java.util.Collection attributes)
           throws java.lang.NullPointerException,
                  java.lang.IllegalArgumentException
Creates an obligation. The attributes parameter is internal copied and attributes with duplicated keys are not supported. The objects in attributes must be of type Attribute.

Parameters:
fullFillOn - the decision on which the obligation has to be fulfilled.
id - the id of the obligation.
attributes - a collection of attributes.
Throws:
java.lang.IllegalArgumentException - if fullFillOn is out of range, or the attributes are not subclasses of Attribute
java.lang.NullPointerException - if id or attributes is null.
Method Detail

checkFullFillOn

protected void checkFullFillOn(int fullFillOn)
                        throws java.lang.IllegalArgumentException
Checks the fullfill on parameter in the constructor. Subclasses can override this method to support other full fill on flags.

Parameters:
fullFillOn - the full fill on parameter
Throws:
java.lang.IllegalArgumentException - if fullFillOn is out of range.
See Also:
Obligation(int,String,java.util.Collection)

getFullFillOn

public int getFullFillOn()
Returns:
Returns the fullFillOn Flag.
See Also:
FULLFILL_ON_DENY, FULLFILL_ON_PERMIT

getId

public java.lang.String getId()
Returns:
Returns the id.

isFullFillOnPermit

public boolean isFullFillOnPermit()
Method gets the fullFillOnPermit.

Returns:
boolean.

isFullFillOnDeny

public boolean isFullFillOnDeny()
Method gets the fullFillOnDeny.

Returns:
boolean.

equals

public boolean equals(java.lang.Object o)
Method equals checks for value equality of two obligation objects.

Overrides:
equals in class java.lang.Object
Parameters:
o - of type Object
Returns:
boolean

hashCode

public int hashCode()
Method hashCode generates a hashcode for this obligation.

Overrides:
hashCode in class java.lang.Object
Returns:
int

toString

public java.lang.String toString()
Method toString generates a simple object info string, used only for logging purpose.

Overrides:
toString in class java.lang.Object
Returns:
String

getAttributes

public java.util.Collection getAttributes()
Gets the attributes. The collection is unmodifiable.

Returns:
returns the attributes.

containsAttribute

public boolean containsAttribute(java.lang.String key)
Returns true if an attribute with the given key is present.

Parameters:
key - a key, asserted to be not null.
Returns:
true if attribute with key is present.

getAttribute

public Attribute getAttribute(java.lang.String key)
Gets an Attribute for a given key.

Parameters:
key - the key of the attribute.
Returns:
the found attribute or null if nothing is found.


Copyright © 2004-2009 52north.org. All Rights Reserved.