Package org.apache.unomi.api.services
Interface DefinitionsService
-
- All Known Implementing Classes:
DefinitionsServiceImpl
public interface DefinitionsServiceA service to retrieve definition information about core context server entities such as conditions, actions and values.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description ConditionextractConditionBySystemTag(Condition rootCondition, String systemTag)Retrieves a condition matching the specified system tag identifier from the specified root condition.ConditionextractConditionByTag(Condition rootCondition, String tag)Deprecated.As of 1.2.0-incubating, please useextractConditionBySystemTag(Condition, String)insteadSet<Condition>extractConditionsByType(Condition rootCondition, String typeId)Retrieves all conditions of the specified type from the specified root condition.ActionTypegetActionType(String id)Retrieves the action type associated with the specified identifier.Set<ActionType>getActionTypeBySystemTag(String tag)Retrieves the set of action types with the specified system tag.Set<ActionType>getActionTypeByTag(String tag)Retrieves the set of action types with the specified tag.Collection<ActionType>getAllActionTypes()Retrieves all known action types.Collection<ConditionType>getAllConditionTypes()Retrieves all condition types.Collection<ValueType>getAllValueTypes()Retrieves all known value types.ConditionBuildergetConditionBuilder()Retrieves a new instance of a ConditionBuilder to help to build conditions.ConditionTypegetConditionType(String id)Retrieves the condition type associated with the specified identifier.Set<ConditionType>getConditionTypesBySystemTag(String tag)Retrieves the set of condition types with the specified system tag.Set<ConditionType>getConditionTypesByTag(String tag)Retrieves the set of condition types with the specified tag.PropertyMergeStrategyTypegetPropertyMergeStrategyType(String id)Retrieves the property merge strategy type associated with the specified identifier.Map<Long,List<PluginType>>getTypesByPlugin()Retrieves a Map of plugin identifier to a list of plugin types defined by that particular plugin.ValueTypegetValueType(String id)Retrieves the value type associated with the specified identifier.Set<ValueType>getValueTypeByTag(String tag)Retrieves the set of value types with the specified tag.voidrefresh()Forces a refresh of the definitions from the persistence service.voidremoveActionType(String id)Remove the action typevoidremoveConditionType(String id)Remove the condition typebooleanresolveConditionType(Condition rootCondition)Resolves (if possible) theConditionTypes for the specified condition and its sub-conditions (if any) from the type identifiers existing on the specified condition TODO: remove from API and move to a different class?voidsetActionType(ActionType actionType)Stores the action typevoidsetConditionType(ConditionType conditionType)Stores the condition type
-
-
-
Method Detail
-
getAllConditionTypes
Collection<ConditionType> getAllConditionTypes()
Retrieves all condition types.- Returns:
- a Collection of all collection types
-
getConditionTypesByTag
Set<ConditionType> getConditionTypesByTag(String tag)
Retrieves the set of condition types with the specified tag.- Parameters:
tag- the tag marking the condition types we want to retrieve- Returns:
- the set of condition types with the specified tag (and its sub-tags, if specified)
-
getConditionTypesBySystemTag
Set<ConditionType> getConditionTypesBySystemTag(String tag)
Retrieves the set of condition types with the specified system tag.- Parameters:
tag- the system tag marking the condition types we want to retrieve- Returns:
- the set of condition types with the specified tag (and its sub-tags, if specified)
-
getConditionType
ConditionType getConditionType(String id)
Retrieves the condition type associated with the specified identifier.- Parameters:
id- the identifier of the condition type to retrieve- Returns:
- the condition type associated with the specified identifier or
nullif no such condition type exists
-
setConditionType
void setConditionType(ConditionType conditionType)
Stores the condition type- Parameters:
conditionType- the condition type to store
-
removeConditionType
void removeConditionType(String id)
Remove the condition type- Parameters:
id- the condition type to remove
-
getAllActionTypes
Collection<ActionType> getAllActionTypes()
Retrieves all known action types.- Returns:
- all known action types
-
getActionTypeByTag
Set<ActionType> getActionTypeByTag(String tag)
Retrieves the set of action types with the specified tag.- Parameters:
tag- the tag marking the action types we want to retrieve- Returns:
- the set of action types with the specified tag
-
getActionTypeBySystemTag
Set<ActionType> getActionTypeBySystemTag(String tag)
Retrieves the set of action types with the specified system tag.- Parameters:
tag- the system tag marking the action types we want to retrieve- Returns:
- the set of action types with the specified tag
-
getActionType
ActionType getActionType(String id)
Retrieves the action type associated with the specified identifier.- Parameters:
id- the identifier of the action type to retrieve- Returns:
- the action type associated with the specified identifier or
nullif no such action type exists
-
setActionType
void setActionType(ActionType actionType)
Stores the action type- Parameters:
actionType- the action type to store
-
removeActionType
void removeActionType(String id)
Remove the action type- Parameters:
id- the action type to remove
-
getAllValueTypes
Collection<ValueType> getAllValueTypes()
Retrieves all known value types.- Returns:
- all known value types
-
getValueTypeByTag
Set<ValueType> getValueTypeByTag(String tag)
Retrieves the set of value types with the specified tag.- Parameters:
tag- the tag marking the value types we want to retrieve- Returns:
- the set of value types with the specified tag
-
getValueType
ValueType getValueType(String id)
Retrieves the value type associated with the specified identifier.- Parameters:
id- the identifier of the value type to retrieve- Returns:
- the value type associated with the specified identifier or
nullif no such value type exists
-
getTypesByPlugin
Map<Long,List<PluginType>> getTypesByPlugin()
Retrieves a Map of plugin identifier to a list of plugin types defined by that particular plugin.- Returns:
- a Map of plugin identifier to a list of plugin types defined by that particular plugin
-
getPropertyMergeStrategyType
PropertyMergeStrategyType getPropertyMergeStrategyType(String id)
Retrieves the property merge strategy type associated with the specified identifier.- Parameters:
id- the identifier of the property merge strategy type to retrieve- Returns:
- the property merge strategy type associated with the specified identifier or
nullif no such property merge strategy type exists
-
extractConditionsByType
Set<Condition> extractConditionsByType(Condition rootCondition, String typeId)
Retrieves all conditions of the specified type from the specified root condition. TODO: remove?- Parameters:
rootCondition- the condition from which we want to extract all conditions with the specified typetypeId- the identifier of the condition type we want conditions to extract to match- Returns:
- a set of conditions contained in the specified root condition and matching the specified condition type or an empty set if no such condition exists
-
extractConditionByTag
@Deprecated Condition extractConditionByTag(Condition rootCondition, String tag)
Deprecated.As of 1.2.0-incubating, please useextractConditionBySystemTag(Condition, String)insteadRetrieves a condition matching the specified tag identifier from the specified root condition. TODO: remove from API and move to a different class? TODO: purpose and behavior not clear- Parameters:
rootCondition- the root condition where to start the extraction by classtag- the tag to use to extract the condition- Returns:
- Condition the condition that has been found matching the tag, or null if none matched
-
extractConditionBySystemTag
Condition extractConditionBySystemTag(Condition rootCondition, String systemTag)
Retrieves a condition matching the specified system tag identifier from the specified root condition.- Parameters:
rootCondition- the root condition where to start the extraction by classsystemTag- the tag to use to extract the condition- Returns:
- Condition the condition that has been found matching the tag, or null if none matched
-
resolveConditionType
boolean resolveConditionType(Condition rootCondition)
Resolves (if possible) theConditionTypes for the specified condition and its sub-conditions (if any) from the type identifiers existing on the specified condition TODO: remove from API and move to a different class?- Parameters:
rootCondition- the condition for which we want to resolve the condition types from the existing condition type identifiers- Returns:
true
-
refresh
void refresh()
Forces a refresh of the definitions from the persistence service. Warning: this may seriously impact performance so it is recommended to use this in specific cases such as for example in integration tests.
-
getConditionBuilder
ConditionBuilder getConditionBuilder()
Retrieves a new instance of a ConditionBuilder to help to build conditions.- Returns:
- a new instance of a ConditionBuilder
-
-