Package com.aquima.interactions.rule.tms
Class TmsEntityInstance
java.lang.Object
com.aquima.interactions.profile.wrapper.InstanceDelegate
com.aquima.interactions.rule.tms.TmsEntityInstance
- All Implemented Interfaces:
IEventChannel
,IPropertyContainer
,IEntityInstance
,Serializable
Wrapper class for instances to add truth-maintenance and automatic inferencing.
- Since:
- 5.0
- Author:
- O. Kerpershoek
- See Also:
-
Constructor Summary
ModifierConstructorDescriptionprotected
TmsEntityInstance
(IEntityInstance instance, TmsProfile profile) Constructs a TmsInstance delegate for the specified instance. -
Method Summary
Modifier and TypeMethodDescriptionboolean
addEventListener
(IEventListener listener) This method will add the passed event listener to the list of listeners.boolean
addValue
(String attributeName, ISingleValue newValue) This function will add the designated value to the existing profile's value.boolean
clearValue
(String attributeName) Clears the designated value, returning its state to UNKNOWN.getAttributeState
(String attributeName) When the attribute is known, it will return the state of the attribute.getInstanceValue
(String attributeName) This method returns the instances that is referred to by the given attribute.getInstanceValues
(String attributeName) This method returns an array containing all the instances that are referred to by the given attribute.protected IRuleListener
protected IAttributeValue
getProfileAttributeState
(String attributeName) This method returns information about the instances that are referring this instance.This method can be used to retrieve a value for an attribute of this instance in a non-type safe manner.boolean
removeEventListener
(IEventListener listener) This method will remove the specified event listener from the list of listeners.boolean
removeValue
(String attributeName, ISingleValue oldValue) Removes a specified value from the multivalued-attribute.boolean
This method sets the specified value for the given attribute.protected void
sourceTmsValue
(ValueReference valueReference) toString()
Methods inherited from class com.aquima.interactions.profile.wrapper.InstanceDelegate
equals, getEntityDefinition, getId, getInstance, getInstanceReference, getName, getProperty, getPropertyNames, getSupportedEvents, hashCode, hasProperty, instanceOf, isDeleted, isSingletonInstance, isStaticInstance, setProperty
-
Constructor Details
-
TmsEntityInstance
Constructs a TmsInstance delegate for the specified instance.- Parameters:
instance
- The instance that should be wrapped with TMS functionality.profile
- The TMS profile managing the dependency information.
-
-
Method Details
-
getInstanceValue
Description copied from interface:IEntityInstance
This method returns the instances that is referred to by the given attribute. If the attribute does not refer to an instance, a null value is returned.- Specified by:
getInstanceValue
in interfaceIEntityInstance
- Overrides:
getInstanceValue
in classInstanceDelegate
- Parameters:
attributeName
- The name of the attribute containing the instance.- Returns:
- The IEntityInstance referred to by the attribute.
-
getInstanceValues
Description copied from interface:IEntityInstance
This method returns an array containing all the instances that are referred to by the given attribute. If the attribute does not refer to any instance, an empty array is returned.- Specified by:
getInstanceValues
in interfaceIEntityInstance
- Overrides:
getInstanceValues
in classInstanceDelegate
- Parameters:
attributeName
- The name of the attribute containing the instances.- Returns:
- An array containing all the instances that are referred to by the attribute.
-
getReferringInstances
Description copied from interface:IEntityInstance
This method returns information about the instances that are referring this instance. The InstanceReferrer objects can be used to determine what instance is referring this one, and through what attribute. The attribute by which this instance is referenced is needed, as an instance may have multiple references to another through different attributes.- Specified by:
getReferringInstances
in interfaceIEntityInstance
- Overrides:
getReferringInstances
in classInstanceDelegate
- Returns:
- Array of reference objects containing information about the referring instance.
-
getAttributeState
Description copied from interface:IEntityInstance
When the attribute is known, it will return the state of the attribute.- Specified by:
getAttributeState
in interfaceIEntityInstance
- Overrides:
getAttributeState
in classInstanceDelegate
- Parameters:
attributeName
- String Preferably without the entity name- Returns:
- The state information of the attribute.
-
getValue
Description copied from interface:IEntityInstance
This method can be used to retrieve a value for an attribute of this instance in a non-type safe manner.- DataType.Boolean returns a BooleanValue
- DataType.Currency returns a DoubleValue
- DataType.Date returns a DateValue
- DataType.Number returns a NumberValue
- DataType.Integer returns a IntegerValue
- DataType.Percentage returns a DoubleValue
- DataType.String returns a StringValue
- DataType.Domain returns a StringValue containing the short value, and has the display value as well.
- DataType.Entity returns an EntityValue object denoting the instance this relation was pointing to.
- If the value was not answered the return value is as specified but on the IValue object the isUnknown function renders true
- If the value was answered and the single value was
null
the return value is not null, but the isUnknown function results in true - If the value is a multivalued attribute a collection containing the only the object types listed above.
- Specified by:
getValue
in interfaceIEntityInstance
- Overrides:
getValue
in classInstanceDelegate
- Parameters:
attributeName
- String (without the entity name)- Returns:
- The value for the specified attribute name.
-
clearValue
Description copied from interface:IEntityInstance
Clears the designated value, returning its state to UNKNOWN.- Specified by:
clearValue
in interfaceIEntityInstance
- Overrides:
clearValue
in classInstanceDelegate
- Parameters:
attributeName
- String the attribute name.- Returns:
- boolean true whether the attribute-value was changed by this action.
-
removeValue
Description copied from interface:IEntityInstance
Removes a specified value from the multivalued-attribute. Possible datatypes for singleValue:- DataType.IEntityInstance denoting an instance.
- DataType.EntityValue denoting an instance.
- DataType.Number denoting one of [ domainValueId, number, currency, percentage ]
- DataType.Boolean denoting a boolean type.
- DataType.Date denoting a date object
- DataType.String denoting a string object, domain's short value
- Specified by:
removeValue
in interfaceIEntityInstance
- Overrides:
removeValue
in classInstanceDelegate
- Parameters:
attributeName
- the attribute name ( without the entity name )oldValue
- The value that should be removed.- Returns:
- boolean if the value was found in the original value list.
-
addValue
Description copied from interface:IEntityInstance
This function will add the designated value to the existing profile's value. If there was one, otherwise a single value is put in. Duplicate values are not allowed, and invoking this method with a value that is already present in the attribute has no effect.- Specified by:
addValue
in interfaceIEntityInstance
- Overrides:
addValue
in classInstanceDelegate
- Parameters:
attributeName
- The name of the attribute to which the value should be added.newValue
- The value that should be added to the attribute specified.- Returns:
- boolean indicating whether the value was actually added (a duplicate value will result in false).
-
setValue
Description copied from interface:IEntityInstance
This method sets the specified value for the given attribute. Possible objects to pass to this method:- IEntityInstance denoting an instance.
- EntityValue denoting an instance.
- Number/NumberValue/IntegerValue/Currency/Percentage denoting one of [ number, currency, percentage ]
- Boolean/BooleanValue denoting a boolean type.
- Date/DateValue/DateTimeValue denoting a date object
- String/StringValue denoting a string object, domain's short value
- Collection containing any combination of above. Mixed is allowed i.e. [ EntityValue, IEntityInstance ]
- Object[] containing any combination of above. Mixed is allowed i.e. [ EntityValue, IEntityInstance ]
- Specified by:
setValue
in interfaceIEntityInstance
- Overrides:
setValue
in classInstanceDelegate
- Parameters:
attributeName
- the attribute name, preferredname
instead ofPerson.name
objValue
- The objects value to set as value (can be null).- Returns:
- Boolean indicating whether the value of the attribute did change.
-
addEventListener
Description copied from interface:IEventChannel
This method will add the passed event listener to the list of listeners.- Specified by:
addEventListener
in interfaceIEventChannel
- Overrides:
addEventListener
in classInstanceDelegate
- Parameters:
listener
- The event listener that should be added.- Returns:
- boolean indicating is the listener was actually added.
-
removeEventListener
Description copied from interface:IEventChannel
This method will remove the specified event listener from the list of listeners.- Specified by:
removeEventListener
in interfaceIEventChannel
- Overrides:
removeEventListener
in classInstanceDelegate
- Parameters:
listener
- The event listener that should be removed.- Returns:
- boolean indicating if the listener was actually removed.
-
toString
-
getProfileAttributeState
-
sourceTmsValue
-
getListener
-