use of org.opennms.web.rest.model.v2.EventDTO in project candlepin by candlepin.
the class OwnerResource method getEvents.
/**
* Retrieves a list of Events for an Owner
*
* @return a list of Event objects
* @httpcode 404
* @httpcode 200
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("{owner_key}/events")
@ApiOperation(notes = "Retrieves a list of Events for an Owner", value = "Get Events")
@ApiResponses({ @ApiResponse(code = 404, message = "Owner not found") })
public List<EventDTO> getEvents(@PathParam("owner_key") @Verify(Owner.class) String ownerKey) {
Owner o = findOwnerByKey(ownerKey);
List<Event> events = this.eventCurator.listMostRecent(FEED_LIMIT, o).list();
List<EventDTO> eventDTOs = null;
if (events != null) {
eventAdapter.addMessageText(events);
eventDTOs = new ArrayList<>();
for (Event event : events) {
eventDTOs.add(this.translator.translate(event, EventDTO.class));
}
}
return eventDTOs;
}
Aggregations