@Override public void process(final Header eventHeader, final Event event) throws EventProcessorException { LOG.debug("Writing event: {}", event); final OnmsEvent oe = new OnmsEvent(); oe.setEventAutoAction( (event.getAutoactionCount() > 0) ? AutoAction.format(event.getAutoaction(), EVENT_AUTOACTION_FIELD_SIZE) : null); oe.setEventCorrelation( (event.getCorrelation() != null) ? org.opennms.netmgt.dao.util.Correlation.format( event.getCorrelation(), EVENT_CORRELATION_FIELD_SIZE) : null); oe.setEventCreateTime(event.getCreationTime()); oe.setId(event.getDbid()); oe.setEventDescr(event.getDescr()); try { oe.setDistPoller(m_distPollerDao.get(event.getDistPoller())); } catch (final DataAccessException e) { throw new EventProcessorException(e); } oe.setEventHost(event.getHost()); oe.setEventForward( (event.getForwardCount() > 0) ? org.opennms.netmgt.dao.util.Forward.format( event.getForward(), EVENT_FORWARD_FIELD_SIZE) : null); oe.setIfIndex(event.getIfIndex()); oe.setIpAddr(event.getInterfaceAddress()); if (event.getLogmsg() != null) { // set log message oe.setEventLogMsg(EventDatabaseConstants.format(event.getLogmsg().getContent(), 0)); final String logdest = event.getLogmsg().getDest(); if (logdest.equals("logndisplay")) { // if 'logndisplay' set both log and display column to yes oe.setEventLog("Y"); oe.setEventDisplay("Y"); } else if (logdest.equals("logonly")) { // if 'logonly' set log column to true oe.setEventLog("Y"); oe.setEventDisplay("N"); } else if (logdest.equals("displayonly")) { // if 'displayonly' set display column to true oe.setEventLog("N"); oe.setEventDisplay("Y"); } else if (logdest.equals("suppress")) { // if 'suppress' set both log and display to false oe.setEventLog("N"); oe.setEventDisplay("N"); } } oe.setEventMouseOverText(event.getMouseovertext()); try { oe.setNode(m_nodeDao.get(event.getNodeid().intValue())); } catch (final DataAccessException e) { throw new EventProcessorException(e); } if (event.getOperactionCount() > 0) { final List<Operaction> a = new ArrayList<Operaction>(); final List<String> b = new ArrayList<String>(); for (final Operaction eoa : event.getOperactionCollection()) { a.add(eoa); b.add(eoa.getMenutext()); } oe.setEventOperAction(OperatorAction.format(a, EVENT_OPERACTION_FIELD_SIZE)); oe.setEventOperActionMenuText( EventDatabaseConstants.format(b, EVENT_OPERACTION_MENU_FIELD_SIZE)); } oe.setEventOperInstruct(event.getOperinstruct()); oe.setEventParms(EventParameterUtils.format(event)); oe.setEventPathOutage(event.getPathoutage()); try { oe.setServiceType(m_serviceTypeDao.findByName(event.getService())); } catch (final DataAccessException e) { throw new EventProcessorException(e); } oe.setSeverityLabel(event.getSeverity()); oe.setEventSnmp(SnmpInfo.format(event.getSnmp(), EVENT_SNMP_FIELD_SIZE)); oe.setEventSnmpHost( EventDatabaseConstants.format(event.getSnmphost(), EVENT_SNMPHOST_FIELD_SIZE)); oe.setEventSource(event.getSource()); oe.setEventTime(event.getTime()); if (event.getTticket() != null) { oe.setEventTTicket( EventDatabaseConstants.format(event.getTticket().getContent(), EVENT_TTICKET_FIELD_SIZE)); oe.setEventTTicketState(event.getTticket().getState().equals("on") ? 1 : 0); } oe.setEventUei(event.getUei()); m_eventDao.saveOrUpdate(oe); }