S
- the source class using this provider. If there is no need
for source specialization, may be just TabularSource.T
- the class or interface the object's properties accessor methods
will be accessed through.@StableMinor(version="12.4", sinceVersion="4.0") public abstract class AbstractObjectDataProvider<S extends TabularSource,T> extends Object implements IDataProvider<S>
The fields id in the source definition are used as the object's properties names. For each one, its getter method is queried in the loaded object, and the value is used to populate a tabular data for the source.
INTERFACE_INSTANCE_PROPERTY_FIELDS, INTERFACE_INSTANCE_PROPERTY_FILTERS, INTERFACE_INSTANCE_PROPERTY_MAX_ROWS, INTERFACE_INSTANCE_PROPERTY_ORDER_BY, MAX_NUM_ORDER_BY_FIELDS
Constructor and Description |
---|
AbstractObjectDataProvider(Class<? extends T> objectClass)
Creates a new object data provider for objects of the given class or interface.
|
Modifier and Type | Method and Description |
---|---|
protected int |
getTotalRows(SessionConfig sessionConfig,
S source,
ITransaction transaction)
Returns the total rows to be set on the generated tabular data.
|
void |
loadData(SessionConfig sessionConfig,
S source,
ITransaction transaction) |
protected abstract List<T> |
loadObjects(SessionConfig sessionConfig,
S source,
ITransaction transaction)
Loads the objects.
|
protected Object |
readProperty(T object,
String propertyName)
Reads the property value of an object.
|
protected abstract List<T> loadObjects(SessionConfig sessionConfig, S source, ITransaction transaction) throws PortalException
sessionConfig
- the user session information.source
- the source that will be populated.transaction
- the transaction for persistence access.PortalException
#getTotalRows(SessionConfig, TabularSource, ITransaction)}
protected int getTotalRows(SessionConfig sessionConfig, S source, ITransaction transaction) throws PortalException
If the value returned is a negative value, the total rows on the tabular data is not set. This is the default implementation.
sessionConfig
- the user session information.source
- the source that will be populated.transaction
- the transaction for persistence access.PortalException
public void loadData(SessionConfig sessionConfig, S source, ITransaction transaction) throws PortalException
loadData
in interface IDataProvider<S extends TabularSource>
PortalException
protected Object readProperty(T object, String propertyName) throws UnexpectedException
If the propertyName is propertyName
, this method tries to read
the value from methods named getPropertyName
or isPropertyName
,
with no parameters.
object
- the object instance.propertyName
- the property name.UnexpectedException
- if there was an exception thrown by the accessor method.LumisXP 12.4.0.200625 - Copyright © 2006–2020 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.