Interface UADDisplay<T>

All Superinterfaces:
UADComponent<T>
All Known Implementing Classes:
BaseModelUADDisplay

public interface UADDisplay<T> extends UADComponent<T>
Provides the methods to count, retrieve, and display information about type T entities related to a user. This interface can also provide a URL to allow an admin to edit an entity.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    count(long userId)
    Returns the number of type T entities associated with the the user.
    get(Serializable primaryKey)
    Retrieves a type T entity.
    default String[]
    Returns field names to be used as table column headers when displaying a list of type T entities.
    Returns field names to display when showing details about a type T entity.
    default String
    getEditURL(T t, com.liferay.portal.kernel.portlet.LiferayPortletRequest liferayPortletRequest, com.liferay.portal.kernel.portlet.LiferayPortletResponse liferayPortletResponse)
    Returns a string URL that allows the admin user to edit the entity.
    getFieldValues(T t, String[] fieldNames, Locale locale)
    Returns a map of field names and values to display in the UI.
    default String
    getName(T t, Locale locale)
     
    default Class<?>
     
    default Serializable
    Returns the primary key of the parent container for the given entity.
    default String
     
    Returns the primary key of the type T entity.
    getRange(long userId, int start, int end)
    Returns type T entities in the given range associated with a user.
    Returns the field names to be used as table column headers when sorting type T entities.
    default T
    getTopLevelContainer(Class<?> parentContainerClass, Serializable parentContainerId, Object childObject)
    Returns the type T entity that satisfies two conditions: It is an immediate child of the container identified by the parent container class and parent container ID.
    Returns the localized string representing type T.
    boolean
     
    default boolean
    Returns true if type T entities are scoped by site.
    default boolean
     
    default boolean
    isUserOwned(T t, long userId)
     
    search(long userId, long[] groupIds, String keywords, String orderByField, String orderByType, int start, int end)
    Returns paginated sorted type T entities related to the user, optionally filtered by groups and/or keywords.
    long
    searchCount(long userId, long[] groupIds, String keywords)
    Returns the number of type T entities related to the user, optionally filtered by groups and/or keywords.

    Methods inherited from interface com.liferay.user.associated.data.component.UADComponent

    getTypeClass, getTypeKey
  • Method Details

    • count

      long count(long userId)
      Returns the number of type T entities associated with the the user.
      Parameters:
      userId - the primary key of the user whose data to count
      Returns:
      the number of entities associated with the user
    • get

      T get(Serializable primaryKey) throws Exception
      Retrieves a type T entity.
      Parameters:
      primaryKey - the primary key of the entity to retrieve
      Returns:
      an entity of type T
      Throws:
      Exception - if an exception occurred
    • getColumnFieldNames

      default String[] getColumnFieldNames()
      Returns field names to be used as table column headers when displaying a list of type T entities.
      Returns:
      the field names used for column headers
    • getDisplayFieldNames

      String[] getDisplayFieldNames()
      Returns field names to display when showing details about a type T entity.
      Returns:
      the field names identifying which information to display
    • getEditURL

      default String getEditURL(T t, com.liferay.portal.kernel.portlet.LiferayPortletRequest liferayPortletRequest, com.liferay.portal.kernel.portlet.LiferayPortletResponse liferayPortletResponse) throws Exception
      Returns a string URL that allows the admin user to edit the entity. If null is returned, no edit option is presented to the admin user.
      Parameters:
      t - the type T entity
      liferayPortletRequest - the current portlet request
      liferayPortletResponse - the current portlet response
      Returns:
      a string URL, or null
      Throws:
      Exception - if an exception occurred
    • getFieldValues

      Map<String,Object> getFieldValues(T t, String[] fieldNames, Locale locale)
      Returns a map of field names and values to display in the UI.
      Parameters:
      t - the type T entity
      fieldNames - the field names for getting values from the entity
      locale - the current locale
      Returns:
      a map of values to display in the UI
    • getName

      default String getName(T t, Locale locale)
    • getParentContainerClass

      default Class<?> getParentContainerClass()
    • getParentContainerId

      default Serializable getParentContainerId(T t)
      Returns the primary key of the parent container for the given entity.

      This method is optional and only applies when the implementation is returned from UADHierarchyDeclaration.getContainerUADDisplays() or UADHierarchyDeclaration.getNoncontainerUADDisplays(). It is required for hierarchy display to function correctly, but not for normal usage.

      Parameters:
      t - the entity whose parent container's primary key to retreive
      Returns:
      the primary key of the parent container of the given entity
      See Also:
    • getParentContainerTypeKey

      default String getParentContainerTypeKey()
    • getPrimaryKey

      Serializable getPrimaryKey(T t)
      Returns the primary key of the type T entity.
      Parameters:
      t - the entity whose primary key to retrieve
      Returns:
      the primary key of the entity
    • getRange

      List<T> getRange(long userId, int start, int end)
      Returns type T entities in the given range associated with a user.
      Parameters:
      start - the starting index of the result set, for pagination
      end - the ending index of the result set, for pagination
      Returns:
      the paginated entities related to the user ID
    • getSortingFieldNames

      String[] getSortingFieldNames()
      Returns the field names to be used as table column headers when sorting type T entities.
      Returns:
      the field names used for column headers when sorting
    • getTopLevelContainer

      default T getTopLevelContainer(Class<?> parentContainerClass, Serializable parentContainerId, Object childObject)
      Returns the type T entity that satisfies two conditions:
      1. It is an immediate child of the container identified by the parent container class and parent container ID.
      2. It is an ancestor of the child object. It does not have to be an immediate ancestor.

      If neither of these conditions are met, this method should return null.

      This method is optional and only applies when the implementation is returned from UADHierarchyDeclaration.getContainerUADDisplays(). It is required for hierarchy display to function correctly, but not for normal usage.

      Parameters:
      parentContainerClass - the class identifying the returned entity's parent container
      parentContainerId - the primary key of the returned entity's parent container
      childObject - the returned entity's child
      Returns:
      the highest level parent of the child object that is also a child of the given container type and primary key
      See Also:
    • getTypeName

      String getTypeName(Locale locale)
      Returns the localized string representing type T.
      Parameters:
      locale - the current locale
      Returns:
      the localized string representing type T
    • isInTrash

      boolean isInTrash(T t) throws IllegalAccessException, InvocationTargetException
      Throws:
      IllegalAccessException
      InvocationTargetException
    • isSiteScoped

      default boolean isSiteScoped()
      Returns true if type T entities are scoped by site.
      Returns:
      true if type T entities are scoped by site; false otherwise
    • isTypeEntity

      default boolean isTypeEntity(Object object)
    • isUserOwned

      default boolean isUserOwned(T t, long userId)
    • search

      List<T> search(long userId, long[] groupIds, String keywords, String orderByField, String orderByType, int start, int end)
      Returns paginated sorted type T entities related to the user, optionally filtered by groups and/or keywords.
      Parameters:
      userId - the primary key of the user
      groupIds - the primary keys of the groups that the entities are associated with
      keywords - the keywords which may occur in the entity's fields
      orderByField - the field to sort the entities by
      orderByType - the direction to sort the entities by (ascending or descending)
      start - the result set's starting index
      end - the result set's ending index
      Returns:
      the paginated, sorted, and filtered entities associated with the user
    • searchCount

      long searchCount(long userId, long[] groupIds, String keywords)
      Returns the number of type T entities related to the user, optionally filtered by groups and/or keywords.
      Parameters:
      userId - the primary key of the user
      groupIds - the primary keys of the groups that the entities are associated with
      keywords - the keywords which may occur in the entity's fields
      Returns:
      the number of filtered entities associated with the user