Search in sources :

Example 6 with ObjectLocationSpecificationMethod

use of org.pentaho.di.core.ObjectLocationSpecificationMethod in project pentaho-kettle by pentaho.

the class TransFileListener method processLinkedTrans.

protected TransMeta processLinkedTrans(TransMeta transMeta) {
    for (StepMeta stepMeta : transMeta.getSteps()) {
        if (stepMeta.getStepID().equalsIgnoreCase("TransExecutor")) {
            TransExecutorMeta tem = (TransExecutorMeta) stepMeta.getStepMetaInterface();
            ObjectLocationSpecificationMethod specMethod = tem.getSpecificationMethod();
            // If the reference is by filename, change it to Repository By Name. Otherwise it's fine so leave it alone
            if (specMethod == ObjectLocationSpecificationMethod.FILENAME) {
                tem.setSpecificationMethod(ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME);
                String filename = tem.getFileName();
                String jobname = filename.substring(filename.lastIndexOf("/") + 1, filename.lastIndexOf('.'));
                String directory = filename.substring(0, filename.lastIndexOf("/"));
                tem.setTransName(jobname);
                tem.setDirectoryPath(directory);
            }
        }
    }
    return transMeta;
}
Also used : ObjectLocationSpecificationMethod(org.pentaho.di.core.ObjectLocationSpecificationMethod) TransExecutorMeta(org.pentaho.di.trans.steps.transexecutor.TransExecutorMeta) StepMeta(org.pentaho.di.trans.step.StepMeta)

Aggregations

ObjectLocationSpecificationMethod (org.pentaho.di.core.ObjectLocationSpecificationMethod)6 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)2 JobEntryCopy (org.pentaho.di.job.entry.JobEntryCopy)2 StepMeta (org.pentaho.di.trans.step.StepMeta)2 JobEntryJob (org.pentaho.di.job.entries.job.JobEntryJob)1 JobEntryTrans (org.pentaho.di.job.entries.trans.JobEntryTrans)1 JobExecutorMeta (org.pentaho.di.trans.steps.jobexecutor.JobExecutorMeta)1 TransExecutorMeta (org.pentaho.di.trans.steps.transexecutor.TransExecutorMeta)1