com.kpro.dataobjects
Class PolicyObject

java.lang.Object
  extended by com.kpro.dataobjects.PolicyObject
All Implemented Interfaces:
java.io.Serializable, java.lang.Iterable<Case>

public class PolicyObject
extends java.lang.Object
implements java.io.Serializable, java.lang.Iterable<Case>

The PolicyObject class acts to hold all the relevent information for a given policy. This informations is broken into 'cases' (see the 'case' class- different items, indexed by datatype), the context (see the 'context' class- holds information that applies to whole policy), and action (see the 'action' class- holds the action taken).

Author:
ernie, ngerstle
See Also:
Serialized Form

Field Summary
private  Action actionTaken
           
private  java.util.ArrayList<Case> cases
           
private  Context context
           
private  java.util.HashMap<java.lang.String,java.lang.String> entity
           
private static long serialVersionUID
          added generated serial id from warning on implementing serializable
 
Constructor Summary
PolicyObject()
          This is the constructor The constructor initializes the variables within the class when you make a new instance of it
 
Method Summary
 void addCase(Case c)
          Adds a case to the policy
 void addEntityData(java.lang.String key, java.lang.String value)
          Adds a data to the entity hashmap of the policy
 boolean equalsCases(PolicyObject newpol)
          A simple true/false check to see if policies are identical- if all the strings inside them are, then the policies are.
 Action getAction()
           
 Case getCase(int i)
          Returns a specific case for the policy
 java.util.ArrayList<Case> getCases()
          Returns all cases for the policy
 Context getContext()
           
 java.lang.String getContextDomain()
          returns domain of policy (URL) as string.
 java.util.HashMap<java.lang.String,java.lang.String> getEntities()
          Returns the entity for the policy
 java.lang.String getEntity(java.lang.String key)
          Returns the entity data for a specific key
 java.util.Iterator<Case> iterator()
           
 PolicyObject setAction(Action action)
           
 void setContext(Context context)
           
 java.lang.String toString()
          This is based on the debug_print
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
added generated serial id from warning on implementing serializable

See Also:
Constant Field Values

entity

private java.util.HashMap<java.lang.String,java.lang.String> entity

cases

private java.util.ArrayList<Case> cases

actionTaken

private Action actionTaken

context

private Context context
Constructor Detail

PolicyObject

public PolicyObject()
This is the constructor The constructor initializes the variables within the class when you make a new instance of it

Method Detail

getContext

public Context getContext()

setContext

public void setContext(Context context)

getAction

public Action getAction()

setAction

public PolicyObject setAction(Action action)

addCase

public void addCase(Case c)
Adds a case to the policy

Parameters:
c - input Case

addEntityData

public void addEntityData(java.lang.String key,
                          java.lang.String value)
Adds a data to the entity hashmap of the policy

Parameters:
key - input String
value - input String

getCase

public Case getCase(int i)
Returns a specific case for the policy

Parameters:
i - input int
Returns:
Case

getCases

public java.util.ArrayList<Case> getCases()
Returns all cases for the policy

Returns:
ArrayList

getEntities

public java.util.HashMap<java.lang.String,java.lang.String> getEntities()
Returns the entity for the policy

Returns:
HashMap

getEntity

public java.lang.String getEntity(java.lang.String key)
Returns the entity data for a specific key

Parameters:
key - input String
String -

getContextDomain

public java.lang.String getContextDomain()
returns domain of policy (URL) as string.

Returns:
the domain/url from which the policy came.

toString

public java.lang.String toString()
This is based on the debug_print

Overrides:
toString in class java.lang.Object

equalsCases

public boolean equalsCases(PolicyObject newpol)
A simple true/false check to see if policies are identical- if all the strings inside them are, then the policies are.

Parameters:
newpol - the policy to compare 'this' to
Returns:
boolean; true if getContextDomains are equal and getCases() are equal (two string comparisons) else false.

iterator

public java.util.Iterator<Case> iterator()
Specified by:
iterator in interface java.lang.Iterable<Case>