@Deprecated public class Rule extends Object implements Cloneable
Rule
provides interfaces to manage
a rule that can be added to a policy.
A rule constains the rule name, service type,
a resource and a map containing action names and action values.Modifier and Type | Field and Description |
---|---|
static String |
EMPTY_RESOURCE_NAME
Deprecated.
Empty resource name.
|
Modifier | Constructor and Description |
---|---|
protected |
Rule()
Deprecated.
Contruct a
Rule . |
protected |
Rule(Node ruleNode)
Deprecated.
Constructor to create a
Rule object from a XML Node. |
|
Rule(String serviceName,
Map actions)
Deprecated.
Constructor to create a rule object with the
service name and actions.
|
|
Rule(String serviceName,
String resourceName,
Map actions)
Deprecated.
Constructor to create a rule object with the
service name, resource name and actions.
|
|
Rule(String ruleName,
String serviceName,
String resourceName,
Map actions)
Deprecated.
Constructor to create a rule object with rule name,
service name, resource name and actions.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Deprecated.
Creates and returns a copy of this object.
|
boolean |
equals(Object obj)
Deprecated.
Checks if two rule objects are identical.
|
Set |
getActionNames()
Deprecated.
Returns the action names that have been set for the rule.
|
Map |
getActionValues()
Deprecated.
Returns a
Map of all action names and their
corresponding action values that have been set in the rule. |
Set |
getActionValues(String actionName)
Deprecated.
Returns a set of action values that have been set for the
specified action name.
|
String |
getApplicationName()
Deprecated.
Returns application name.
|
String |
getName()
Deprecated.
Returns the name assigned to the rule.
|
String |
getResourceName()
Deprecated.
Returns the resource name for which the rule has been created.
|
Set<String> |
getResourceNames()
Deprecated.
Returns the resource names for which the rule has been created.
|
protected ServiceType |
getServiceType()
Deprecated.
Returns service type of this rules.
|
String |
getServiceTypeName()
Deprecated.
Returns the service name for which the rule has been created.
|
int |
hashCode()
Deprecated.
This added by when CheckStyle noticed there was an implementation of
equals without an implementation of hashCode - usually a recipe for
disaster.
|
ResourceMatch |
isResourceMatch(String serviceName,
String resourceName)
Deprecated.
Compares the given service and resource names with the
service and resource name specified in this rule.
|
void |
setActionValues(Map actionValues)
Deprecated.
Sets the action names and their corresponding actions values
(or permissions) for the resource or the service.
|
void |
setApplicationName(String applicationName)
Deprecated.
Sets application Name.
|
void |
setName(String ruleName)
Deprecated.
Sets the name for the rule.
|
void |
setResourceNames(Set<String> resourceNames)
Deprecated.
Sets the resource names for which the rule has been created.
|
protected String |
toResourcesXml(String policyName)
Deprecated.
Returns an XML respresentation of the rule with policy name to
use in resource index tree.
|
String |
toString()
Deprecated.
Returns xml string representation of the rule.
|
String |
toXML()
Deprecated.
Returns an XML string representing the rule.
|
public static final String EMPTY_RESOURCE_NAME
protected Rule()
Rule
.public Rule(String serviceName, String resourceName, Map actions) throws NameNotFoundException, InvalidNameException
Map
must have the action
name as key and a Set
of String
s
as its value. The action names and action values must
conform to the schema specified for the service.
Otherwise, InvalidNameException
is thrown. The parameters ruleName
and resourceName
can be null
.serviceName
- name of the service type as defined by
the service schemaresourceName
- name of the resource for the service typeactions
- map of action and action values for the resourceNameNotFoundException
- the service name provided does
not existInvalidNameException
- the resource name, action name,
or values is not validpublic Rule(String serviceName, Map actions) throws NameNotFoundException, InvalidNameException
Map
must have the action
name as it key and a Set
of String
s
as its value. The action names and action values must
conform to the schema specified for the service.
Otherwise, InvalidNameException
is thrown. The parameters ruleName
and resourceName
can be null
.serviceName
- name of the service type as defined by
the service schemaactions
- map of action and action values for the resourceNameNotFoundException
- the service name provided does
not existInvalidNameException
- the resource name, action name,
or values is not validpublic Rule(String ruleName, String serviceName, String resourceName, Map actions) throws NameNotFoundException, InvalidNameException
Map
must have the action
name as it key and a Set
of String
s
as its value. The action names and action values must
conform to the service schema.
Otherwise, InvalidNameException
is thrown. The parameters ruleName
and resourceName
can be null
.ruleName
- name of the ruleserviceName
- name of the service type as defined by
the service schemaresourceName
- name of the resource for the service typeactions
- map of action and action values for the resourceNameNotFoundException
- the service name provided does
not existInvalidNameException
- the resource name, action name,
or values is not validprotected Rule(Node ruleNode) throws InvalidFormatException, InvalidNameException, NameNotFoundException
Rule
object from a XML Node.ruleNode
- XML node representation of Rule
InvalidFormatException
- on invalid xmlInvalidNameException
- thrown by called routinesNameNotFoundException
- thrown by called routinespublic void setApplicationName(String applicationName)
applicationName
- Application name.public String getApplicationName()
public String getName()
null
if it was not constructed with a name.public void setName(String ruleName) throws InvalidNameException
ruleName
- rule name.InvalidNameException
- if rule name is invalid.public String getServiceTypeName()
public String getResourceName()
null
. The resource name of
the rule cannot be changed once the rule is created.public Set<String> getResourceNames()
null
. The resource name of
the rule cannot be changed once the rule is created.public void setResourceNames(Set<String> resourceNames)
null
. The resource name of
the rule cannot be changed once the rule is created.resourceNames
- resource namepublic Set getActionNames()
public Set getActionValues(String actionName) throws NameNotFoundException
actionName
- action name for which to compute values.NameNotFoundException
- if actions name is not
found in the rulepublic Map getActionValues()
Map
of all action names and their
corresponding action values that have been set in the rule.
The "key" of the Map
will be the action name
as a string, and its "value" will be a Set
which contains the action values as strings.public void setActionValues(Map actionValues) throws InvalidNameException
actionValues
- action names and their corresponding valuesInvalidNameException
- if action name is invalid.public boolean equals(Object obj)
public int hashCode()
public ResourceMatch isResourceMatch(String serviceName, String resourceName)
ResourceMatch
object which
specifies if the resources match exactly, do not match, or one
of them is a subordinate resource of the other. If the
service name does not match, the method returns
NO_MATCH
.serviceName
- name of the serviceresourceName
- name of the resourceResourceMatch
that
specifies if the service name and resource name are exact match, or
otherwise.public String toXML()
protected ServiceType getServiceType()
protected String toResourcesXml(String policyName)
policyName
- policy name to use while creating xml representationpublic String toString()
public Object clone()
Rule
object will have the same rule
name, resource, service name, and actions
such that x.clone().equals(x)
will be
true
. However x.clone()
will not be the same as x
, i.e.,
x.clone() != x
.Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.