Search in sources :

Example 1 with RequisitionVisitor

use of org.opennms.netmgt.provision.persist.RequisitionVisitor 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

AbstractRequisitionVisitor (org.opennms.netmgt.provision.persist.AbstractRequisitionVisitor)1 OnmsNodeRequisition (org.opennms.netmgt.provision.persist.OnmsNodeRequisition)1 RequisitionVisitor (org.opennms.netmgt.provision.persist.RequisitionVisitor)1 Requisition (org.opennms.netmgt.provision.persist.requisition.Requisition)1 Activity (org.opennms.netmgt.provision.service.lifecycle.annotations.Activity)1