Package org.openbravo.service.json
Interface AdditionalPropertyResolver
-
- All Superinterfaces:
Prioritizable
- All Known Implementing Classes:
RelevantCharacteristicAdditionalPropertyResolver
public interface AdditionalPropertyResolver extends Prioritizable
An extension mechanism that allows to define a custom way for resolving additional properties which cannot be resolved through the data model. This interface mainly allows to retrieve the value of the additional property and to provide the data source properties required to filter and sort in the client side by the property field linked to the additional property.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
canResolve(Entity entity, String additionalProperty)
Determines if the value of the given property can be resolved for the business objects of the given entity.List<DataSourceProperty>
getDataSourceProperties(Entity entity, String additionalProperty)
Provides the list ofDataSourceProperty
that must be included in the standard data sources when the provided entity and additional property are requested.Set<String>
getPropertyNames(Entity entity)
Retrieves the set of names of the additional properties that can be resolved with thisAdditionalPropertyResolver
for the givenEntity
.Map<String,Object>
resolve(BaseOBObject bob, String additionalProperty)
Resolves an additional property.-
Methods inherited from interface org.openbravo.base.Prioritizable
getPriority
-
-
-
-
Method Detail
-
canResolve
boolean canResolve(Entity entity, String additionalProperty)
Determines if the value of the given property can be resolved for the business objects of the given entity.- Parameters:
entity
- The entity that may be linked to the given property, although without having direct relationship through the data modeladditionalProperty
- The additional property path- Returns:
true
if the value of the property can be resolved with thisAdditionalPropertyResolver
or in any other case
-
resolve
Map<String,Object> resolve(BaseOBObject bob, String additionalProperty)
Resolves an additional property. If null or an empty map is returned, then the additional property will be tried to be resolved with anAdditionalPropertyResolver
with less priority, if any. If there is noAdditionalPropertyResolver
returning a map with values, then the standard logic of theDataToJsonConverter
will be used to resolve the additional property.- Parameters:
bob
- The sourceBaseOBObject
additionalProperty
- The path to the additional property to be resolved- Returns:
- a Map with the values resolved for the additional property where the keys are the property names and values are the property values
- See Also:
DataToJsonConverter.toJsonObject(org.openbravo.base.structure.BaseOBObject, org.openbravo.service.json.DataResolvingMode)
-
getDataSourceProperties
List<DataSourceProperty> getDataSourceProperties(Entity entity, String additionalProperty)
Provides the list ofDataSourceProperty
that must be included in the standard data sources when the provided entity and additional property are requested. This is needed in order to support filtering and sorting in the client side by the given additional property. If null or an empty list is returned, then the properties will be tried to be retrieved with anAdditionalPropertyResolver
with less priority, if any. If there is noAdditionalPropertyResolver
returning a list with properties, then no data source properties will be added for the given additional property.- Parameters:
entity
- The base entityadditionalProperty
- The additional property path- Returns:
- the list of
DataSourceProperty
to be included in the data source - See Also:
DefaultDataSourceService.getDataSourceProperties(java.util.Map<java.lang.String, java.lang.Object>)
-
getPropertyNames
Set<String> getPropertyNames(Entity entity)
Retrieves the set of names of the additional properties that can be resolved with thisAdditionalPropertyResolver
for the givenEntity
. It is used to display these names as part of the list of available properties calculated by theModelDataSourceService
.- Parameters:
entity
- The entity whose additional properties would be resolved- Returns:
- the set of names of the additional properties that can be resolved for the given entity
with this
AdditionalPropertyResolver
- See Also:
ModelDataSourceService.fetch(java.util.Map<java.lang.String, java.lang.String>)
-
-