Search in sources :

Example 1 with ObjectLocationSpecificationMethod

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

the class TransFileListener method processLinkedJobs.

protected TransMeta processLinkedJobs(TransMeta transMeta) {
    for (StepMeta stepMeta : transMeta.getSteps()) {
        if (stepMeta.getStepID().equalsIgnoreCase("JobExecutor")) {
            JobExecutorMeta jem = (JobExecutorMeta) stepMeta.getStepMetaInterface();
            ObjectLocationSpecificationMethod specMethod = jem.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) {
                jem.setSpecificationMethod(ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME);
                String filename = jem.getFileName();
                String jobname = filename.substring(filename.lastIndexOf("/") + 1, filename.lastIndexOf('.'));
                String directory = filename.substring(0, filename.lastIndexOf("/"));
                jem.setJobName(jobname);
                jem.setDirectoryPath(directory);
            }
        }
    }
    return transMeta;
}
Also used : ObjectLocationSpecificationMethod(org.pentaho.di.core.ObjectLocationSpecificationMethod) JobExecutorMeta(org.pentaho.di.trans.steps.jobexecutor.JobExecutorMeta) StepMeta(org.pentaho.di.trans.step.StepMeta)

Example 2 with ObjectLocationSpecificationMethod

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

the class EntryCurrentDirectoryChangedListener method directoryChanged.

@Override
public void directoryChanged(Object origin, String oldCurrentDir, String newCurrentDir) {
    for (PathReference ref : references) {
        ObjectLocationSpecificationMethod specMethod = ref.getSpecification();
        String path = ref.getPath();
        if ((specMethod == ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME || specMethod == ObjectLocationSpecificationMethod.FILENAME) && StringUtils.contains(path, Const.INTERNAL_VARIABLE_ENTRY_CURRENT_DIRECTORY) && !Objects.equal(oldCurrentDir, newCurrentDir)) {
            path = reapplyCurrentDir(oldCurrentDir, newCurrentDir, path);
            ref.setPath(path);
        }
    }
}
Also used : ObjectLocationSpecificationMethod(org.pentaho.di.core.ObjectLocationSpecificationMethod)

Example 3 with ObjectLocationSpecificationMethod

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

the class JobFileListener method processLinkedJobs.

protected JobMeta processLinkedJobs(JobMeta jobMeta) {
    for (int i = 0; i < jobMeta.nrJobEntries(); i++) {
        JobEntryCopy jec = jobMeta.getJobEntry(i);
        if (jec.getEntry() instanceof JobEntryJob) {
            JobEntryJob jej = (JobEntryJob) jec.getEntry();
            ObjectLocationSpecificationMethod specMethod = jej.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) {
                jej.setSpecificationMethod(ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME);
                String filename = jej.getFilename();
                // handle any exceptions that arise from this
                if (filename.indexOf("/") > -1) {
                    String jobname = filename.substring(filename.lastIndexOf("/") + 1, filename.lastIndexOf('.'));
                    String directory = filename.substring(0, filename.lastIndexOf("/"));
                    jej.setJobName(jobname);
                    jej.setDirectory(directory);
                } else {
                    jej.setJobName(filename);
                }
                jobMeta.setJobEntry(i, jec);
            }
        }
    }
    return jobMeta;
}
Also used : ObjectLocationSpecificationMethod(org.pentaho.di.core.ObjectLocationSpecificationMethod) JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) JobEntryJob(org.pentaho.di.job.entries.job.JobEntryJob) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint)

Example 4 with ObjectLocationSpecificationMethod

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

the class JobFileListener method processLinkedTrans.

protected JobMeta processLinkedTrans(JobMeta jobMeta) {
    for (int i = 0; i < jobMeta.nrJobEntries(); i++) {
        JobEntryCopy jec = jobMeta.getJobEntry(i);
        if (jec.getEntry() instanceof JobEntryTrans) {
            JobEntryTrans jet = (JobEntryTrans) jec.getEntry();
            ObjectLocationSpecificationMethod specMethod = jet.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) {
                jet.setSpecificationMethod(ObjectLocationSpecificationMethod.REPOSITORY_BY_NAME);
                String filename = jet.getFilename();
                // handle any exceptions that arise from this
                if (filename.indexOf("/") > -1) {
                    String jobname = filename.substring(filename.lastIndexOf("/") + 1, filename.lastIndexOf('.'));
                    String directory = filename.substring(0, filename.lastIndexOf("/"));
                    jet.setTransname(jobname);
                    jet.setDirectory(directory);
                } else {
                    jet.setTransname(filename);
                }
                jobMeta.setJobEntry(i, jec);
            }
        }
    }
    return jobMeta;
}
Also used : ObjectLocationSpecificationMethod(org.pentaho.di.core.ObjectLocationSpecificationMethod) JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) JobEntryTrans(org.pentaho.di.job.entries.trans.JobEntryTrans) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint)

Example 5 with ObjectLocationSpecificationMethod

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

the class ObjectLocationSpecificationMethodLoadSaveValidator method getTestObject.

@Override
public ObjectLocationSpecificationMethod getTestObject() {
    ObjectLocationSpecificationMethod[] methods = ObjectLocationSpecificationMethod.values();
    ObjectLocationSpecificationMethod rtn = methods[rand.nextInt(methods.length)];
    return rtn;
}
Also used : ObjectLocationSpecificationMethod(org.pentaho.di.core.ObjectLocationSpecificationMethod)

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