public class GenericHandler extends AMSApiHandler implements IGenericHandler
Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
LOG |
Constructor and Description |
---|
GenericHandler() |
Modifier and Type | Method and Description |
---|---|
<T extends ITransferableEntity> |
create(Class<T> entityClass,
UserContext uc,
T... entities)
Creates the.
|
<T extends ITransferableEntity> |
create(Class<T> entityClass,
UserContext uc,
T entity)
Creates the.
|
<T extends ITransferableEntity> |
delete(Class<T> entityClass,
UserContext uc,
T... entities)
Delete.
|
<T extends ITransferableEntity> |
delete(Class<T> entityClass,
UserContext uc,
T entities)
Delete.
|
<T extends ITransferableEntity,C extends de.xima.cmn.criteria.interfaces.IFilterableCriteriaManager & de.xima.cmn.criteria.interfaces.ISortableCriteriaManager & de.xima.cmn.criteria.interfaces.IPageableCriteriaManager & de.xima.cmn.criteria.interfaces.IQueryHintProviding> |
deleteBy(Class<T> entityClass,
UserContext uc,
C cm)
Delete by.
|
<T extends ITransferableEntity> |
deleteById(Class<T> entityClass,
UserContext uc,
Integer id) |
<T extends ITransferableEntity> |
deleteById(Class<T> entityClass,
UserContext uc,
Long id)
Delete by id.
|
<T extends ITransferableEntity> |
getAll(Class<T> entityClass,
UserContext uc)
Gets the all.
|
<T extends ITransferableEntity,C extends de.xima.cmn.criteria.interfaces.IFilterableCriteriaManager & de.xima.cmn.criteria.interfaces.ISortableCriteriaManager & de.xima.cmn.criteria.interfaces.IPageableCriteriaManager & de.xima.cmn.criteria.interfaces.IQueryHintProviding> |
getAllBy(Class<T> entityClass,
UserContext uc,
C cm)
Gets the all by.
|
<T extends ITransferableEntity,C extends de.xima.cmn.criteria.interfaces.IFilterableCriteriaManager & de.xima.cmn.criteria.interfaces.ISortableCriteriaManager & de.xima.cmn.criteria.interfaces.IPageableCriteriaManager & de.xima.cmn.criteria.interfaces.IQueryHintProviding & de.xima.cmn.criteria.interfaces.ISelectableCriteriaManager> |
getAttributes(Class<T> entityClass,
UserContext uc,
C cm)
Gets a list of attributes specified in the given criteria manager
C |
<R,T extends ITransferableEntity,C extends de.xima.cmn.criteria.interfaces.IFilterableCriteriaManager & de.xima.cmn.criteria.interfaces.ISortableCriteriaManager & de.xima.cmn.criteria.interfaces.IPageableCriteriaManager & de.xima.cmn.criteria.interfaces.IQueryHintProviding & de.xima.cmn.criteria.interfaces.ISelectableCriteriaManager> |
getAttributes(Class<T> entityClass,
UserContext uc,
C cm,
Class<R> resultClass)
Gets a list of attributes specified in the given criteria manager
C . the attribute values will be returned
as objects defined by the result class |
<T extends ITransferableEntity,C extends de.xima.cmn.criteria.interfaces.IFilterableCriteriaManager & de.xima.cmn.criteria.interfaces.ISortableCriteriaManager & de.xima.cmn.criteria.interfaces.IPageableCriteriaManager & de.xima.cmn.criteria.interfaces.IQueryHintProviding> |
getBy(Class<T> entityClass,
UserContext uc,
C cm)
Gets the by.
|
<T extends ITransferableEntity> |
getById(Class<T> entityClass,
UserContext uc,
Integer id) |
<T extends ITransferableEntity> |
getById(Class<T> entityClass,
UserContext uc,
Long id)
Gets the by id.
|
<T extends ITransferableEntity> |
getById(String entityClass,
UserContext uc,
String id)
Gets the by id.
|
<T extends ITransferableEntity,C extends de.xima.cmn.criteria.interfaces.IFilterableCriteriaManager & de.xima.cmn.criteria.interfaces.ISortableCriteriaManager & de.xima.cmn.criteria.interfaces.IPageableCriteriaManager & de.xima.cmn.criteria.interfaces.IQueryHintProviding & de.xima.cmn.criteria.interfaces.ISelectableCriteriaManager> |
getSingleAttributes(Class<T> entityClass,
UserContext uc,
C cm)
This method allows for the selection of certain attributes of an entity instead of reading the entire entity
|
<R,T extends ITransferableEntity,C extends de.xima.cmn.criteria.interfaces.IFilterableCriteriaManager & de.xima.cmn.criteria.interfaces.ISortableCriteriaManager & de.xima.cmn.criteria.interfaces.IPageableCriteriaManager & de.xima.cmn.criteria.interfaces.IQueryHintProviding & de.xima.cmn.criteria.interfaces.ISelectableCriteriaManager> |
getSingleAttributes(Class<T> entityClass,
UserContext uc,
C cm,
Class<R> resultClass)
This method allows for the selection of certain attributes of an entity instead of reading the entire entity
|
<T extends ITransferableEntity,C extends de.xima.cmn.criteria.interfaces.IFilterableCriteriaManager & de.xima.cmn.criteria.interfaces.IQueryHintProviding> |
resultTotalCount(Class<T> entityClass,
UserContext uc,
C cm)
Result total count.
|
protected <T> List<T> |
serializableList(Iterable<T> sequence)
Takes any
Collection or Iterable and converts it to a serializable list that can be transferred via
the API. |
<T extends ITransferableEntity> |
update(Class<T> entityClass,
UserContext uc,
T... entities)
Update.
|
<T extends ITransferableEntity> |
update(Class<T> entityClass,
UserContext uc,
T entity)
Update.
|
getName
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getName
public <T extends ITransferableEntity> List<T> getAll(Class<T> entityClass, UserContext uc)
getAll
in interface IGenericHandler
T
- the generic typeentityClass
- the entity classuc
- the ucpublic <T extends ITransferableEntity,C extends de.xima.cmn.criteria.interfaces.IFilterableCriteriaManager & de.xima.cmn.criteria.interfaces.ISortableCriteriaManager & de.xima.cmn.criteria.interfaces.IPageableCriteriaManager & de.xima.cmn.criteria.interfaces.IQueryHintProviding> List<T> getAllBy(Class<T> entityClass, UserContext uc, C cm)
getAllBy
in interface IGenericHandler
T
- the generic typeentityClass
- the entity classuc
- the uccm
- the qcmpublic <T extends ITransferableEntity,C extends de.xima.cmn.criteria.interfaces.IFilterableCriteriaManager & de.xima.cmn.criteria.interfaces.ISortableCriteriaManager & de.xima.cmn.criteria.interfaces.IPageableCriteriaManager & de.xima.cmn.criteria.interfaces.IQueryHintProviding> T getBy(Class<T> entityClass, UserContext uc, C cm)
getBy
in interface IGenericHandler
T
- the generic typeentityClass
- the entity classuc
- the uccm
- the qcmpublic <T extends ITransferableEntity> T getById(Class<T> entityClass, UserContext uc, Long id)
getById
in interface IGenericHandler
T
- the generic typeentityClass
- the entity classuc
- the ucid
- the idpublic <T extends ITransferableEntity> T getById(Class<T> entityClass, UserContext uc, Integer id)
getById
in interface IGenericHandler
public <T extends ITransferableEntity> T getById(String entityClass, UserContext uc, String id)
getById
in interface IGenericHandler
T
- the generic typeentityClass
- the entity classuc
- the ucid
- the idpublic <T extends ITransferableEntity,C extends de.xima.cmn.criteria.interfaces.IFilterableCriteriaManager & de.xima.cmn.criteria.interfaces.ISortableCriteriaManager & de.xima.cmn.criteria.interfaces.IPageableCriteriaManager & de.xima.cmn.criteria.interfaces.IQueryHintProviding & de.xima.cmn.criteria.interfaces.ISelectableCriteriaManager> List<Map<String,Serializable>> getAttributes(Class<T> entityClass, UserContext uc, C cm) throws NotSerializableException
C
getAttributes
in interface IGenericHandler
T
- type of the entityC
- type of the criteria managerentityClass
- Class
of the entityuc
- UserContext
that will be usedcm
- C
criteria manager specifying the filtering, sorting, paging and selection of attributesList
of Tuple
s containing the attribute valuesNotSerializableException
public <R,T extends ITransferableEntity,C extends de.xima.cmn.criteria.interfaces.IFilterableCriteriaManager & de.xima.cmn.criteria.interfaces.ISortableCriteriaManager & de.xima.cmn.criteria.interfaces.IPageableCriteriaManager & de.xima.cmn.criteria.interfaces.IQueryHintProviding & de.xima.cmn.criteria.interfaces.ISelectableCriteriaManager> List<R> getAttributes(Class<T> entityClass, UserContext uc, C cm, Class<R> resultClass)
C
. the attribute values will be returned
as objects defined by the result classgetAttributes
in interface IGenericHandler
R
- type of result objectT
- type of the entityC
- type of the criteria managerentityClass
- Class
of the entityuc
- UserContext
that will be usedcm
- C
criteria manager specifying the filtering, sorting, paging and selection of attributesresultClass
- Class
of the result objectsList
of R
s containing the attribute valuespublic <T extends ITransferableEntity,C extends de.xima.cmn.criteria.interfaces.IFilterableCriteriaManager & de.xima.cmn.criteria.interfaces.ISortableCriteriaManager & de.xima.cmn.criteria.interfaces.IPageableCriteriaManager & de.xima.cmn.criteria.interfaces.IQueryHintProviding & de.xima.cmn.criteria.interfaces.ISelectableCriteriaManager> javax.persistence.Tuple getSingleAttributes(Class<T> entityClass, UserContext uc, C cm)
getSingleAttributes
in interface IGenericHandler
T
- type of entityC
- type of the criteria managerentityClass
- Class
the class of the searched entityuc
- UserContext
which will be usedcm
- C
object, that contains lists for filtering, sorting and selecting. These lists, if available,
are included in the SQL query. This value can be null
. The lists contained in the C
can also
be null
or empty.Tuple
that contains the values of the selected attributespublic <R,T extends ITransferableEntity,C extends de.xima.cmn.criteria.interfaces.IFilterableCriteriaManager & de.xima.cmn.criteria.interfaces.ISortableCriteriaManager & de.xima.cmn.criteria.interfaces.IPageableCriteriaManager & de.xima.cmn.criteria.interfaces.IQueryHintProviding & de.xima.cmn.criteria.interfaces.ISelectableCriteriaManager> R getSingleAttributes(Class<T> entityClass, UserContext uc, C cm, Class<R> resultClass)
getSingleAttributes
in interface IGenericHandler
R
- type of object, in which the result values will be placedT
- type of entityC
- type of the criteria managerentityClass
- Class
the class of the searched entityuc
- UserContext
which will be usedcm
- C
object, that contains lists for filtering, sorting and selecting. These lists, if available,
are included in the SQL query. This value can be null
. The lists contained in the C
can also
be null
or empty.resultClass
- Class
of the object, in which the result value will be placedR
that contains the values of the selected attributespublic <T extends ITransferableEntity> T[] create(Class<T> entityClass, UserContext uc, T... entities)
create
in interface IGenericHandler
T
- the generic typeentityClass
- the entity classuc
- the ucentities
- the entitiespublic <T extends ITransferableEntity> T create(Class<T> entityClass, UserContext uc, T entity)
create
in interface IGenericHandler
T
- the generic typeentityClass
- the entity classuc
- the ucentity
- the entitypublic <T extends ITransferableEntity> T[] update(Class<T> entityClass, UserContext uc, T... entities)
update
in interface IGenericHandler
T
- the generic typeentityClass
- the entity classuc
- the ucentities
- the entitiespublic <T extends ITransferableEntity> T update(Class<T> entityClass, UserContext uc, T entity)
update
in interface IGenericHandler
T
- the generic typeentityClass
- the entity classuc
- the ucentity
- the entitypublic <T extends ITransferableEntity> Boolean delete(Class<T> entityClass, UserContext uc, T... entities)
delete
in interface IGenericHandler
T
- the generic typeentityClass
- the entity classuc
- the ucentities
- the entitiespublic <T extends ITransferableEntity> Boolean delete(Class<T> entityClass, UserContext uc, T entities)
delete
in interface IGenericHandler
T
- the generic typeentityClass
- the entity classuc
- the ucentities
- the entitiespublic <T extends ITransferableEntity,C extends de.xima.cmn.criteria.interfaces.IFilterableCriteriaManager & de.xima.cmn.criteria.interfaces.ISortableCriteriaManager & de.xima.cmn.criteria.interfaces.IPageableCriteriaManager & de.xima.cmn.criteria.interfaces.IQueryHintProviding> Boolean deleteBy(Class<T> entityClass, UserContext uc, C cm)
deleteBy
in interface IGenericHandler
T
- the generic typeentityClass
- the entity classuc
- the uccm
- the qcmpublic <T extends ITransferableEntity> Boolean deleteById(Class<T> entityClass, UserContext uc, Long id)
deleteById
in interface IGenericHandler
T
- the generic typeentityClass
- the entity classuc
- the ucid
- the idpublic <T extends ITransferableEntity> Boolean deleteById(Class<T> entityClass, UserContext uc, Integer id)
deleteById
in interface IGenericHandler
public <T extends ITransferableEntity,C extends de.xima.cmn.criteria.interfaces.IFilterableCriteriaManager & de.xima.cmn.criteria.interfaces.IQueryHintProviding> Integer resultTotalCount(Class<T> entityClass, UserContext uc, C cm)
resultTotalCount
in interface IGenericHandler
T
- the generic typeentityClass
- the entity classuc
- the uccm
- the qcmprotected <T> List<T> serializableList(Iterable<T> sequence)
Collection
or Iterable
and converts it to a serializable list that can be transferred via
the API.T
- Type of the list items.sequence
- A sequence of items to put into a list.Copyright © 2020 XIMA MEDIA GmbH. All rights reserved.