findPackages.groovy

import oracle.odi.domain.project.OdiFolder
import oracle.odi.domain.project.OdiPackage
import oracle.odi.domain.project.finder.IOdiPackageFinder

def findPackagesInFolderLike(final String like) {

    IOdiPackageFinder pckFinder = (IOdiPackageFinder) odiInstance
            .getTransactionalEntityManager().getFinder(OdiPackage.class);
    Collection<OdiPackage> odiPackages = pckFinder.findAll();
    odiPackages.each { pck ->
        if (pck.getName().contains(like.replace("%", "").replace("%", ""))) {
            StringBuilder folder = new StringBuilder();
            getFullPath(pck, pck.getParentFolder(), folder);
            folder.append(pck.getName() + "/");
            folder.insert(0, "/" + pck.getParentFolder().getProject().getName() + "/");
            println("Found Package $folder.");
        }
    }
}

def getFullPath(final OdiPackage lp, final OdiFolder parent,
                StringBuilder folder) {
    folder.insert(0, parent.getName() + "/");
    if (parent.getParentFolder() != null) {
        getFullPath(lp, parent.getParentFolder(), folder);
    }
}

findPackagesInFolderLike("DATA");