Package org.opennms.web.rest.v2
Class EventRestService
- java.lang.Object
-
- org.opennms.web.rest.v2.AbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,Integer,Integer>
-
- org.opennms.web.rest.v2.EventRestService
-
- All Implemented Interfaces:
EventRestApi
@Component @Transactional public class EventRestService extends AbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,Integer,Integer> implements EventRestApi
Basic Web Service using REST forOnmsEvent
entity.- Author:
- Alejandro Galue
-
-
Field Summary
-
Fields inherited from class org.opennms.web.rest.v2.AbstractDaoRestServiceWithDTO
DEFAULT_LIMIT
-
-
Constructor Summary
Constructors Constructor Description EventRestService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.ws.rs.core.Response
create(Event event)
NOTE: This method defines an unused parameter of 0 length in the @Path annotation in order to get CXF to prioritize this method definition instead of the create method defined in the parent class.protected JaxbListWrapper<EventDTO>
createListWrapper(Collection<EventDTO> list)
protected OnmsEvent
doGet(javax.ws.rs.core.UriInfo uriInfo, Integer id)
javax.ws.rs.core.Response
get(javax.ws.rs.core.UriInfo uriInfo, Integer 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 Map<String,CriteriaBehavior<?>>
getCriteriaBehaviors()
Map CXF query bean properties to Criteria property names, conversions, and actions.protected CriteriaBuilder
getCriteriaBuilder(javax.ws.rs.core.UriInfo uriInfo)
protected EventDao
getDao()
protected Class<OnmsEvent>
getDaoClass()
javax.ws.rs.core.Response
getProperties(String query)
javax.ws.rs.core.Response
getPropertyValues(String propertyId, String query, Integer limit)
protected Class<org.apache.cxf.jaxrs.ext.search.SearchBean>
getQueryBeanClass()
protected Set<SearchProperty>
getQueryProperties()
Get a list of query properties that this endpoint supports for FIQL expressions andorderBy
expressions.protected Map<String,String>
getSearchBeanPropertyMap()
Map properties in the search expression to bean properties in the query capture bean.OnmsEvent
mapDTOToEntity(EventDTO dto)
Map the given instance of the DTO to the corresponding entity.EventDTO
mapEntityToDTO(OnmsEvent entity)
Map the given instance of the entity to the corresponding DTO.-
Methods inherited from class org.opennms.web.rest.v2.AbstractDaoRestServiceWithDTO
applyLimitOffsetOrderBy, create, createSpecific, delete, deleteMany, doCreate, doDelete, doUpdate, doUpdateProperties, getCriteria, getException, sendEvent, update, updateMany, updateProperties, writeLock, writeUnlock
-
-
-
-
Method Detail
-
getDao
protected EventDao getDao()
-
getDaoClass
protected Class<OnmsEvent> getDaoClass()
- Specified by:
getDaoClass
in classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,Integer,Integer>
-
getQueryBeanClass
protected Class<org.apache.cxf.jaxrs.ext.search.SearchBean> getQueryBeanClass()
- Specified by:
getQueryBeanClass
in classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,Integer,Integer>
-
getCriteriaBuilder
protected CriteriaBuilder getCriteriaBuilder(javax.ws.rs.core.UriInfo uriInfo)
- Specified by:
getCriteriaBuilder
in classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,Integer,Integer>
-
createListWrapper
protected JaxbListWrapper<EventDTO> createListWrapper(Collection<EventDTO> list)
- Specified by:
createListWrapper
in classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,Integer,Integer>
-
getQueryProperties
protected Set<SearchProperty> getQueryProperties()
Description copied from class:AbstractDaoRestServiceWithDTO
Get a list of query properties that this endpoint supports for FIQL expressions and
orderBy
expressions.- Overrides:
getQueryProperties
in classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,Integer,Integer>
- Returns:
-
getSearchBeanPropertyMap
protected Map<String,String> getSearchBeanPropertyMap()
Description copied from class:AbstractDaoRestServiceWithDTO
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.- Key: Query property name
- Value: Bean property path
- Overrides:
getSearchBeanPropertyMap
in classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,Integer,Integer>
- Returns:
-
getCriteriaBehaviors
protected Map<String,CriteriaBehavior<?>> getCriteriaBehaviors()
Description copied from class:AbstractDaoRestServiceWithDTO
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.
- Key: CXF query property name
- Value:
CriteriaBehavior
to execute when this search term is specified
- Overrides:
getCriteriaBehaviors
in classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,Integer,Integer>
- Returns:
-
get
public javax.ws.rs.core.Response get(javax.ws.rs.core.UriInfo uriInfo, org.apache.cxf.jaxrs.ext.search.SearchContext searchContext)
- Specified by:
get
in interfaceEventRestApi
- Overrides:
get
in classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,Integer,Integer>
-
get
public javax.ws.rs.core.Response get(javax.ws.rs.core.UriInfo uriInfo, Integer id)
- Specified by:
get
in interfaceEventRestApi
- Overrides:
get
in classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,Integer,Integer>
-
getCount
public javax.ws.rs.core.Response getCount(javax.ws.rs.core.UriInfo uriInfo, org.apache.cxf.jaxrs.ext.search.SearchContext searchContext)
- Specified by:
getCount
in interfaceEventRestApi
- Overrides:
getCount
in classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,Integer,Integer>
-
getProperties
public javax.ws.rs.core.Response getProperties(String query)
- Specified by:
getProperties
in interfaceEventRestApi
- Overrides:
getProperties
in classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,Integer,Integer>
-
getPropertyValues
public javax.ws.rs.core.Response getPropertyValues(String propertyId, String query, Integer limit)
- Specified by:
getPropertyValues
in interfaceEventRestApi
- Overrides:
getPropertyValues
in classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,Integer,Integer>
-
create
public javax.ws.rs.core.Response create(Event event)
NOTE: This method defines an unused parameter of 0 length in the @Path annotation in order to get CXF to prioritize this method definition instead of the create method defined in the parent class. We cannot simply override the parent method, since the class types are different: we want to receive aEvent
whereas the parent class receives aOnmsEvent
.- Specified by:
create
in interfaceEventRestApi
- Parameters:
event
- the event to forward- Returns:
- a response containing "no content" (204) when the event was succesfully forwarded
-
mapEntityToDTO
public EventDTO mapEntityToDTO(OnmsEvent entity)
Description copied from class:AbstractDaoRestServiceWithDTO
Map the given instance of the entity to the corresponding DTO.- Specified by:
mapEntityToDTO
in classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,Integer,Integer>
-
mapDTOToEntity
public OnmsEvent mapDTOToEntity(EventDTO dto)
Description copied from class:AbstractDaoRestServiceWithDTO
Map the given instance of the DTO to the corresponding entity.- Specified by:
mapDTOToEntity
in classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,Integer,Integer>
-
-