use of org.pentaho.di.repository.RepositoryObject in project pentaho-kettle by pentaho.
the class KettleDatabaseRepository_GetObjectInformation_Test method assertIsDeletedNotSet_ForExistingObject.
private void assertIsDeletedNotSet_ForExistingObject(KettleDatabaseRepositoryTransDelegate transDelegate, KettleDatabaseRepositoryJobDelegate jobDelegate, RepositoryObjectType objectType) throws Exception {
repository.transDelegate = transDelegate;
repository.jobDelegate = jobDelegate;
when(directoryInterface.findDirectory(any(ObjectId.class))).thenReturn(null);
RepositoryObject object = repository.getObjectInformation(new StringObjectId(EXISTING_ID), objectType);
assertFalse(object.isDeleted());
}
use of org.pentaho.di.repository.RepositoryObject in project pentaho-kettle by pentaho.
the class JobEntryTrans method getXML.
@Override
public String getXML() {
StringBuilder retval = new StringBuilder(300);
retval.append(super.getXML());
// specificationMethod
//
retval.append(" ").append(XMLHandler.addTagValue("specification_method", specificationMethod == null ? null : specificationMethod.getCode()));
retval.append(" ").append(XMLHandler.addTagValue("trans_object_id", transObjectId == null ? null : transObjectId.toString()));
//
if (rep != null && transObjectId != null) {
try {
RepositoryObject objectInformation = rep.getObjectInformation(transObjectId, RepositoryObjectType.TRANSFORMATION);
if (objectInformation != null) {
transname = objectInformation.getName();
directory = objectInformation.getRepositoryDirectory().getPath();
}
} catch (KettleException e) {
// Ignore object reference problems. It simply means that the reference is no longer valid.
}
}
retval.append(" ").append(XMLHandler.addTagValue("filename", filename));
retval.append(" ").append(XMLHandler.addTagValue("transname", transname));
if (parentJobMeta != null) {
parentJobMeta.getNamedClusterEmbedManager().registerUrl(filename);
}
if (directory != null) {
retval.append(" ").append(XMLHandler.addTagValue("directory", directory));
} else if (directoryPath != null) {
// don't loose this info (backup/recovery)
//
retval.append(" ").append(XMLHandler.addTagValue("directory", directoryPath));
}
retval.append(" ").append(XMLHandler.addTagValue("arg_from_previous", argFromPrevious));
retval.append(" ").append(XMLHandler.addTagValue("params_from_previous", paramsFromPrevious));
retval.append(" ").append(XMLHandler.addTagValue("exec_per_row", execPerRow));
retval.append(" ").append(XMLHandler.addTagValue("clear_rows", clearResultRows));
retval.append(" ").append(XMLHandler.addTagValue("clear_files", clearResultFiles));
retval.append(" ").append(XMLHandler.addTagValue("set_logfile", setLogfile));
retval.append(" ").append(XMLHandler.addTagValue("logfile", logfile));
retval.append(" ").append(XMLHandler.addTagValue("logext", logext));
retval.append(" ").append(XMLHandler.addTagValue("add_date", addDate));
retval.append(" ").append(XMLHandler.addTagValue("add_time", addTime));
retval.append(" ").append(XMLHandler.addTagValue("loglevel", logFileLevel != null ? logFileLevel.getCode() : null));
retval.append(" ").append(XMLHandler.addTagValue("cluster", clustering));
retval.append(" ").append(XMLHandler.addTagValue("slave_server_name", remoteSlaveServerName));
retval.append(" ").append(XMLHandler.addTagValue("set_append_logfile", setAppendLogfile));
retval.append(" ").append(XMLHandler.addTagValue("wait_until_finished", waitingToFinish));
retval.append(" ").append(XMLHandler.addTagValue("follow_abort_remote", followingAbortRemotely));
retval.append(" ").append(XMLHandler.addTagValue("create_parent_folder", createParentFolder));
retval.append(" ").append(XMLHandler.addTagValue("logging_remote_work", loggingRemoteWork));
retval.append(" ").append(XMLHandler.addTagValue("run_configuration", runConfiguration));
retval.append(" ").append(XMLHandler.addTagValue("suppress_result_data", isSuppressResultData()));
if (arguments != null) {
for (int i = 0; i < arguments.length; i++) {
// This is a very very bad way of making an XML file, don't use it (or
// copy it). Sven Boden
retval.append(" ").append(XMLHandler.addTagValue("argument" + i, arguments[i]));
}
}
if (parameters != null) {
retval.append(" ").append(XMLHandler.openTag("parameters")).append(Const.CR);
retval.append(" ").append(XMLHandler.addTagValue("pass_all_parameters", passingAllParameters));
for (int i = 0; i < parameters.length; i++) {
// This is a better way of making the XML file than the arguments.
retval.append(" ").append(XMLHandler.openTag("parameter")).append(Const.CR);
retval.append(" ").append(XMLHandler.addTagValue("name", parameters[i]));
retval.append(" ").append(XMLHandler.addTagValue("stream_name", parameterFieldNames[i]));
retval.append(" ").append(XMLHandler.addTagValue("value", parameterValues[i]));
retval.append(" ").append(XMLHandler.closeTag("parameter")).append(Const.CR);
}
retval.append(" ").append(XMLHandler.closeTag("parameters")).append(Const.CR);
}
return retval.toString();
}
use of org.pentaho.di.repository.RepositoryObject in project pentaho-kettle by pentaho.
the class JobExecutorMeta method getXML.
@Override
public String getXML() {
StringBuilder retval = new StringBuilder(300);
retval.append(" ").append(XMLHandler.addTagValue("specification_method", specificationMethod == null ? null : specificationMethod.getCode()));
retval.append(" ").append(XMLHandler.addTagValue("job_object_id", jobObjectId == null ? null : jobObjectId.toString()));
//
if (repository != null && jobObjectId != null) {
try {
RepositoryObject objectInformation = repository.getObjectInformation(jobObjectId, RepositoryObjectType.TRANSFORMATION);
if (objectInformation != null) {
jobName = objectInformation.getName();
directoryPath = objectInformation.getRepositoryDirectory().getPath();
}
} catch (KettleException e) {
// Ignore object reference problems. It simply means that the reference is no longer valid.
}
}
retval.append(" ").append(XMLHandler.addTagValue("job_name", jobName));
retval.append(" ").append(XMLHandler.addTagValue("filename", fileName));
retval.append(" ").append(XMLHandler.addTagValue("directory_path", directoryPath));
retval.append(" ").append(XMLHandler.addTagValue("group_size", groupSize));
retval.append(" ").append(XMLHandler.addTagValue("group_field", groupField));
retval.append(" ").append(XMLHandler.addTagValue("group_time", groupTime));
// Add the mapping parameters too
//
retval.append(parameters.getXML());
// The output side...
//
retval.append(" ").append(XMLHandler.addTagValue("execution_result_target_step", executionResultTargetStepMeta == null ? null : executionResultTargetStepMeta.getName()));
retval.append(" ").append(XMLHandler.addTagValue("execution_time_field", executionTimeField));
retval.append(" ").append(XMLHandler.addTagValue("execution_result_field", executionResultField));
retval.append(" ").append(XMLHandler.addTagValue("execution_errors_field", executionNrErrorsField));
retval.append(" ").append(XMLHandler.addTagValue("execution_lines_read_field", executionLinesReadField));
retval.append(" ").append(XMLHandler.addTagValue("execution_lines_written_field", executionLinesWrittenField));
retval.append(" ").append(XMLHandler.addTagValue("execution_lines_input_field", executionLinesInputField));
retval.append(" ").append(XMLHandler.addTagValue("execution_lines_output_field", executionLinesOutputField));
retval.append(" ").append(XMLHandler.addTagValue("execution_lines_rejected_field", executionLinesRejectedField));
retval.append(" ").append(XMLHandler.addTagValue("execution_lines_updated_field", executionLinesUpdatedField));
retval.append(" ").append(XMLHandler.addTagValue("execution_lines_deleted_field", executionLinesDeletedField));
retval.append(" ").append(XMLHandler.addTagValue("execution_files_retrieved_field", executionFilesRetrievedField));
retval.append(" ").append(XMLHandler.addTagValue("execution_exit_status_field", executionExitStatusField));
retval.append(" ").append(XMLHandler.addTagValue("execution_log_text_field", executionLogTextField));
retval.append(" ").append(XMLHandler.addTagValue("execution_log_channelid_field", executionLogChannelIdField));
retval.append(" ").append(XMLHandler.addTagValue("result_rows_target_step", resultRowsTargetStepMeta == null ? null : resultRowsTargetStepMeta.getName()));
for (int i = 0; i < resultRowsField.length; i++) {
retval.append(" ").append(XMLHandler.openTag("result_rows_field")).append(Const.CR);
retval.append(" ").append(XMLHandler.addTagValue("name", resultRowsField[i]));
retval.append(" ").append(XMLHandler.addTagValue("type", ValueMetaFactory.getValueMetaName(resultRowsType[i])));
retval.append(" ").append(XMLHandler.addTagValue("length", resultRowsLength[i]));
retval.append(" ").append(XMLHandler.addTagValue("precision", resultRowsPrecision[i]));
retval.append(" ").append(XMLHandler.closeTag("result_rows_field")).append(Const.CR);
}
retval.append(" ").append(XMLHandler.addTagValue("result_files_target_step", resultFilesTargetStepMeta == null ? null : resultFilesTargetStepMeta.getName()));
retval.append(" ").append(XMLHandler.addTagValue("result_files_file_name_field", resultFilesFileNameField));
return retval.toString();
}
Aggregations