本文整理了Java中org.opennms.netmgt.xml.event.Event.setNodeid()
方法的一些代码示例,展示了Event.setNodeid()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Event.setNodeid()
方法的具体详情如下:
包路径:org.opennms.netmgt.xml.event.Event
类名称:Event
方法名:setNodeid
[英]Sets the value of field 'nodeid'. The field 'nodeid' has the following description: The nodeid to which this event pertains
[中]设置字段“nodeid”的值。字段“nodeid”具有以下描述:此事件所属的nodeid
代码示例来源:origin: OpenNMS/opennms
/**
* <p>setNodeid</p>
*
* @param nodeid a long.
* @return a {@link org.opennms.netmgt.model.events.EventBuilder} object.
*/
public EventBuilder setNodeid(long nodeid) {
m_event.setNodeid(nodeid);
return this;
}
代码示例来源:origin: OpenNMS/opennms
/**
* <p>setNode</p>
*
* @param node a {@link org.opennms.netmgt.model.OnmsNode} object.
* @return a {@link org.opennms.netmgt.model.events.EventBuilder} object.
*/
public EventBuilder setNode(final OnmsNode node) {
if (node != null) {
m_event.setNodeid(node.getId().longValue());
}
return this;
}
代码示例来源:origin: org.opennms.features.activemq/org.opennms.features.activemq.event-receiver
@Override
public void process(final Exchange exchange) throws Exception {
final Event event = exchange.getIn().getBody(Event.class);
String systemId = exchange.getIn().getHeader(EVENT_HEADER_SYSTEMID, String.class);
if (event.getNodeid() > 0) {
String foreignSource = exchange.getIn().getHeader(EVENT_HEADER_FOREIGNSOURCE, String.class);
String foreignId = exchange.getIn().getHeader(EVENT_HEADER_FOREIGNID, String.class);
OnmsNode node = nodeDao.findByForeignId(foreignSource, foreignId);
if (node != null && node.getId() != null) {
event.setNodeid(node.getId().longValue());
event.setDistPoller(systemId);
event.setSource("Endpoint="+systemId+":"+event.getSource());
} else {
LOG.warn("Could not find node {}/{} in the database, cannot update node ID to local value; discarding event", foreignSource, foreignId);
// Halt the route if we cannot translate the node ID
exchange.setProperty(Exchange.ROUTE_STOP, Boolean.TRUE);
}
}
}
}
代码示例来源:origin: org.opennms.features.amqp/org.opennms.features.amqp.event-receiver
@Override
public void process(final Exchange exchange) throws Exception {
final String eventXml = exchange.getIn().getBody(String.class);
final Event event = JaxbUtils.unmarshal(Event.class, eventXml);
final String systemId = exchange.getIn().getHeader(EVENT_HEADER_SYSTEMID, String.class);
if (event.getNodeid() > 0) {
String foreignSource = exchange.getIn().getHeader(EVENT_HEADER_FOREIGNSOURCE, String.class);
String foreignId = exchange.getIn().getHeader(EVENT_HEADER_FOREIGNID, String.class);
OnmsNode node = nodeDao.findByForeignId(foreignSource, foreignId);
if (node != null && node.getId() != null) {
event.setNodeid(node.getId().longValue());
event.setDistPoller(systemId);
event.setSource("Endpoint="+systemId+":"+event.getSource());
} else {
LOG.warn("Could not find node {}/{} in the database, cannot update node ID to local value; discarding event", foreignSource, foreignId);
// Halt the route if we cannot translate the node ID
exchange.setProperty(Exchange.ROUTE_STOP, Boolean.TRUE);
}
}
exchange.getIn().setBody(event, Event.class);
}
代码示例来源:origin: OpenNMS/opennms
@Override
public void process(final Exchange exchange) throws Exception {
final String eventXml = exchange.getIn().getBody(String.class);
final Event event = JaxbUtils.unmarshal(Event.class, eventXml);
final String systemId = exchange.getIn().getHeader(EVENT_HEADER_SYSTEMID, String.class);
if (event.getNodeid() > 0) {
String foreignSource = exchange.getIn().getHeader(EVENT_HEADER_FOREIGNSOURCE, String.class);
String foreignId = exchange.getIn().getHeader(EVENT_HEADER_FOREIGNID, String.class);
OnmsNode node = nodeDao.findByForeignId(foreignSource, foreignId);
if (node != null && node.getId() != null) {
event.setNodeid(node.getId().longValue());
event.setDistPoller(systemId);
event.setSource("Endpoint="+systemId+":"+event.getSource());
} else {
LOG.warn("Could not find node {}/{} in the database, cannot update node ID to local value; discarding event", foreignSource, foreignId);
// Halt the route if we cannot translate the node ID
exchange.setProperty(Exchange.ROUTE_STOP, Boolean.TRUE);
}
}
exchange.getIn().setBody(event, Event.class);
}
代码示例来源:origin: OpenNMS/opennms
@Override
public void processRow(ResultSet rs) throws SQLException {
event.setDbid(rs.getInt("eventid"));
event.setUei(rs.getString("eventuei"));
event.setNodeid(rs.getLong("nodeid"));
event.setTime(rs.getDate("eventtime"));
event.setHost(rs.getString("eventhost"));
event.setInterface(rs.getString("ipaddr"));
event.setSnmphost(rs.getString("eventsnmphost"));
event.setService(getServiceName(rs.getInt("serviceid")));
event.setCreationTime(rs.getDate("eventcreatetime"));
event.setSeverity(rs.getString("eventseverity"));
event.setPathoutage(rs.getString("eventpathoutage"));
Tticket tticket = new Tticket();
tticket.setContent(rs.getString("eventtticket"));
tticket.setState(rs.getString("eventtticketstate"));
event.setTticket(tticket);
event.setSource(rs.getString("eventsource"));
}
代码示例来源:origin: OpenNMS/opennms
/**
* <p>setMonitoredService</p>
*
* @param monitoredService a {@link org.opennms.netmgt.model.OnmsMonitoredService} object.
* @return a {@link org.opennms.netmgt.model.events.EventBuilder} object.
*/
public EventBuilder setMonitoredService(final OnmsMonitoredService monitoredService) {
if (monitoredService != null) {
m_event.setNodeid(monitoredService.getNodeId().longValue());
m_event.setInterfaceAddress(monitoredService.getIpAddress());
m_event.setService(monitoredService.getServiceName());
}
return this;
}
代码示例来源:origin: OpenNMS/opennms
/**
* <p>setIpInterface</p>
*
* @param iface a {@link org.opennms.netmgt.model.OnmsIpInterface} object.
* @return a {@link org.opennms.netmgt.model.events.EventBuilder} object.
*/
public EventBuilder setIpInterface(final OnmsIpInterface iface) {
if (iface != null) {
if (iface.getNode() != null) {
m_event.setNodeid(iface.getNode().getId().longValue());
}
m_event.setInterfaceAddress(iface.getIpAddress());
}
return this;
}
代码示例来源:origin: OpenNMS/opennms
final OnmsNode node = getNodeDao().findByForeignId(foreignSource.getValue().getContent(), foreignId.getValue().getContent());
if (node != null) {
event.setNodeid(node.getId().longValue());
} else {
LOG.warn("Can't find node associated with foreignSource {} and foreignId {}", foreignSource, foreignId);
代码示例来源:origin: org.opennms.features.events/org.opennms.features.events.daemon
final OnmsNode node = getNodeDao().findByForeignId(foreignSource.getValue().getContent(), foreignId.getValue().getContent());
if (node != null) {
event.setNodeid(node.getId().longValue());
} else {
LOG.warn("Can't find node associated with foreignSource {} and foreignId {}", foreignSource, foreignId);
代码示例来源:origin: OpenNMS/opennms
event.setNodeid(onmsEvent.getNodeId().longValue());
代码示例来源:origin: org.opennms.plugins/opennms-es-rest.main-module
Integer i = onmsEvent.getNodeId();
Long l = Long.valueOf(i.longValue());
event.setNodeid(l);
代码示例来源:origin: org.opennms.features/org.opennms.features.opennms-es-rest
event.setNodeid(onmsEvent.getNodeId().longValue());
代码示例来源:origin: OpenNMS/opennms
event.setNodeid(alarm.getNode().getId().longValue());
内容来源于网络,如有侵权,请联系作者删除!