T - Entity object (eg. OnmsEvent)D - DTO object (eg. EventDTO). This is the type of object that will be transfered
to and from the client. Mapping to and from the entity objects is delegated to the
implementation.Q - Query bean. This can be the same as the entity object if the object is a simple
bean but for types with more than one level of bean properties, it makes sense to use a
custom query bean or Apache CXF's SearchBean.K - Type of the primary key of the entity in the database (eg. Integer).I - Object Index (typically the same as the primary key, but can be different in some cases).@Transactional public abstract class AbstractDaoRestServiceWithDTO<T,D,Q,K extends Serializable,I extends Serializable> extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static int |
DEFAULT_LIMIT |
| Constructor and Description |
|---|
AbstractDaoRestServiceWithDTO() |
| Modifier and Type | Method and Description |
|---|---|
static void |
applyLimitOffsetOrderBy(javax.ws.rs.core.MultivaluedMap<String,String> p,
CriteriaBuilder builder) |
javax.ws.rs.core.Response |
create(javax.ws.rs.core.SecurityContext securityContext,
javax.ws.rs.core.UriInfo uriInfo,
D object) |
protected abstract JaxbListWrapper<D> |
createListWrapper(Collection<D> list) |
javax.ws.rs.core.Response |
createSpecific() |
javax.ws.rs.core.Response |
delete(javax.ws.rs.core.SecurityContext securityContext,
javax.ws.rs.core.UriInfo uriInfo,
I id) |
javax.ws.rs.core.Response |
deleteMany(javax.ws.rs.core.SecurityContext securityContext,
javax.ws.rs.core.UriInfo uriInfo,
org.apache.cxf.jaxrs.ext.search.SearchContext searchContext) |
protected javax.ws.rs.core.Response |
doCreate(javax.ws.rs.core.SecurityContext securityContext,
javax.ws.rs.core.UriInfo uriInfo,
T object) |
protected void |
doDelete(javax.ws.rs.core.SecurityContext securityContext,
javax.ws.rs.core.UriInfo uriInfo,
T object) |
protected abstract T |
doGet(javax.ws.rs.core.UriInfo uriInfo,
I id) |
protected javax.ws.rs.core.Response |
doUpdate(javax.ws.rs.core.SecurityContext securityContext,
javax.ws.rs.core.UriInfo uriInfo,
K key,
T targetObject) |
protected javax.ws.rs.core.Response |
doUpdateProperties(javax.ws.rs.core.SecurityContext securityContext,
javax.ws.rs.core.UriInfo uriInfo,
T targetObject,
MultivaluedMapImpl params) |
javax.ws.rs.core.Response |
get(javax.ws.rs.core.UriInfo uriInfo,
I id) |
javax.ws.rs.core.Response |
get(javax.ws.rs.core.UriInfo uriInfo,
org.apache.cxf.jaxrs.ext.search.SearchContext searchContext) |
javax.ws.rs.core.Response |
getCount(javax.ws.rs.core.UriInfo uriInfo,
org.apache.cxf.jaxrs.ext.search.SearchContext searchContext) |
protected Criteria |
getCriteria(javax.ws.rs.core.UriInfo uriInfo,
org.apache.cxf.jaxrs.ext.search.SearchContext searchContext) |
protected Map<String,CriteriaBehavior<?>> |
getCriteriaBehaviors()
Map CXF query bean properties to Criteria property names, conversions,
and actions.
|
protected abstract CriteriaBuilder |
getCriteriaBuilder(javax.ws.rs.core.UriInfo uriInfo) |
protected abstract OnmsDao<T,K> |
getDao() |
protected abstract Class<T> |
getDaoClass() |
protected javax.ws.rs.WebApplicationException |
getException(javax.ws.rs.core.Response.Status status,
String msg,
String... params) |
javax.ws.rs.core.Response |
getProperties(String query) |
javax.ws.rs.core.Response |
getPropertyValues(String propertyId,
String query,
Integer limit) |
protected abstract Class<Q> |
getQueryBeanClass() |
protected Set<SearchProperty> |
getQueryProperties()
Get a list of query properties that this endpoint supports
for FIQL expressions and
orderBy expressions. |
protected Map<String,String> |
getSearchBeanPropertyMap()
Map properties in the search expression to bean properties
in the query capture bean.
|
abstract T |
mapDTOToEntity(D dto)
Map the given instance of the DTO to the corresponding entity.
|
abstract D |
mapEntityToDTO(T entity)
Map the given instance of the entity to the corresponding DTO.
|
protected void |
sendEvent(Event event) |
javax.ws.rs.core.Response |
update(javax.ws.rs.core.SecurityContext securityContext,
javax.ws.rs.core.UriInfo uriInfo,
K id,
T object) |
javax.ws.rs.core.Response |
updateMany(javax.ws.rs.core.SecurityContext securityContext,
javax.ws.rs.core.UriInfo uriInfo,
org.apache.cxf.jaxrs.ext.search.SearchContext searchContext,
MultivaluedMapImpl params) |
javax.ws.rs.core.Response |
updateProperties(javax.ws.rs.core.SecurityContext securityContext,
javax.ws.rs.core.UriInfo uriInfo,
I id,
MultivaluedMapImpl params) |
protected void |
writeLock() |
protected void |
writeUnlock() |
protected static final int DEFAULT_LIMIT
protected abstract CriteriaBuilder getCriteriaBuilder(javax.ws.rs.core.UriInfo uriInfo)
protected abstract JaxbListWrapper<D> createListWrapper(Collection<D> list)
protected final void writeLock()
protected final void writeUnlock()
protected javax.ws.rs.core.Response doCreate(javax.ws.rs.core.SecurityContext securityContext,
javax.ws.rs.core.UriInfo uriInfo,
T object)
protected javax.ws.rs.core.Response doUpdate(javax.ws.rs.core.SecurityContext securityContext,
javax.ws.rs.core.UriInfo uriInfo,
K key,
T targetObject)
protected javax.ws.rs.core.Response doUpdateProperties(javax.ws.rs.core.SecurityContext securityContext,
javax.ws.rs.core.UriInfo uriInfo,
T targetObject,
MultivaluedMapImpl params)
protected void doDelete(javax.ws.rs.core.SecurityContext securityContext,
javax.ws.rs.core.UriInfo uriInfo,
T object)
protected Set<SearchProperty> getQueryProperties()
Get a list of query properties that this endpoint supports
for FIQL expressions and orderBy expressions.
protected Map<String,String> getSearchBeanPropertyMap()
Map properties in the search expression to bean properties
in the query capture bean. This is identical to using the
search.bean.property.map context property but allows us
to specify a different set of mappings for each service endpoint.
http://cxf.apache.org/docs/jax-rs-search.html#JAX-RSSearch-Mappingofquerypropertiestobeanpropertiesprotected Map<String,CriteriaBehavior<?>> getCriteriaBehaviors()
Map CXF query bean properties to Criteria property names, conversions, and actions. In the absence of a mapping, the query bean property will be specified directly as a Criteria property with the same name.
CriteriaBehavior to execute when this search term is specifiedprotected Criteria getCriteria(javax.ws.rs.core.UriInfo uriInfo, org.apache.cxf.jaxrs.ext.search.SearchContext searchContext)
public javax.ws.rs.core.Response get(@Context
javax.ws.rs.core.UriInfo uriInfo,
@Context
org.apache.cxf.jaxrs.ext.search.SearchContext searchContext)
public javax.ws.rs.core.Response getCount(@Context
javax.ws.rs.core.UriInfo uriInfo,
@Context
org.apache.cxf.jaxrs.ext.search.SearchContext searchContext)
public javax.ws.rs.core.Response getProperties(String query)
public javax.ws.rs.core.Response getPropertyValues(String propertyId, String query, Integer limit)
public javax.ws.rs.core.Response get(@Context
javax.ws.rs.core.UriInfo uriInfo,
I id)
public javax.ws.rs.core.Response createSpecific()
public javax.ws.rs.core.Response create(@Context
javax.ws.rs.core.SecurityContext securityContext,
@Context
javax.ws.rs.core.UriInfo uriInfo,
D object)
public javax.ws.rs.core.Response updateMany(@Context
javax.ws.rs.core.SecurityContext securityContext,
@Context
javax.ws.rs.core.UriInfo uriInfo,
@Context
org.apache.cxf.jaxrs.ext.search.SearchContext searchContext,
MultivaluedMapImpl params)
public javax.ws.rs.core.Response update(@Context
javax.ws.rs.core.SecurityContext securityContext,
@Context
javax.ws.rs.core.UriInfo uriInfo,
K id,
T object)
public javax.ws.rs.core.Response updateProperties(@Context
javax.ws.rs.core.SecurityContext securityContext,
@Context
javax.ws.rs.core.UriInfo uriInfo,
I id,
MultivaluedMapImpl params)
public javax.ws.rs.core.Response deleteMany(@Context
javax.ws.rs.core.SecurityContext securityContext,
@Context
javax.ws.rs.core.UriInfo uriInfo,
@Context
org.apache.cxf.jaxrs.ext.search.SearchContext searchContext)
public javax.ws.rs.core.Response delete(@Context
javax.ws.rs.core.SecurityContext securityContext,
@Context
javax.ws.rs.core.UriInfo uriInfo,
I id)
public static void applyLimitOffsetOrderBy(javax.ws.rs.core.MultivaluedMap<String,String> p, CriteriaBuilder builder)
protected void sendEvent(Event event)
protected javax.ws.rs.WebApplicationException getException(javax.ws.rs.core.Response.Status status,
String msg,
String... params)
throws javax.ws.rs.WebApplicationException
javax.ws.rs.WebApplicationExceptionpublic abstract D mapEntityToDTO(T entity)
Copyright © 2022. All rights reserved.