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,java.lang.Integer,java.lang.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,java.lang.Integer,java.lang.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(java.util.Collection<EventDTO> list)
protected OnmsEvent
doGet(javax.ws.rs.core.UriInfo uriInfo, java.lang.Integer id)
javax.ws.rs.core.Response
get(javax.ws.rs.core.UriInfo uriInfo, java.lang.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 java.util.Map<java.lang.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 java.lang.Class<OnmsEvent>
getDaoClass()
javax.ws.rs.core.Response
getProperties(java.lang.String query)
javax.ws.rs.core.Response
getPropertyValues(java.lang.String propertyId, java.lang.String query, java.lang.Integer limit)
protected java.lang.Class<org.apache.cxf.jaxrs.ext.search.SearchBean>
getQueryBeanClass()
protected java.util.Set<SearchProperty>
getQueryProperties()
Get a list of query properties that this endpoint supports for FIQL expressions andorderBy
expressions.protected java.util.Map<java.lang.String,java.lang.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()
- Specified by:
getDao
in classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,java.lang.Integer,java.lang.Integer>
-
getDaoClass
protected java.lang.Class<OnmsEvent> getDaoClass()
- Specified by:
getDaoClass
in classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,java.lang.Integer,java.lang.Integer>
-
getQueryBeanClass
protected java.lang.Class<org.apache.cxf.jaxrs.ext.search.SearchBean> getQueryBeanClass()
- Specified by:
getQueryBeanClass
in classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,java.lang.Integer,java.lang.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,java.lang.Integer,java.lang.Integer>
-
createListWrapper
protected JaxbListWrapper<EventDTO> createListWrapper(java.util.Collection<EventDTO> list)
- Specified by:
createListWrapper
in classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,java.lang.Integer,java.lang.Integer>
-
getQueryProperties
protected java.util.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,java.lang.Integer,java.lang.Integer>
- Returns:
-
getSearchBeanPropertyMap
protected java.util.Map<java.lang.String,java.lang.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,java.lang.Integer,java.lang.Integer>
- Returns:
-
getCriteriaBehaviors
protected java.util.Map<java.lang.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,java.lang.Integer,java.lang.Integer>
- Returns:
-
doGet
protected OnmsEvent doGet(javax.ws.rs.core.UriInfo uriInfo, java.lang.Integer id)
- Specified by:
doGet
in classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,java.lang.Integer,java.lang.Integer>
-
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,java.lang.Integer,java.lang.Integer>
-
get
public javax.ws.rs.core.Response get(javax.ws.rs.core.UriInfo uriInfo, java.lang.Integer id)
- Specified by:
get
in interfaceEventRestApi
- Overrides:
get
in classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,java.lang.Integer,java.lang.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,java.lang.Integer,java.lang.Integer>
-
getProperties
public javax.ws.rs.core.Response getProperties(java.lang.String query)
- Specified by:
getProperties
in interfaceEventRestApi
- Overrides:
getProperties
in classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,java.lang.Integer,java.lang.Integer>
-
getPropertyValues
public javax.ws.rs.core.Response getPropertyValues(java.lang.String propertyId, java.lang.String query, java.lang.Integer limit)
- Specified by:
getPropertyValues
in interfaceEventRestApi
- Overrides:
getPropertyValues
in classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,java.lang.Integer,java.lang.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,java.lang.Integer,java.lang.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,java.lang.Integer,java.lang.Integer>
-
-