本文整理汇总了Java中org.opennms.netmgt.model.OnmsNode.visit方法的典型用法代码示例。如果您正苦于以下问题:Java OnmsNode.visit方法的具体用法?Java OnmsNode.visit怎么用?Java OnmsNode.visit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opennms.netmgt.model.OnmsNode
的用法示例。
在下文中一共展示了OnmsNode.visit方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: insertNode
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Transactional
public void insertNode(final OnmsNode node) {
node.setDistPoller(createDistPollerIfNecessary("localhost", "127.0.0.1"));
m_nodeDao.save(node);
m_nodeDao.flush();
final EntityVisitor eventAccumlator = new AddEventVisitor(m_eventForwarder);
node.visit(eventAccumlator);
if (node.getCategories().size() > 0) {
final EventBuilder bldr = new EventBuilder(EventConstants.NODE_CATEGORY_MEMBERSHIP_CHANGED_EVENT_UEI, "OnmsNode.mergeNodeAttributes");
bldr.setNode(node);
bldr.addParam(EventConstants.PARM_NODE_LABEL, node.getLabel());
m_eventForwarder.sendNow(bldr.getEvent());
}
}
示例2: getRequisitionedNode
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Transactional
public OnmsNode getRequisitionedNode(final String foreignSource, final String foreignId) throws ForeignSourceRepositoryException {
final OnmsNodeRequisition nodeReq = m_foreignSourceRepository.getNodeRequisition(foreignSource, foreignId);
if (nodeReq == null) {
warnf(this, "nodeReq for node %s:%s cannot be null!", foreignSource, foreignId);
return null;
}
final OnmsNode node = nodeReq.constructOnmsNodeFromRequisition();
// fill in real database categories
final HashSet<OnmsCategory> dbCategories = new HashSet<OnmsCategory>();
for(final OnmsCategory category : node.getCategories()) {
dbCategories.add(createCategoryIfNecessary(category.getName()));
}
node.setCategories(dbCategories);
// fill in real service types
node.visit(new ServiceTypeFulfiller());
return node;
}
示例3: updateNode
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Transactional
public void updateNode(final OnmsNode node, boolean rescanExisting) {
final OnmsNode dbNode = m_nodeDao.getHierarchy(node.getId());
final Set<OnmsCategory> existingCategories = dbNode.getCategories();
final Set<OnmsCategory> newCategories = node.getCategories();
dbNode.mergeNode(node, m_eventForwarder, false);
m_nodeDao.update(dbNode);
m_nodeDao.flush();
final EntityVisitor eventAccumlator = new UpdateEventVisitor(m_eventForwarder, rescanExisting);
node.visit(eventAccumlator);
boolean categoriesChanged = false;
if (existingCategories.size() != newCategories.size()) categoriesChanged = true;
if (!categoriesChanged && !existingCategories.containsAll(newCategories)) categoriesChanged = true;
if (!categoriesChanged && !newCategories.containsAll(existingCategories)) categoriesChanged = true;
if (categoriesChanged) {
final EventBuilder bldr = new EventBuilder(EventConstants.NODE_CATEGORY_MEMBERSHIP_CHANGED_EVENT_UEI, "OnmsNode.mergeNodeAttributes");
bldr.setNode(dbNode);
bldr.addParam(EventConstants.PARM_NODE_LABEL, dbNode.getLabel());
m_eventForwarder.sendNow(bldr.getEvent());
}
}
示例4: visitNodes
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
private void visitNodes(Collection<OnmsNode> nodes,
AggregateStatusVisitor statusVisitor) {
if (nodes == null) {
return;
}
for (OnmsNode node : nodes) {
node.visit(statusVisitor);
}
}
示例5: scheduleNode
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
private void scheduleNode(final int nodeId, final boolean existing) {
getCollectorConfigDao().rebuildPackageIpListMap();
OnmsNode node = m_nodeDao.getHierarchy(nodeId);
node.visit(new AbstractEntityVisitor() {
@Override
public void visitMonitoredService(OnmsMonitoredService monSvc) {
scheduleInterface(monSvc.getIpInterface(), monSvc.getServiceName(), existing);
}
});
}
示例6: persist
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
/**
* <p>persist</p>
*
* @return a {@link java.util.List} object.
*/
public List<Event> persist() {
//TODO: whatif node comes back as null? can this happend?
OnmsNode node = m_nodeDao.get(m_nodeId);
if (node == null) return new ArrayList<Event>(0);
m_nodeDao.delete(node);
final List<Event> events = new LinkedList<Event>();
EntityVisitor eventAccumlator = new DeleteEventVisitor(events);
node.visit(eventAccumlator);
return events;
}
示例7: createOutageForNodeInCategory
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
private void createOutageForNodeInCategory(String categoryName){
OnmsCategory category = m_categoryDao.findByName(categoryName);
Collection<OnmsNode> nodes = m_nodeDao.findByCategory(category);
assertNotNull(nodes);
assertFalse(nodes.isEmpty());
OnmsNode node = nodes.iterator().next();
node.visit(new AbstractEntityVisitor() {
@Override
public void visitMonitoredService(OnmsMonitoredService monSvc) {
createOutageForService(monSvc);
}
});
}
示例8: deleteNode
import org.opennms.netmgt.model.OnmsNode; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Transactional
public void deleteNode(final Integer nodeId) {
final OnmsNode node = m_nodeDao.get(nodeId);
if (node != null && shouldDelete(node)) {
m_nodeDao.delete(node);
node.visit(new DeleteEventVisitor(m_eventForwarder));
}
}