Package lumis.doui.source
Class AbstractObjectDataProvider<S extends TabularSource,T>
- java.lang.Object
-
- lumis.doui.source.AbstractObjectDataProvider<S,T>
-
- Type Parameters:
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.
- All Implemented Interfaces:
IDataProvider<S>
- Direct Known Subclasses:
AiConfigDataProvider
,ClusterConfigDataProvider
,DatabaseViewFieldByGroupDataProvider
,HealthChecksDataProvider
,HtmlInjectorsDataProvider
,MailConfigDataProvider
,RegistrationManagementInterfaceDataProvider
,ThemeAdministrationListDataProvider
@StableMinor(version="17.0", sinceVersion="4.0") public abstract class AbstractObjectDataProvider<S extends TabularSource,T> extends java.lang.Object implements IDataProvider<S>
Implements a provider for objects whose properties follows the java bean accessor methods convention.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.
- Since:
- 4.0.4
- Version:
- $Revision$ $Date$
-
-
Field Summary
-
Fields inherited from interface lumis.doui.source.IDataProvider
INTERFACE_INSTANCE_PROPERTY_FIELDS, INTERFACE_INSTANCE_PROPERTY_FILTERS, INTERFACE_INSTANCE_PROPERTY_MAX_ROWS, INTERFACE_INSTANCE_PROPERTY_ORDER_BY, MAX_NUM_ORDER_BY_FIELDS
-
-
Constructor Summary
Constructors Constructor Description AbstractObjectDataProvider(java.lang.Class<? extends T> objectClass)
Creates a new object data provider for objects of the given class or interface.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method 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 java.util.List<T>
loadObjects(SessionConfig sessionConfig, S source, ITransaction transaction)
Loads the objects.protected java.lang.Object
readProperty(T object, java.lang.String propertyName)
Reads the property value of an object.
-
-
-
Constructor Detail
-
AbstractObjectDataProvider
public AbstractObjectDataProvider(java.lang.Class<? extends T> objectClass)
Creates a new object data provider for objects of the given class or interface.- Parameters:
objectClass
- the class or interface that contains the methods to read the object's properties.- Since:
- 4.0.4
-
-
Method Detail
-
loadObjects
protected abstract java.util.List<T> loadObjects(SessionConfig sessionConfig, S source, ITransaction transaction) throws PortalException
Loads the objects. The properties of the objects returned will be used to populate the source's tabular data.- Parameters:
sessionConfig
- the user session information.source
- the source that will be populated.transaction
- the transaction for persistence access.- Returns:
- a list of objects with the data to populate the source.
- Throws:
PortalException
- Since:
- 4.0.4
-
getTotalRows
protected int getTotalRows(SessionConfig sessionConfig, S source, ITransaction transaction) throws PortalException
Returns the total rows to be set on the generated tabular data.If the value returned is a negative value, the total rows on the tabular data is not set. This is the default implementation.
- Parameters:
sessionConfig
- the user session information.source
- the source that will be populated.transaction
- the transaction for persistence access.- Returns:
- the total rows to be set on the generated tabular data, or a negative value if it should not be set.
- Throws:
PortalException
- Since:
- 4.0.5
-
loadData
public void loadData(SessionConfig sessionConfig, S source, ITransaction transaction) throws PortalException
- Specified by:
loadData
in interfaceIDataProvider<S extends TabularSource>
- Throws:
PortalException
-
readProperty
protected java.lang.Object readProperty(T object, java.lang.String propertyName) throws UnexpectedException
Reads the property value of an object.If the propertyName is
propertyName
, this method tries to read the value from methods namedgetPropertyName
orisPropertyName
, with no parameters.- Parameters:
object
- the object instance.propertyName
- the property name.- Returns:
- the property value or null if its accessor method could not be accessed.
- Throws:
UnexpectedException
- if there was an exception thrown by the accessor method.- Since:
- 4.0.4
-
-