use of org.pentaho.di.repository.LongObjectId in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryJobDelegate method loadJobHopMeta.
public JobHopMeta loadJobHopMeta(ObjectId id_job_hop, List<JobEntryCopy> jobcopies) throws KettleException {
JobHopMeta jobHopMeta = new JobHopMeta();
try {
RowMetaAndData r = getJobHop(id_job_hop);
if (r != null) {
long id_jobentry_copy_from = r.getInteger("ID_JOBENTRY_COPY_FROM", -1L);
long id_jobentry_copy_to = r.getInteger("ID_JOBENTRY_COPY_TO", -1L);
jobHopMeta.setEnabled(r.getBoolean("ENABLED", true));
jobHopMeta.setEvaluation(r.getBoolean("EVALUATION", true));
jobHopMeta.setConditional();
if (r.getBoolean("UNCONDITIONAL", !jobHopMeta.getEvaluation())) {
jobHopMeta.setUnconditional();
}
jobHopMeta.setFromEntry(JobMeta.findJobEntryCopy(jobcopies, new LongObjectId(id_jobentry_copy_from)));
jobHopMeta.setToEntry(JobMeta.findJobEntryCopy(jobcopies, new LongObjectId(id_jobentry_copy_to)));
return jobHopMeta;
} else {
throw new KettleException("Unable to find job hop with ID : " + id_job_hop);
}
} catch (KettleDatabaseException dbe) {
throw new KettleException(BaseMessages.getString(PKG, "JobHopMeta.Exception.UnableToLoadHopInfoRep", "" + id_job_hop), dbe);
}
}
use of org.pentaho.di.repository.LongObjectId in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryJobDelegate method getJobsWithIDList.
public String[] getJobsWithIDList(ObjectId[] ids) throws KettleException {
String[] jobsList = new String[ids.length];
for (int i = 0; i < ids.length; i++) {
ObjectId id_job = ids[i];
if (id_job != null) {
RowMetaAndData transRow = getJob(id_job);
if (transRow != null) {
String jobName = transRow.getString(KettleDatabaseRepository.FIELD_JOB_NAME, "<name not found>");
long id_directory = transRow.getInteger(KettleDatabaseRepository.FIELD_JOB_ID_DIRECTORY, -1L);
RepositoryDirectoryInterface dir = repository.loadRepositoryDirectoryTree().findDirectory(new LongObjectId(id_directory));
jobsList[i] = dir.getPathObjectCombination(jobName);
}
}
}
return jobsList;
}
use of org.pentaho.di.repository.LongObjectId in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryJobDelegate method getJobsWithIDList.
public String[] getJobsWithIDList(List<Object[]> list, RowMetaInterface rowMeta) throws KettleException {
String[] jobList = new String[list.size()];
for (int i = 0; i < list.size(); i++) {
long id_job = rowMeta.getInteger(list.get(i), quote(KettleDatabaseRepository.FIELD_JOB_ID_JOB), -1L);
if (id_job > 0) {
RowMetaAndData jobRow = getJob(new LongObjectId(id_job));
if (jobRow != null) {
String jobName = jobRow.getString(KettleDatabaseRepository.FIELD_JOB_NAME, "<name not found>");
long id_directory = jobRow.getInteger(KettleDatabaseRepository.FIELD_JOB_ID_DIRECTORY, -1L);
RepositoryDirectoryInterface dir = // always
repository.loadRepositoryDirectoryTree().findDirectory(new LongObjectId(id_directory));
// reload the
// directory
// tree!
jobList[i] = dir.getPathObjectCombination(jobName);
}
}
}
return jobList;
}
use of org.pentaho.di.repository.LongObjectId in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryJobEntryDelegate method loadJobEntryCopy.
/**
* Load the chef graphical entry from repository We load type, name & description if no entry can be found.
*
* @param log
* the logging channel
* @param rep
* the Repository
* @param jobId
* The job ID
* @param jobEntryCopyId
* The jobentry copy ID
* @param jobentries
* A list with all jobentries
* @param databases
* A list with all defined databases
*/
public JobEntryCopy loadJobEntryCopy(ObjectId jobId, ObjectId jobEntryCopyId, List<JobEntryInterface> jobentries, List<DatabaseMeta> databases, List<SlaveServer> slaveServers, String jobname) throws KettleException {
JobEntryCopy jobEntryCopy = new JobEntryCopy();
try {
jobEntryCopy.setObjectId(jobEntryCopyId);
// Handle GUI information: nr, location, ...
RowMetaAndData r = getJobEntryCopy(jobEntryCopyId);
if (r != null) {
// These are the jobentry_copy fields...
//
ObjectId jobEntryId = new LongObjectId(r.getInteger(KettleDatabaseRepository.FIELD_JOBENTRY_COPY_ID_JOBENTRY, 0));
ObjectId jobEntryTypeId = new LongObjectId(r.getInteger(KettleDatabaseRepository.FIELD_JOBENTRY_COPY_ID_JOBENTRY_TYPE, 0));
jobEntryCopy.setNr((int) r.getInteger(KettleDatabaseRepository.FIELD_JOBENTRY_COPY_NR, 0));
int locx = (int) r.getInteger(KettleDatabaseRepository.FIELD_JOBENTRY_COPY_GUI_LOCATION_X, 0);
int locy = (int) r.getInteger(KettleDatabaseRepository.FIELD_JOBENTRY_COPY_GUI_LOCATION_Y, 0);
boolean isdrawn = r.getBoolean(KettleDatabaseRepository.FIELD_JOBENTRY_COPY_GUI_DRAW, false);
boolean isparallel = r.getBoolean(KettleDatabaseRepository.FIELD_JOBENTRY_COPY_PARALLEL, false);
// Do we have the jobentry already?
//
jobEntryCopy.setEntry(JobMeta.findJobEntry(jobentries, jobEntryId));
if (jobEntryCopy.getEntry() == null) {
// What type of jobentry do we load now?
// Get the jobentry type code
//
RowMetaAndData rt = getJobEntryType(new LongObjectId(jobEntryTypeId));
if (rt != null) {
String jet_code = rt.getString(KettleDatabaseRepository.FIELD_JOBENTRY_TYPE_CODE, null);
JobEntryInterface jobEntry = null;
PluginRegistry registry = PluginRegistry.getInstance();
PluginInterface jobPlugin = registry.findPluginWithId(JobEntryPluginType.class, jet_code);
if (jobPlugin == null) {
jobEntry = new MissingEntry(jobname, jet_code);
} else {
jobEntry = (JobEntryInterface) registry.loadClass(jobPlugin);
}
if (jobEntry != null) {
jobEntryCopy.setEntry(jobEntry);
//
if (jobEntry instanceof JobEntryBase) {
loadJobEntryBase((JobEntryBase) jobEntry, jobEntryId, databases, slaveServers);
((JobEntryBase) jobEntry).setAttributesMap(loadJobEntryAttributesMap(jobId, jobEntryId));
}
compatibleJobEntryLoadRep(jobEntry, repository, jobEntryTypeId, databases, slaveServers);
jobEntry.loadRep(repository, repository.metaStore, jobEntryId, databases, slaveServers);
jobEntryCopy.getEntry().setObjectId(jobEntryId);
jobentries.add(jobEntryCopy.getEntry());
} else {
throw new KettleException("JobEntryLoader was unable to find Job Entry Plugin with description [" + jet_code + "].");
}
} else {
throw new KettleException("Unable to find Job Entry Type with id=" + jobEntryTypeId + " in the repository");
}
}
jobEntryCopy.setLocation(locx, locy);
jobEntryCopy.setDrawn(isdrawn);
jobEntryCopy.setLaunchingInParallel(isparallel);
return jobEntryCopy;
} else {
throw new KettleException("Unable to find job entry copy in repository with id_jobentry_copy=" + jobEntryCopyId);
}
} catch (KettleDatabaseException dbe) {
throw new KettleException("Unable to load job entry copy from repository with id_jobentry_copy=" + jobEntryCopyId, dbe);
}
}
use of org.pentaho.di.repository.LongObjectId in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryMetaStoreDelegate method parseElement.
public KDBRMetaStoreElement parseElement(IMetaStoreElementType elementType, RowMetaAndData elementRow) throws KettleException {
Long elementId = elementRow.getInteger(KettleDatabaseRepository.FIELD_ELEMENT_ID_ELEMENT);
String name = elementRow.getString(KettleDatabaseRepository.FIELD_ELEMENT_NAME, null);
KDBRMetaStoreElement element = new KDBRMetaStoreElement(this, elementType, Long.toString(elementId), null);
element.setName(name);
// Now load the attributes...
//
addAttributes(element, new LongObjectId(elementId), new LongObjectId(0));
return element;
}
Aggregations