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 forOnmsEvententity.- 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.Responsecreate(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 OnmsEventdoGet(javax.ws.rs.core.UriInfo uriInfo, Integer id)javax.ws.rs.core.Responseget(javax.ws.rs.core.UriInfo uriInfo, Integer id)javax.ws.rs.core.Responseget(javax.ws.rs.core.UriInfo uriInfo, org.apache.cxf.jaxrs.ext.search.SearchContext searchContext)javax.ws.rs.core.ResponsegetCount(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 CriteriaBuildergetCriteriaBuilder(javax.ws.rs.core.UriInfo uriInfo)protected EventDaogetDao()protected Class<OnmsEvent>getDaoClass()javax.ws.rs.core.ResponsegetProperties(String query)javax.ws.rs.core.ResponsegetPropertyValues(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 andorderByexpressions.protected Map<String,String>getSearchBeanPropertyMap()Map properties in the search expression to bean properties in the query capture bean.OnmsEventmapDTOToEntity(EventDTO dto)Map the given instance of the DTO to the corresponding entity.EventDTOmapEntityToDTO(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:
getDaoClassin 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:
getQueryBeanClassin classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,Integer,Integer>
-
getCriteriaBuilder
protected CriteriaBuilder getCriteriaBuilder(javax.ws.rs.core.UriInfo uriInfo)
- Specified by:
getCriteriaBuilderin classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,Integer,Integer>
-
createListWrapper
protected JaxbListWrapper<EventDTO> createListWrapper(Collection<EventDTO> list)
- Specified by:
createListWrapperin classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,Integer,Integer>
-
getQueryProperties
protected Set<SearchProperty> getQueryProperties()
Description copied from class:AbstractDaoRestServiceWithDTOGet a list of query properties that this endpoint supports for FIQL expressions and
orderByexpressions.- Overrides:
getQueryPropertiesin classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,Integer,Integer>- Returns:
-
getSearchBeanPropertyMap
protected Map<String,String> getSearchBeanPropertyMap()
Description copied from class:AbstractDaoRestServiceWithDTOMap properties in the search expression to bean properties in the query capture bean. This is identical to using the
search.bean.property.mapcontext property but allows us to specify a different set of mappings for each service endpoint.- Key: Query property name
- Value: Bean property path
- Overrides:
getSearchBeanPropertyMapin classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,Integer,Integer>- Returns:
-
getCriteriaBehaviors
protected Map<String,CriteriaBehavior<?>> getCriteriaBehaviors()
Description copied from class:AbstractDaoRestServiceWithDTOMap 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:
CriteriaBehaviorto execute when this search term is specified
- Overrides:
getCriteriaBehaviorsin 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:
getin interfaceEventRestApi- Overrides:
getin 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:
getin interfaceEventRestApi- Overrides:
getin 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:
getCountin interfaceEventRestApi- Overrides:
getCountin classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,Integer,Integer>
-
getProperties
public javax.ws.rs.core.Response getProperties(String query)
- Specified by:
getPropertiesin interfaceEventRestApi- Overrides:
getPropertiesin 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:
getPropertyValuesin interfaceEventRestApi- Overrides:
getPropertyValuesin 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 aEventwhereas the parent class receives aOnmsEvent.- Specified by:
createin 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:AbstractDaoRestServiceWithDTOMap the given instance of the entity to the corresponding DTO.- Specified by:
mapEntityToDTOin classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,Integer,Integer>
-
mapDTOToEntity
public OnmsEvent mapDTOToEntity(EventDTO dto)
Description copied from class:AbstractDaoRestServiceWithDTOMap the given instance of the DTO to the corresponding entity.- Specified by:
mapDTOToEntityin classAbstractDaoRestServiceWithDTO<OnmsEvent,EventDTO,org.apache.cxf.jaxrs.ext.search.SearchBean,Integer,Integer>
-
-