Class AbstractObjectDataProvider<S extends TabularSource,​T>

    • 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
      • 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 named getPropertyName or isPropertyName, 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