Class GenericAttributeProviderBasedAttributeDesignatorExpression<AV extends AttributeValue>
- java.lang.Object
-
- org.ow2.authzforce.core.pdp.api.expression.GenericAttributeProviderBasedAttributeDesignatorExpression<AV>
-
- Type Parameters:
AV
- AttributeDesignator evaluation result value's primitive datatype
- All Implemented Interfaces:
AttributeDesignatorExpression<AV>
,Expression<Bag<AV>>
public final class GenericAttributeProviderBasedAttributeDesignatorExpression<AV extends AttributeValue> extends Object implements AttributeDesignatorExpression<AV>
AttributeDesignator evaluator initialized with and using anAttributeProvider
to retrieve the attribute value not only from the request but also possibly from extra Attribute Provider modules (so-called XACML PIPs) (PDP extensions)- Version:
- $Id: $
-
-
Constructor Summary
Constructors Constructor Description GenericAttributeProviderBasedAttributeDesignatorExpression(oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeDesignatorType attrDesignator, BagDatatype<AV> resultDatatype, AttributeProvider attrProvider)
Return an instance of an AttributeDesignator based on an AttributeDesignatorType
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
Equal iff the Attribute Category/Issuer/Id are equalBag<AV>
evaluate(EvaluationContext context)
Evaluates the expression using the given context.AttributeFqn
getAttributeFQN()
Get Attribute Category/Issuer/IdDatatype<Bag<AV>>
getReturnType()
Gets the expected return type of the expression if evaluated.Optional<Bag<AV>>
getValue()
Get the constant value of this expression if it has a constant value, i.e.int
hashCode()
boolean
isNonEmptyBagRequired()
Indicates whether the attribute's presence is required, i.e.String
toString()
-
-
-
Constructor Detail
-
GenericAttributeProviderBasedAttributeDesignatorExpression
public GenericAttributeProviderBasedAttributeDesignatorExpression(oasis.names.tc.xacml._3_0.core.schema.wd_17.AttributeDesignatorType attrDesignator, BagDatatype<AV> resultDatatype, AttributeProvider attrProvider)
Return an instance of an AttributeDesignator based on an AttributeDesignatorType- Parameters:
attrDesignator
- the AttributeDesignatorType we want to convertresultDatatype
- expected datatype of the result of evaluating this AttributeDesignator (AV is the expected type of every element in the bag
)attrProvider
- Attribute Provider responsible for finding the attribute designated by this in a given evaluation context at runtime- Throws:
IllegalArgumentException
- ifattrDesignator.getCategory() == null || attrDesignator.getAttributeId() == null
-
-
Method Detail
-
getValue
public Optional<Bag<AV>> getValue()
Get the constant value of this expression if it has a constant value, i.e. independent from the evaluation context (e.g. AttributeValue, VariableReference to AttributeValue...). This is equivalent to callExpression.evaluate(EvaluationContext)
withcontext == null
. This enables expression consumers to do optimizations, e.g. functions may pre-compile/pre-evaluate parts of their inputs knowing some are constant values.- Specified by:
getValue
in interfaceExpression<AV extends AttributeValue>
- Returns:
- the constant value iff the expression has a static/fixed/constant value, else no present value. NB: Null is not considered/possible as a constant value for expressions.
-
getAttributeFQN
public AttributeFqn getAttributeFQN()
Description copied from interface:AttributeDesignatorExpression
Get Attribute Category/Issuer/Id- Specified by:
getAttributeFQN
in interfaceAttributeDesignatorExpression<AV extends AttributeValue>
- Returns:
- attribute GUID (category, issuer, ID)
-
isNonEmptyBagRequired
public boolean isNonEmptyBagRequired()
Description copied from interface:AttributeDesignatorExpression
Indicates whether the attribute's presence is required, i.e. it must have at least one value in this context (non-empty bag). Equivalent of XACML MustBePresent flag.- Specified by:
isNonEmptyBagRequired
in interfaceAttributeDesignatorExpression<AV extends AttributeValue>
- Returns:
- true iff the resulting bag must be non-empty, i.e. there must be at least one value for this attribute in the context
-
evaluate
public Bag<AV> evaluate(EvaluationContext context) throws IndeterminateEvaluationException
Evaluates the expression using the given context. Evaluates the pre-assigned meta-data against the given context, trying to find some matching values.- Specified by:
evaluate
in interfaceExpression<AV extends AttributeValue>
- Parameters:
context
- the representation of the request- Returns:
- the result of evaluation that may be a single value T (e.g. function result, AttributeValue, Condition, Match...) or bag of values (e.g. AttributeDesignator, AttributeSelector)
- Throws:
IndeterminateEvaluationException
- if evaluation is "Indeterminate" (see XACML core specification)
-
getReturnType
public Datatype<Bag<AV>> getReturnType()
Gets the expected return type of the expression if evaluated.- Specified by:
getReturnType
in interfaceExpression<AV extends AttributeValue>
- Returns:
- expression evaluation's return type
-
-