Search in sources :

Example 6 with OnmsNodeRequisition

use of org.opennms.netmgt.provision.persist.OnmsNodeRequisition in project opennms by OpenNMS.

the class CoreImportActivities method relateNodes.

@Activity(lifecycle = "import", phase = "relate", schedulingHint = "import")
public void relateNodes(final BatchTask currentPhase, final RequisitionImport ri) {
    if (ri.isAborted()) {
        info("The import has been aborted, skipping relate phase.");
        return;
    }
    info("Running relate phase");
    final Requisition requisition = ri.getRequisition();
    RequisitionVisitor visitor = new AbstractRequisitionVisitor() {

        @Override
        public void visitNode(final OnmsNodeRequisition nodeReq) {
            LOG.debug("Scheduling relate of node {}", nodeReq);
            currentPhase.add(parentSetter(m_provisionService, nodeReq, requisition.getForeignSource()));
        }
    };
    requisition.visit(visitor);
    LOG.info("Finished Running relate phase");
}
Also used : AbstractRequisitionVisitor(org.opennms.netmgt.provision.persist.AbstractRequisitionVisitor) RequisitionVisitor(org.opennms.netmgt.provision.persist.RequisitionVisitor) AbstractRequisitionVisitor(org.opennms.netmgt.provision.persist.AbstractRequisitionVisitor) OnmsNodeRequisition(org.opennms.netmgt.provision.persist.OnmsNodeRequisition) Requisition(org.opennms.netmgt.provision.persist.requisition.Requisition) OnmsNodeRequisition(org.opennms.netmgt.provision.persist.OnmsNodeRequisition) Activity(org.opennms.netmgt.provision.service.lifecycle.annotations.Activity)

Aggregations

OnmsNodeRequisition (org.opennms.netmgt.provision.persist.OnmsNodeRequisition)6 Requisition (org.opennms.netmgt.provision.persist.requisition.Requisition)2 HashSet (java.util.HashSet)1 Test (org.junit.Test)1 JUnitDNSServer (org.opennms.core.test.dns.annotations.JUnitDNSServer)1 OnmsCategory (org.opennms.netmgt.model.OnmsCategory)1 OnmsNode (org.opennms.netmgt.model.OnmsNode)1 AbstractRequisitionVisitor (org.opennms.netmgt.provision.persist.AbstractRequisitionVisitor)1 ForeignSourceRepositoryException (org.opennms.netmgt.provision.persist.ForeignSourceRepositoryException)1 OnmsAssetRequisition (org.opennms.netmgt.provision.persist.OnmsAssetRequisition)1 OnmsIpInterfaceRequisition (org.opennms.netmgt.provision.persist.OnmsIpInterfaceRequisition)1 OnmsMonitoredServiceRequisition (org.opennms.netmgt.provision.persist.OnmsMonitoredServiceRequisition)1 OnmsNodeCategoryRequisition (org.opennms.netmgt.provision.persist.OnmsNodeCategoryRequisition)1 OnmsServiceCategoryRequisition (org.opennms.netmgt.provision.persist.OnmsServiceCategoryRequisition)1 RequisitionVisitor (org.opennms.netmgt.provision.persist.RequisitionVisitor)1 Activity (org.opennms.netmgt.provision.service.lifecycle.annotations.Activity)1 UrlResource (org.springframework.core.io.UrlResource)1 Transactional (org.springframework.transaction.annotation.Transactional)1