public class PolicyContext
extends java.lang.Object
Defines a set of methods that can be used by the current Policy's rule executed to get details from the Policy Engine. For example, the object that the policy is applied to, the event that triggered the policy etc.
Every time a policy is executed in the policy engine, an instance of this class is instantiated with the relevant details.
Constructor and Description |
---|
PolicyContext(javax.xml.registry.infomodel.RegistryObject regObject)
Constructs
PolicyContext object. |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
addContextInfo(java.lang.String key,
java.lang.Object value)
Adds a parameter (key-value pair) to the PolicyContext.
|
java.util.Map<java.lang.String,java.lang.Object> |
getAdditionalInfo()
Returns a Map representation of the additional parameters set by Handler and Collector frameworks.
|
javax.xml.registry.infomodel.RegistryObject |
getAppliedObject()
Returns the RegistryObject in which the policy is applied.
|
java.lang.String |
getAppliedObjectId()
Returns the string representation of the RegistryObject that is applied.
|
java.util.List<javax.xml.registry.infomodel.RegistryObject> |
getAppliedObjects()
Returns all the objects that are applicable for the onTrigger event that triggered the policy Execution.
|
java.util.Map<java.lang.String,java.lang.Object> |
getContextInfo()
Returns the instance of java.util.Map that contains custom parameters set by the Policy Engine.
|
java.lang.Object |
getContextInfo(java.lang.String key)
Returns the value for the given key set by the Policy Engine.
|
javax.xml.registry.infomodel.Concept |
getEventType()
Returns the Event that triggered the policy execution.
|
java.util.Date |
getExecutionDate()
Returns the execution date in the Date format.
|
Policy |
getPolicy()
Returns the current policy instance that is being executed.
|
java.util.List<com.centrasite.jaxr.importexport.IEventCallback> |
getPolicyCallbackList()
Returns the Import/Export related callback instances if applicable.
|
java.lang.String |
getSessionId()
Returns the session ID from the Policy Engine.
|
javax.xml.registry.infomodel.User |
getUser()
Returns the user who performed an action that resulted in the policy execution.
|
void |
setAdditionalInfo(java.util.Map<java.lang.String,java.lang.Object> additionalInfo)
Sets a Map representation of the additional parameters set by Handler and Collector frameworks.
|
void |
setAppliedObject(javax.xml.registry.infomodel.RegistryObject appliedObject)
Sets the RegistryObject in which the policy is applied.
|
void |
setAppliedObjects(java.util.List<javax.xml.registry.infomodel.RegistryObject> appliedObjects)
Sets a Map representation of the additional parameters set by Handler and Collector frameworks.
|
void |
setContextInfo(java.util.Map<java.lang.String,java.lang.Object> contextInfo)
A set of parameters (key-value pairs) to the PolicyContext.
|
void |
setEventType(javax.xml.registry.infomodel.Concept eventType)
A set of parameters (key-value pairs) to the PolicyContext.
|
void |
setPolicy(Policy policy)
Sets the current policy instance that is being executed.
|
void |
setPolicyCallbackList(java.util.List<com.centrasite.jaxr.importexport.IEventCallback> policyCallbackList)
Sets the Import/Export callback instances.
|
void |
setSessionId(java.lang.String sessionId)
Set the current session ID.
|
void |
setUser(javax.xml.registry.infomodel.User user)
Sets the user who performed an action that resulted in the policy execution.
|
java.lang.String |
toString()
Returns the String representation of the PolicyContext.
|
public PolicyContext(javax.xml.registry.infomodel.RegistryObject regObject)
PolicyContext
object.regObject
- JAXR representation of the object in which the policy is applied.public javax.xml.registry.infomodel.RegistryObject getAppliedObject()
public void setAppliedObject(javax.xml.registry.infomodel.RegistryObject appliedObject)
appliedObject
- - JAXR representation of the object in which the policy is appliedpublic java.lang.String getAppliedObjectId()
public java.lang.String getSessionId()
public void setSessionId(java.lang.String sessionId)
sessionId
- - Session ID from the Policy Enginepublic javax.xml.registry.infomodel.User getUser()
public void setUser(javax.xml.registry.infomodel.User user)
user
- - JAXR representation of the user who performed an action that resulted in the policy execution.public Policy getPolicy()
public void setPolicy(Policy policy)
policy
- - Policy instance that is being executed.public java.util.Map<java.lang.String,java.lang.Object> getContextInfo()
public java.lang.Object getContextInfo(java.lang.String key)
key
- - String representation of the keypublic java.lang.Object addContextInfo(java.lang.String key, java.lang.Object value)
key
- - String representation of the keyvalue
- - String representation of the valuepublic void setContextInfo(java.util.Map<java.lang.String,java.lang.Object> contextInfo)
contextInfo
- - Parameters represented in key-value pairspublic javax.xml.registry.infomodel.Concept getEventType()
public void setEventType(javax.xml.registry.infomodel.Concept eventType)
eventType
- - Policy event type represented in Conceptpublic java.lang.String toString()
toString
in class java.lang.Object
public java.util.Date getExecutionDate()
public java.util.Map<java.lang.String,java.lang.Object> getAdditionalInfo()
public void setAdditionalInfo(java.util.Map<java.lang.String,java.lang.Object> additionalInfo)
additionalInfo
- - A set of key value pairspublic void setAppliedObjects(java.util.List<javax.xml.registry.infomodel.RegistryObject> appliedObjects)
appliedObjects
- - A set of key value pairspublic java.util.List<javax.xml.registry.infomodel.RegistryObject> getAppliedObjects()
public java.util.List<com.centrasite.jaxr.importexport.IEventCallback> getPolicyCallbackList()
public void setPolicyCallbackList(java.util.List<com.centrasite.jaxr.importexport.IEventCallback> policyCallbackList)
policyCallbackList
- - a list of IEventCallback instances