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;
}
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);
}
}
}
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;
}
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;
}
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;
}
Aggregations