public class Result extends Object
ResponseCtx. This class encodes the
decision effect, as well as an optional resource identifier and optional
status data. Any number of obligations may also be included.| Modifier and Type | Field and Description |
|---|---|
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_NOT_APPLICABLE
The decision that nothing applied to us
|
static int |
DECISION_PERMIT
The decision to permit the request
|
static String[] |
DECISIONS |
| Constructor and Description |
|---|
Result(int decision)
Constructs a
Result object with default status data (OK). |
Result(int decision,
Set obligations)
Constructs a
Result object with default status data (OK),
and obligations, but no resource identifier. |
Result(int decision,
Status status)
Constructs a
Result object with status data but without a
resource identifier. |
Result(int decision,
Status status,
Set obligations)
Constructs a
Result object with status data and obligations
but without a resource identifier. |
Result(int decision,
Status status,
String resource)
Constructs a
Result object with status data and a
resource identifier. |
Result(int decision,
Status status,
String resource,
Set obligations)
Constructs a
Result object with status data, a
resource identifier, and obligations. |
Result(int decision,
String resource)
Constructs a
Result object with a resource identifier,
but default status data (OK). |
Result(int decision,
String resource,
Set obligations)
Constructs a
Result object with a resource identifier,
and obligations, but default status data (OK). |
| Modifier and Type | Method and Description |
|---|---|
void |
addObligation(Obligation obligation)
Adds an obligation to the set of obligations that the PEP must fulfill
|
void |
encode(OutputStream output)
Encodes this
Result into its XML form and writes this
out to the provided OutputStream |
void |
encode(OutputStream output,
Indenter indenter)
Encodes this
Result into its XML form and writes this
out to the provided OutputStream |
int |
getDecision()
Returns the decision associated with this
Result. |
static Result |
getInstance(Node root)
Creates a new instance of a
Result based on the given
DOM root node. |
Set |
getObligations()
Returns the set of obligations that the PEP must fulfill, which may
be empty.
|
String |
getResource()
Returns the resource to which this Result applies, or null if none
is specified.
|
Status |
getStatus()
Returns the status data included in this
Result. |
boolean |
setResource(String resource)
Sets the resource identifier if it has not already been set before.
|
public static final int DECISION_PERMIT
public static final int DECISION_DENY
public static final int DECISION_INDETERMINATE
public static final int DECISION_NOT_APPLICABLE
public static final String[] DECISIONS
public Result(int decision)
throws IllegalArgumentException
Result object with default status data (OK).decision - the decision effect to include in this result. This
must be one of the four fields in this class.IllegalArgumentException - if decision is not validpublic Result(int decision,
Set obligations)
throws IllegalArgumentException
Result object with default status data (OK),
and obligations, but no resource identifier.decision - the decision effect to include in this result. This
must be one of the four fields in this class.obligations - the obligations the PEP must handleIllegalArgumentException - if decision is not validpublic Result(int decision,
Status status)
throws IllegalArgumentException
Result object with status data but without a
resource identifier. Typically the decision is DECISION_INDETERMINATE
in this case, though that's not always true.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 resultIllegalArgumentException - if decision is not validpublic Result(int decision,
Status status,
Set obligations)
throws IllegalArgumentException
Result object with status data and obligations
but without a resource identifier. Typically the decision is
DECISION_INDETERMINATE in this case, though that's not always true.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 resultobligations - the obligations the PEP must handleIllegalArgumentException - if decision is not validpublic Result(int decision,
String resource)
throws IllegalArgumentException
Result object with a resource identifier,
but default status data (OK). The resource being named must match
the resource (or a descendent of the resource in the case of a
hierarchical resource) from the associated request.decision - the decision effect to include in this result. This
must be one of the four fields in this class.resource - a String naming the resourceIllegalArgumentException - if decision is not validpublic Result(int decision,
String resource,
Set obligations)
throws IllegalArgumentException
Result object with a resource identifier,
and obligations, but default status data (OK). The resource being named
must match the resource (or a descendent of the resource in the case of
a hierarchical resource) from the associated request.decision - the decision effect to include in this result. This
must be one of the four fields in this class.resource - a String naming the resourceobligations - the obligations the PEP must handleIllegalArgumentException - if decision is not validpublic Result(int decision,
Status status,
String resource)
throws IllegalArgumentException
Result object with status data and a
resource identifier.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 resultresource - a String naming the resourceIllegalArgumentException - if decision is not validpublic Result(int decision,
Status status,
String resource,
Set obligations)
throws IllegalArgumentException
Result object with status data, a
resource identifier, and obligations.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 resultresource - a String naming the resourceobligations - the obligations the PEP must handleIllegalArgumentException - if decision is not validpublic static Result getInstance(Node root) throws ParsingException
Result based on the given
DOM root node. A ParsingException is thrown if the DOM
root doesn't represent a valid ResultType.root - the DOM root of a ResultTypeResultParsingException - if the node is invalidpublic int getDecision()
Result. This
will be one of the four DECISION_* fields in this class.public Status getStatus()
Result.
Typically this will be STATUS_OK except when the decision
is INDETERMINATE.public String getResource()
public boolean setResource(String resource)
resource - the resource identifierpublic Set getObligations()
public void addObligation(Obligation obligation)
obligation - the Obligation to addpublic void encode(OutputStream output)
Result into its XML form and writes this
out to the provided OutputStream with no indentation.output - a stream into which the XML-encoded data is writtenpublic void encode(OutputStream output, Indenter indenter)
Result into its XML form and writes this
out to the provided OutputStream with indentation.output - a stream into which the XML-encoded data is writtenindenter - an object that creates indentation stringsCopyright © 2012 JBoss, a division of Red Hat, Inc.. All Rights Reserved.