org.wso2.balana.ctx
Class AbstractResult

java.lang.Object
  extended by org.wso2.balana.ctx.AbstractResult
Direct Known Subclasses:
Result, Result

public abstract class AbstractResult
extends Object

Abstract Represents the ResultType XML object from the Context schema. Any number of these may included in a ResponseCtx. This class provides an abstract method to encode XACML result with the decision effect, as well as an optional status data and obligations and advices. encode method must be implemented under the concert class.


Field Summary
protected  List<Advice> advices
          List of advices which may be empty
protected  int decision
          the decision effect
static int DECISION_DENY
          The decision to deny the request
static int DECISION_INDETERMINATE
          The decision that a decision about the request cannot be made
static int DECISION_INDETERMINATE_DENY
          The decision that a decision about the request cannot be made
static int DECISION_INDETERMINATE_DENY_OR_PERMIT
          The decision that a decision about the request cannot be made
static int DECISION_INDETERMINATE_PERMIT
          The decision that a decision about the request cannot be made
static int DECISION_NOT_APPLICABLE
          The decision that nothing applied to us
static int DECISION_PERMIT
          The decision to permit the request
static String[] DECISIONS
          string versions of the 4 Decision types used for encoding
protected  List<ObligationResult> obligations
          List of obligations which may be empty
protected  Status status
          the status data
protected  int version
          XACML version
 
Constructor Summary
AbstractResult(int decision, Status status, int version)
          Constructs a AbstractResult object with decision status data, obligations, advices and evaluation ctx
AbstractResult(int decision, Status status, List<ObligationResult> obligationResults, List<Advice> advices, int version)
          Constructs a AbstractResult object with decision status data, obligations, advices and evaluation ctx
 
Method Summary
 String encode()
          Encodes this AbstractResult into its XML form
abstract  void encode(StringBuilder builder)
          Encodes this AbstractResult into its XML form and writes this out to the provided StringBuilder
 List<Advice> getAdvices()
          Returns the set of advice that the PEP must fulfill, which may be empty.
 int getDecision()
          Returns the decision associated with this Result.
 List<ObligationResult> getObligations()
          Returns the set of obligations that the PEP must fulfill, which may be empty.
 Status getStatus()
          Returns the status data included in this Result.
 int getVersion()
          Gets XACML version
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DECISION_PERMIT

public static final int DECISION_PERMIT
The decision to permit the request

See Also:
Constant Field Values

DECISION_DENY

public static final int DECISION_DENY
The decision to deny the request

See Also:
Constant Field Values

DECISION_INDETERMINATE

public static final int DECISION_INDETERMINATE
The decision that a decision about the request cannot be made

See Also:
Constant Field Values

DECISION_NOT_APPLICABLE

public static final int DECISION_NOT_APPLICABLE
The decision that nothing applied to us

See Also:
Constant Field Values

DECISION_INDETERMINATE_DENY

public static final int DECISION_INDETERMINATE_DENY
The decision that a decision about the request cannot be made

See Also:
Constant Field Values

DECISION_INDETERMINATE_PERMIT

public static final int DECISION_INDETERMINATE_PERMIT
The decision that a decision about the request cannot be made

See Also:
Constant Field Values

DECISION_INDETERMINATE_DENY_OR_PERMIT

public static final int DECISION_INDETERMINATE_DENY_OR_PERMIT
The decision that a decision about the request cannot be made

See Also:
Constant Field Values

DECISIONS

public static final String[] DECISIONS
string versions of the 4 Decision types used for encoding


obligations

protected List<ObligationResult> obligations
List of obligations which may be empty


advices

protected List<Advice> advices
List of advices which may be empty


decision

protected int decision
the decision effect


status

protected Status status
the status data


version

protected int version
XACML version

Constructor Detail

AbstractResult

public AbstractResult(int decision,
                      Status status,
                      int version)
               throws IllegalArgumentException
Constructs a AbstractResult object with decision status data, obligations, advices and evaluation ctx

Parameters:
decision - the decision effect to include in this result. This must be one of the four fields in this class.
status - the Status to include in this result
version - XACML version
Throws:
IllegalArgumentException - if decision is not valid

AbstractResult

public AbstractResult(int decision,
                      Status status,
                      List<ObligationResult> obligationResults,
                      List<Advice> advices,
                      int version)
               throws IllegalArgumentException
Constructs a AbstractResult object with decision status data, obligations, advices and evaluation ctx

Parameters:
decision - the decision effect to include in this result. This must be one of the four fields in this class.
status - the Status to include in this result
obligationResults - a list of ObligationResult objects
advices - a list of Advice objects
version - XACML version
Throws:
IllegalArgumentException - if decision is not valid
Method Detail

getObligations

public List<ObligationResult> getObligations()
Returns the set of obligations that the PEP must fulfill, which may be empty.

Returns:
the set of Obligation

getAdvices

public List<Advice> getAdvices()
Returns the set of advice that the PEP must fulfill, which may be empty.

Returns:
the set of Advice

getDecision

public int getDecision()
Returns the decision associated with this Result. This will be one of the four DECISION_* fields in this class.

Returns:
the decision effect

getStatus

public Status getStatus()
Returns the status data included in this Result. Typically this will be STATUS_OK except when the decision is INDETERMINATE.

Returns:
status associated with this Result

getVersion

public int getVersion()
Gets XACML version

Returns:
XACML version id

encode

public String encode()
Encodes this AbstractResult into its XML form

Returns:
String

encode

public abstract void encode(StringBuilder builder)
Encodes this AbstractResult into its XML form and writes this out to the provided StringBuilder

Parameters:
builder - string stream into which the XML-encoded data is written


Copyright © 2015 WSO2. All rights reserved.