Search in sources :

Example 11 with OnmsMinion

use of org.opennms.netmgt.model.minion.OnmsMinion in project opennms by OpenNMS.

the class MinionRestService method delete.

@DELETE
@Path("{id}")
@Override
public Response delete(@PathParam("id") final String id) {
    final OnmsMinion minion = getDao().get(id);
    final String location = minion.getLocation();
    Response response = super.delete(id);
    final EventBuilder eventBuilder = new EventBuilder(EventConstants.MONITORING_SYSTEM_DELETED_UEI, "OpenNMS.WebUI");
    eventBuilder.addParam(EventConstants.PARAM_MONITORING_SYSTEM_TYPE, OnmsMonitoringSystem.TYPE_MINION);
    eventBuilder.addParam(EventConstants.PARAM_MONITORING_SYSTEM_ID, id);
    eventBuilder.addParam(EventConstants.PARAM_MONITORING_SYSTEM_LOCATION, location);
    try {
        m_eventProxy.send(eventBuilder.getEvent());
    } catch (final EventProxyException e) {
        LOG.warn(" Failed to send Event on Minion deletion " + e.getMessage(), e);
    }
    return response;
}
Also used : Response(javax.ws.rs.core.Response) EventBuilder(org.opennms.netmgt.model.events.EventBuilder) OnmsMinion(org.opennms.netmgt.model.minion.OnmsMinion) EventProxyException(org.opennms.netmgt.events.api.EventProxyException) Path(javax.ws.rs.Path) DELETE(javax.ws.rs.DELETE)

Aggregations

OnmsMinion (org.opennms.netmgt.model.minion.OnmsMinion)11 Date (java.util.Date)4 Test (org.junit.Test)3 Transactional (org.springframework.transaction.annotation.Transactional)3 Path (javax.ws.rs.Path)2 Response (javax.ws.rs.core.Response)2 EventProxyException (org.opennms.netmgt.events.api.EventProxyException)2 EventBuilder (org.opennms.netmgt.model.events.EventBuilder)2 InetSocketAddress (java.net.InetSocketAddress)1 List (java.util.List)1 DELETE (javax.ws.rs.DELETE)1 GET (javax.ws.rs.GET)1 Produces (javax.ws.rs.Produces)1 WebTarget (javax.ws.rs.client.WebTarget)1 GenericType (javax.ws.rs.core.GenericType)1 Before (org.junit.Before)1 Ignore (org.junit.Ignore)1 OnmsNode (org.opennms.netmgt.model.OnmsNode)1 PollStatus (org.opennms.netmgt.poller.PollStatus)1 RestClient (org.opennms.smoketest.utils.RestClient)1