Class BaseModelUADDisplay<T extends com.liferay.portal.kernel.model.BaseModel>
java.lang.Object
com.liferay.user.associated.data.display.BaseModelUADDisplay<T>
- All Implemented Interfaces:
UADComponent<T>
,UADDisplay<T>
public abstract class BaseModelUADDisplay<T extends com.liferay.portal.kernel.model.BaseModel>
extends Object
implements UADDisplay<T>
Provides the base implementation of
UADDisplay
for entities generated
with Service Builder. The count and retrieval are based on a dynamic query,
which is available in the service generated by Service Builder.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlong
count
(long userId) Returns the number of typeT
entities associated with the the user.protected abstract long
doCount
(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) Returns the number of typeT
entities associated with the user using the dynamic query.protected abstract com.liferay.portal.kernel.dao.orm.DynamicQuery
Returns a newDynamicQuery
from the relevant service for typeT
.doGetRange
(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, int end) Returns typeT
entities in the given range associated with a user using a dynamic query.protected abstract String[]
Returns names identifying fields on the typeT
entity that contain the primary key of a user.protected com.liferay.portal.kernel.dao.orm.DynamicQuery
getDynamicQuery
(long userId) Returns a dynamic query for typeT
.getFieldValues
(T t, String[] fieldNames, Locale locale) Returns a map of field names and values to display in the UI.protected com.liferay.portal.kernel.util.OrderByComparator<T>
getOrderByComparator
(String orderByField, String orderByType) Returns anOrderByComparator
for typeT
used to sort search results.getPrimaryKey
(T baseModel) Returns the primary key of the typeT
entity.getRange
(long userId, int start, int end) Returns typeT
entities in the given range associated with a user.protected String[]
Returns the field names that are queried when using thesearch(long, long[], java.lang.String, java.lang.String, java.lang.String, int, int)
orsearchCount(long, long[], java.lang.String)
methods.protected com.liferay.portal.kernel.dao.orm.DynamicQuery
getSearchDynamicQuery
(long userId, long[] groupIds, String keywords, String orderByField, String orderByType) Returns a dynamic query that can be used to perform a database search for typeT
entities that are associated with the user.String[]
Returns the field names to be used as table column headers when sorting typeT
entities.getTypeName
(Locale locale) Returns the localized string representing typeT
.boolean
boolean
Returnstrue
if typeT
entities are scoped by site.search
(long userId, long[] groupIds, String keywords, String orderByField, String orderByType, int start, int end) Returns paginated sorted typeT
entities related to the user, optionally filtered by groups and/or keywords.long
searchCount
(long userId, long[] groupIds, String keywords) Returns the number of typeT
entities related to the user, optionally filtered by groups and/or keywords.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.liferay.user.associated.data.component.UADComponent
getTypeClass, getTypeKey
Methods inherited from interface com.liferay.user.associated.data.display.UADDisplay
get, getColumnFieldNames, getDisplayFieldNames, getEditURL, getName, getParentContainerClass, getParentContainerId, getParentContainerTypeKey, getTopLevelContainer, isTypeEntity, isUserOwned
-
Constructor Details
-
BaseModelUADDisplay
public BaseModelUADDisplay()
-
-
Method Details
-
count
public long count(long userId) Description copied from interface:UADDisplay
Returns the number of typeT
entities associated with the the user.- Specified by:
count
in interfaceUADDisplay<T extends com.liferay.portal.kernel.model.BaseModel>
- Parameters:
userId
- the primary key of the user whose data to count- Returns:
- the number of entities associated with the user
-
getFieldValues
Description copied from interface:UADDisplay
Returns a map of field names and values to display in the UI.- Specified by:
getFieldValues
in interfaceUADDisplay<T extends com.liferay.portal.kernel.model.BaseModel>
- Parameters:
t
- the typeT
entityfieldNames
- the field names for getting values from the entitylocale
- the current locale- Returns:
- a map of values to display in the UI
-
getPrimaryKey
Description copied from interface:UADDisplay
Returns the primary key of the typeT
entity.- Specified by:
getPrimaryKey
in interfaceUADDisplay<T extends com.liferay.portal.kernel.model.BaseModel>
- Parameters:
baseModel
- the entity whose primary key to retrieve- Returns:
- the primary key of the entity
-
getRange
Description copied from interface:UADDisplay
Returns typeT
entities in the given range associated with a user.- Specified by:
getRange
in interfaceUADDisplay<T extends com.liferay.portal.kernel.model.BaseModel>
start
- the starting index of the result set, for paginationend
- the ending index of the result set, for pagination- Returns:
- the paginated entities related to the user ID
-
getSortingFieldNames
Description copied from interface:UADDisplay
Returns the field names to be used as table column headers when sorting typeT
entities.- Specified by:
getSortingFieldNames
in interfaceUADDisplay<T extends com.liferay.portal.kernel.model.BaseModel>
- Returns:
- the field names used for column headers when sorting
-
getTypeName
Description copied from interface:UADDisplay
Returns the localized string representing typeT
.- Specified by:
getTypeName
in interfaceUADDisplay<T extends com.liferay.portal.kernel.model.BaseModel>
- Parameters:
locale
- the current locale- Returns:
- the localized string representing type
T
-
isInTrash
- Specified by:
isInTrash
in interfaceUADDisplay<T extends com.liferay.portal.kernel.model.BaseModel>
- Throws:
IllegalAccessException
InvocationTargetException
-
isSiteScoped
public boolean isSiteScoped()Description copied from interface:UADDisplay
Returnstrue
if typeT
entities are scoped by site.- Specified by:
isSiteScoped
in interfaceUADDisplay<T extends com.liferay.portal.kernel.model.BaseModel>
- Returns:
true
if typeT
entities are scoped by site;false
otherwise
-
search
public List<T> search(long userId, long[] groupIds, String keywords, String orderByField, String orderByType, int start, int end) Description copied from interface:UADDisplay
Returns paginated sorted typeT
entities related to the user, optionally filtered by groups and/or keywords.- Specified by:
search
in interfaceUADDisplay<T extends com.liferay.portal.kernel.model.BaseModel>
- Parameters:
userId
- the primary key of the usergroupIds
- the primary keys of the groups that the entities are associated withkeywords
- the keywords which may occur in the entity's fieldsorderByField
- the field to sort the entities byorderByType
- the direction to sort the entities by (ascending or descending)start
- the result set's starting indexend
- the result set's ending index- Returns:
- the paginated, sorted, and filtered entities associated with the user
-
searchCount
Description copied from interface:UADDisplay
Returns the number of typeT
entities related to the user, optionally filtered by groups and/or keywords.- Specified by:
searchCount
in interfaceUADDisplay<T extends com.liferay.portal.kernel.model.BaseModel>
- Parameters:
userId
- the primary key of the usergroupIds
- the primary keys of the groups that the entities are associated withkeywords
- the keywords which may occur in the entity's fields- Returns:
- the number of filtered entities associated with the user
-
doCount
protected abstract long doCount(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) Returns the number of typeT
entities associated with the user using the dynamic query.- Parameters:
dynamicQuery
- the dynamic query to pass to the service layer- Returns:
- the number of type
T
entities associated with the user using the dynamic query
-
doGetDynamicQuery
protected abstract com.liferay.portal.kernel.dao.orm.DynamicQuery doGetDynamicQuery()Returns a newDynamicQuery
from the relevant service for typeT
.- Returns:
- a new
DynamicQuery
to be used by the service layer
-
doGetRange
protected abstract List<T> doGetRange(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, int end) Returns typeT
entities in the given range associated with a user using a dynamic query.- Parameters:
dynamicQuery
- the dynamic query to pass to the service layerstart
- the starting index of the result set, for paginationend
- the ending index of the result set, for pagination- Returns:
- a paginated list of type
T
entities
-
doGetUserIdFieldNames
Returns names identifying fields on the typeT
entity that contain the primary key of a user.- Returns:
- the fields that contain the primary key of a user
-
getDynamicQuery
protected com.liferay.portal.kernel.dao.orm.DynamicQuery getDynamicQuery(long userId) Returns a dynamic query for typeT
. It should be populated with criteria and ready for use by the service.- Parameters:
userId
- the primary key of the user used to pre-filter the dynamic query- Returns:
- a pre-filtered dynamic query
-
getOrderByComparator
protected com.liferay.portal.kernel.util.OrderByComparator<T> getOrderByComparator(String orderByField, String orderByType) Returns anOrderByComparator
for typeT
used to sort search results. If this returnsnull
, the default dynamic query ordering is used.- Parameters:
orderByField
- the name of the field to use for orderingorderByType
- the type of ordering- Returns:
- an
OrderByComparator
for typeT
-
getSearchableFields
Returns the field names that are queried when using thesearch(long, long[], java.lang.String, java.lang.String, java.lang.String, int, int)
orsearchCount(long, long[], java.lang.String)
methods.- Returns:
- the field names to be queried
-
getSearchDynamicQuery
protected com.liferay.portal.kernel.dao.orm.DynamicQuery getSearchDynamicQuery(long userId, long[] groupIds, String keywords, String orderByField, String orderByType) Returns a dynamic query that can be used to perform a database search for typeT
entities that are associated with the user.- Parameters:
userId
- the primary key of the user whose data to searchgroupIds
- the optional group primary keys to filter bykeywords
- the optional search terms to filter byorderByField
- the name of the field to use for orderingorderByType
- the type of ordering- Returns:
- a dynamic query to be used by the
doGetRange(com.liferay.portal.kernel.dao.orm.DynamicQuery, int, int)
anddoCount(com.liferay.portal.kernel.dao.orm.DynamicQuery)
methods
-