Class InstanceContext
java.lang.Object
com.aquima.interactions.profile.wrapper.ProfileDelegate
com.aquima.interactions.rule.inference.InferenceContextDelegate
com.aquima.interactions.rule.inference.InstanceContext
- All Implemented Interfaces:
IEventChannel
,IProfile
,IProfileLifecycle
,InferenceContext
,Serializable
Inference context implementation that activates a single instance, and wraps an existing inference context.
- Since:
- 5.0
- Author:
- O. Kerpershoek
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionInstanceContext
(InferenceContext context, IEntityInstance instance) Constructs the instance context with the instance that should be active, and the context that should be used as fallback. -
Method Summary
Modifier and TypeMethodDescriptiongetActiveInstance
(String entityName) This method returns the active instance for the specified type.This method returns the instance that is activated by this context.Methods inherited from class com.aquima.interactions.rule.inference.InferenceContextDelegate
getInferenceDetails
Methods inherited from class com.aquima.interactions.profile.wrapper.ProfileDelegate
activate, addEventListener, commitTransaction, createInstance, createInstance, deleteInstance, getAllInstancesForEntity, getEntityDefinition, getInstance, getInstanceById, getInstanceByName, getProfile, getSingletonInstance, getState, getSupportedEvents, passivate, removeEventListener, restore, rollbackTransaction, startTransaction
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.aquima.interactions.foundation.events.IEventChannel
addEventListener, getSupportedEvents, removeEventListener
Methods inherited from interface com.aquima.interactions.profile.IProfile
commitTransaction, createInstance, createInstance, deleteInstance, getAllInstancesForEntity, getEntityDefinition, getInstance, getInstanceById, getInstanceByName, getSingletonInstance, getState, restore, rollbackTransaction, startTransaction
Methods inherited from interface com.aquima.interactions.profile.IProfileLifecycle
activate, passivate
-
Constructor Details
-
InstanceContext
Constructs the instance context with the instance that should be active, and the context that should be used as fallback.- Parameters:
context
- The inference context that should be wrapped.instance
- The instance that should be active in this context.
-
-
Method Details
-
getActiveInstance
public IEntityInstance getActiveInstance(String entityName) throws UnknownInstanceException, UnknownEntityException, CreateInstanceException Description copied from interface:InferenceContext
This method returns the active instance for the specified type. When no active instance can be found for the specified type, the type is assumed to be a singleton instance. When this method is invoked for a non singleton type without any active instance, the call to the getSingletonInstance will fail due to a CreateInstanceException.- Specified by:
getActiveInstance
in interfaceInferenceContext
- Overrides:
getActiveInstance
in classInferenceContextDelegate
- Parameters:
entityName
- The entity type for which the active instance is requested.- Returns:
- The instance that is active for the specified type.
- Throws:
UnknownInstanceException
- This exception type is raised when no active instance could be found for the specified type.UnknownEntityException
- This exception type is raised when the entity type is unknown.CreateInstanceException
- This type of exception may be raised when a singleton instance could not be created for the specified type.
-
getContextInstance
This method returns the instance that is activated by this context. Usually it should not be needed to access this instance directly, so only use this method if you are sure you know what you are doing :)- Returns:
- The instance that is activated by this context.
-