public class Conditions extends Object
Conditions
provides methods to maintain
a collection of Condition
objects that
apply to a Policy
. This class provides methods to add, replace
and remove Condition
objects from this condition collection.
The Policy
object provides methods to set
Conditions
, which identifies conditions that apply
to the policyModifier | Constructor and Description |
---|---|
protected |
Conditions(ConditionTypeManager ctm,
Node conditionsNode)
Constructor used by
Policy to obtain
an instance of Conditions from W3C DOM
representation of the object. |
|
Conditions(String name,
String description)
Constructor to obtain an instance of
Conditions
to hold collection of conditions represented as
Condition |
Modifier and Type | Method and Description |
---|---|
void |
addCondition(Condition condition)
Adds a
Condition object to the this instance
of condition collection. |
void |
addCondition(String conditionName,
Condition condition)
Adds a
Condition object to the this instance
of conditions collection. |
Object |
clone()
Returns a new copy of this object with the identical
set of conditions collections (conditions).
|
boolean |
equals(Object o)
Checks if two
Conditions are identical. |
Condition |
getCondition(String conditionName)
Returns the
Condition object associated
with the given condition name. |
String |
getConditionName(Condition condition)
Returns the name associated with the given condition object.
|
Set |
getConditionNames()
Returns the names of
Condition objects
contained in this object. |
String |
getDescription()
Returns the description for the collection of conditions
represented as
Condition |
String |
getName()
Returns the name for the collection of conditions
represented as
Condition |
boolean |
isAllowed(SSOToken token,
Map env)
Checks whether the effective result of conditions is an allow or deny.
|
Condition |
removeCondition(Condition condition)
Removes the
Condition object identified by
object's equals method. |
Condition |
removeCondition(String conditionName)
Removes the
Condition object identified by
the condition name. |
void |
replaceCondition(String conditionName,
Condition condition)
Replaces an existing condition object having the same name
with the new one.
|
void |
setDescription(String description)
Sets the description for this instance of the
Conditions which contains a collection
of conditions respresented as Condition . |
void |
setName(String name)
Sets the name for this instance of the
Conditions |
String |
toString()
Returns XML string representation of the condition
(conditions collection) object.
|
protected String |
toXML()
Returns XML string representation of the condition
(conditions collection) object.
|
protected Conditions(ConditionTypeManager ctm, Node conditionsNode) throws InvalidFormatException, InvalidNameException, NameNotFoundException, PolicyException
Policy
to obtain
an instance of Conditions
from W3C DOM
representation of the object.ctm
- ConditionTypeManager
providing methods to handle the Conditions
.conditionsNode
- node that represents the ConditionsInvalidFormatException
InvalidNameException
NameNotFoundException
PolicyException
public String getName()
Condition
public String getDescription()
Condition
public void setName(String name)
Conditions which contains a collection
of conditions respresented as Condition
.
name
- for the collection of conditionspublic void setDescription(String description)
Conditions
which contains a collection
of conditions respresented as Condition
.description
- description for the collection conditionspublic Set getConditionNames()
Condition
objects
contained in this object.Condition
contained in
this objectpublic Condition getCondition(String conditionName) throws NameNotFoundException
Condition
object associated
with the given condition name.conditionName
- name of the condition objectNameNotFoundException
- if a condition
with the given name is not presentpublic void addCondition(Condition condition) throws NameAlreadyExistsException
Condition
object to the this instance
of condition collection. Since the name is not provided it
will be dynamically assigned such that it is unique within
this instance of the condition collection. However if a
condition entry with the same name already exists in the
condition collection NameAlreadyExistsException
will be thrown.condition
- instance of the condition object added to this
collectionNameAlreadyExistsException
- throw if a
condition object is present with the same namepublic void addCondition(String conditionName, Condition condition) throws NameAlreadyExistsException
Condition
object to the this instance
of conditions collection. If another condition with the same
name already exists in the conditions collection
NameAlreadyExistsException
will be thrown.conditionName
- name for the condition instancecondition
- instance of the condition object added to this
collectionNameAlreadyExistsException
- if a
condition object is present with the same namepublic void replaceCondition(String conditionName, Condition condition) throws NameNotFoundException
Condition
with the given
name does not exist, NameNotFoundException
will be thrown.conditionName
- name for the condition instancecondition
- instance of the condition object that will
replace another condition object having the given nameNameNotFoundException
- if a condition instance
with the given name is not presentpublic Condition removeCondition(String conditionName)
Condition
object identified by
the condition name. If a condition instance with the given
name does not exist, the method will return silently.conditionName
- name of the condition instance that
will be removed from the conditions collectionpublic Condition removeCondition(Condition condition)
Condition
object identified by
object's equals
method. If a condition instance
does not exist, the method will return silently.condition
- condition object that
will be removed from the conditions collectionpublic String getConditionName(Condition condition)
equals
method on the condition
to determine equality. If a condition instance that matches
the given condition object is not present, the method
returns null
.condition
- condition object for which this method will
return its associated namenull
if not presentpublic boolean equals(Object o)
Conditions
are identical.
Two conditions (or conditions collections) are identical only
if both have the same set of Condition
objects.public Object clone()
public boolean isAllowed(SSOToken token, Map env) throws PolicyException, SSOException
token
- single sign on token of the userenv
- a map of key/value pairs containing any information
that could be used by each contraint to evaluate
the allow/deny resulttrue
if the effective result is an allow.
Otherwise false
.PolicyException
- if an error occuredSSOException
- if the token is invalidpublic String toString()
protected String toXML()
Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.