public abstract class BaseModelUADDisplay<T extends com.liferay.portal.kernel.model.BaseModel> extends java.lang.Object implements UADDisplay<T>
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 and Description |
---|
BaseModelUADDisplay() |
Modifier and Type | Method and Description |
---|---|
long |
count(long userId)
Returns the number of type
T entities associated with the the
user. |
protected abstract long |
doCount(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
Returns the number of type
T entities associated with the user
using the dynamic query. |
protected abstract com.liferay.portal.kernel.dao.orm.DynamicQuery |
doGetDynamicQuery()
Returns a new
DynamicQuery from the relevant service for type
T . |
protected abstract java.util.List<T> |
doGetRange(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery,
int start,
int end)
Returns type
T entities in the given range associated with a user
using a dynamic query. |
protected abstract java.lang.String[] |
doGetUserIdFieldNames()
Returns names identifying fields on the type
T 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 type
T . |
java.util.Map<java.lang.String,java.lang.Object> |
getFieldValues(T t,
java.lang.String[] fieldNames,
java.util.Locale locale)
Returns a map of field names and values to display in the UI.
|
protected com.liferay.portal.kernel.util.OrderByComparator<T> |
getOrderByComparator(java.lang.String orderByField,
java.lang.String orderByType)
Returns an
OrderByComparator for type T used to sort
search results. |
java.io.Serializable |
getPrimaryKey(T baseModel)
Returns the primary key of the type
T entity. |
java.util.List<T> |
getRange(long userId,
int start,
int end)
Returns type
T entities in the given range associated with a
user. |
protected java.lang.String[] |
getSearchableFields()
Returns the field names that are queried when using the
search(long, long[], java.lang.String, java.lang.String, java.lang.String, int, int)
or searchCount(long, long[], java.lang.String) methods. |
protected com.liferay.portal.kernel.dao.orm.DynamicQuery |
getSearchDynamicQuery(long userId,
long[] groupIds,
java.lang.String keywords,
java.lang.String orderByField,
java.lang.String orderByType)
Returns a dynamic query that can be used to perform a database search for
type
T entities that are associated with the user. |
java.lang.String[] |
getSortingFieldNames()
Returns the field names to be used as table column headers when sorting
type
T entities. |
java.lang.String |
getTypeName(java.util.Locale locale)
Returns the localized string representing type
T . |
boolean |
isInTrash(T t) |
boolean |
isSiteScoped()
Returns
true if type T entities are scoped by site. |
java.util.List<T> |
search(long userId,
long[] groupIds,
java.lang.String keywords,
java.lang.String orderByField,
java.lang.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,
java.lang.String keywords)
Returns the number of type
T entities related to the user,
optionally filtered by groups and/or keywords. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
get, getColumnFieldNames, getDisplayFieldNames, getEditURL, getName, getParentContainerClass, getParentContainerId, getTopLevelContainer, isUserOwned
getTypeClass
public long count(long userId)
UADDisplay
T
entities associated with the the
user.count
in interface UADDisplay<T extends com.liferay.portal.kernel.model.BaseModel>
userId
- the primary key of the user whose data to countpublic java.util.Map<java.lang.String,java.lang.Object> getFieldValues(T t, java.lang.String[] fieldNames, java.util.Locale locale)
UADDisplay
getFieldValues
in interface UADDisplay<T extends com.liferay.portal.kernel.model.BaseModel>
t
- the type T
entityfieldNames
- the field names for getting values from the entitylocale
- the current localepublic java.io.Serializable getPrimaryKey(T baseModel)
UADDisplay
T
entity.getPrimaryKey
in interface UADDisplay<T extends com.liferay.portal.kernel.model.BaseModel>
baseModel
- the entity whose primary key to retrievepublic java.util.List<T> getRange(long userId, int start, int end)
UADDisplay
T
entities in the given range associated with a
user.getRange
in interface UADDisplay<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 paginationpublic java.lang.String[] getSortingFieldNames()
UADDisplay
T
entities.getSortingFieldNames
in interface UADDisplay<T extends com.liferay.portal.kernel.model.BaseModel>
public java.lang.String getTypeName(java.util.Locale locale)
UADDisplay
T
.getTypeName
in interface UADDisplay<T extends com.liferay.portal.kernel.model.BaseModel>
locale
- the current localeT
public boolean isInTrash(T t) throws java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
isInTrash
in interface UADDisplay<T extends com.liferay.portal.kernel.model.BaseModel>
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
public boolean isSiteScoped()
UADDisplay
true
if type T
entities are scoped by site.isSiteScoped
in interface UADDisplay<T extends com.liferay.portal.kernel.model.BaseModel>
true
if type T
entities are scoped by site;
false
otherwisepublic java.util.List<T> search(long userId, long[] groupIds, java.lang.String keywords, java.lang.String orderByField, java.lang.String orderByType, int start, int end)
UADDisplay
T
entities related to the user,
optionally filtered by groups and/or keywords.search
in interface UADDisplay<T extends com.liferay.portal.kernel.model.BaseModel>
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 indexpublic long searchCount(long userId, long[] groupIds, java.lang.String keywords)
UADDisplay
T
entities related to the user,
optionally filtered by groups and/or keywords.searchCount
in interface UADDisplay<T extends com.liferay.portal.kernel.model.BaseModel>
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 fieldsprotected abstract long doCount(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
T
entities associated with the user
using the dynamic query.dynamicQuery
- the dynamic query to pass to the service layerT
entities associated with the user
using the dynamic queryprotected abstract com.liferay.portal.kernel.dao.orm.DynamicQuery doGetDynamicQuery()
DynamicQuery
from the relevant service for type
T
.DynamicQuery
to be used by the service layerprotected abstract java.util.List<T> doGetRange(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, int end)
T
entities in the given range associated with a user
using a dynamic query.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 paginationT
entitiesprotected abstract java.lang.String[] doGetUserIdFieldNames()
T
entity that
contain the primary key of a user.protected com.liferay.portal.kernel.dao.orm.DynamicQuery getDynamicQuery(long userId)
T
. It should be populated with
criteria and ready for use by the service.userId
- the primary key of the user used to pre-filter the dynamic
queryprotected com.liferay.portal.kernel.util.OrderByComparator<T> getOrderByComparator(java.lang.String orderByField, java.lang.String orderByType)
OrderByComparator
for type T
used to sort
search results. If this returns null
, the default dynamic query
ordering is used.orderByField
- the name of the field to use for orderingorderByType
- the type of orderingOrderByComparator
for type T
protected java.lang.String[] getSearchableFields()
search(long, long[], java.lang.String, java.lang.String, java.lang.String, int, int)
or searchCount(long, long[], java.lang.String)
methods.protected com.liferay.portal.kernel.dao.orm.DynamicQuery getSearchDynamicQuery(long userId, long[] groupIds, java.lang.String keywords, java.lang.String orderByField, java.lang.String orderByType)
T
entities that are associated with the user.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 orderingdoGetRange(com.liferay.portal.kernel.dao.orm.DynamicQuery, int, int)
and doCount(com.liferay.portal.kernel.dao.orm.DynamicQuery)
methods