findLoadPlans.groovy

import java.util.Collection;

import oracle.odi.core.OdiInstance;
import oracle.odi.domain.runtime.loadplan.OdiLoadPlan;
import oracle.odi.domain.runtime.loadplan.finder.IOdiLoadPlanFinder;
import oracle.odi.domain.runtime.scenario.OdiScenarioFolder;


def findLoadPlanLike(like) {

    IOdiLoadPlanFinder lpFinder = (IOdiLoadPlanFinder) odiInstance
            .getTransactionalEntityManager().getFinder(OdiLoadPlan.class);
    Collection<OdiLoadPlan> loadplans = lpFinder.findAll();

    loadplans.each{ lp ->
        StringBuilder folder = new StringBuilder();
        getFullPath(lp, lp.scenarioFolder, folder);
        folder.insert(0, "/");
        println "Found loadplan $lp.name in folder $folder $lp.name."
    }
}

def getFullPath(final OdiLoadPlan lp, final OdiScenarioFolder parent,  StringBuilder folder){
    folder.insert(0, parent.name +"/");
    if(parent.parentScenFolder != null){
        getFullPath(  lp,   parent.parentScenFolder,   folder);
    }
}

findLoadPlanLike("LOADPLAN_NAME")