use of org.pentaho.di.core.row.value.ValueMetaString in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryDirectoryDelegate method insertDirectory.
/*
* public synchronized RepositoryDirectory refreshRepositoryDirectoryTree() throws KettleException { try {
* RepositoryDirectory tree = new RepositoryDirectory(); loadRepositoryDirectory(tree, tree.getID());
* repository.setDirectoryTree(tree); return tree; } catch (KettleException e) { repository.setDirectoryTree( new
* RepositoryDirectory() ); throw new KettleException("Unable to read the directory tree from the repository!", e); }
* }
*/
private synchronized ObjectId insertDirectory(ObjectId id_directory_parent, RepositoryDirectoryInterface dir) throws KettleException {
ObjectId id = repository.connectionDelegate.getNextDirectoryID();
String tablename = KettleDatabaseRepository.TABLE_R_DIRECTORY;
RowMetaAndData table = new RowMetaAndData();
table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_DIRECTORY_ID_DIRECTORY), id);
table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_DIRECTORY_ID_DIRECTORY_PARENT), id_directory_parent);
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_DIRECTORY_DIRECTORY_NAME), dir.getName());
repository.connectionDelegate.getDatabase().prepareInsert(table.getRowMeta(), tablename);
repository.connectionDelegate.getDatabase().setValuesInsert(table);
repository.connectionDelegate.getDatabase().insertRow();
repository.connectionDelegate.getDatabase().closeInsert();
return id;
}
use of org.pentaho.di.core.row.value.ValueMetaString in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryJobDelegate method renameJob.
public synchronized void renameJob(ObjectId id_job, RepositoryDirectoryInterface newParentDir, String newname) throws KettleException {
if (newParentDir != null || newname != null) {
RowMetaAndData table = new RowMetaAndData();
String sql = "UPDATE " + quoteTable(KettleDatabaseRepository.TABLE_R_JOB) + " SET ";
boolean additionalParameter = false;
if (newname != null) {
additionalParameter = true;
sql += quote(KettleDatabaseRepository.FIELD_JOB_NAME) + " = ? ";
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_JOB_NAME), newname);
}
if (newParentDir != null) {
if (additionalParameter) {
sql += ", ";
}
sql += quote(KettleDatabaseRepository.FIELD_JOB_ID_DIRECTORY) + " = ? ";
table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_JOB_ID_DIRECTORY), newParentDir.getObjectId());
}
sql += "WHERE " + quote(KettleDatabaseRepository.FIELD_JOB_ID_JOB) + " = ?";
table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_JOB_ID_JOB), id_job);
log.logBasic("sql = [" + sql + "]");
log.logBasic("row = [" + table + "]");
repository.connectionDelegate.getDatabase().execStatement(sql, table.getRowMeta(), table.getData());
}
}
use of org.pentaho.di.core.row.value.ValueMetaString in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryJobDelegate method moveJob.
public synchronized void moveJob(String jobname, ObjectId id_directory_from, ObjectId id_directory_to) throws KettleException {
String sql = "UPDATE " + quoteTable(KettleDatabaseRepository.TABLE_R_JOB) + " SET " + quote(KettleDatabaseRepository.FIELD_JOB_ID_DIRECTORY) + " = ? WHERE " + quote(KettleDatabaseRepository.FIELD_JOB_NAME) + " = ? AND " + quote(KettleDatabaseRepository.FIELD_JOB_ID_DIRECTORY) + " = ?";
RowMetaAndData par = new RowMetaAndData();
par.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_JOB_ID_DIRECTORY), id_directory_to);
par.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_JOB_NAME), jobname);
par.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_JOB_ID_DIRECTORY), id_directory_from);
repository.connectionDelegate.getDatabase().execStatement(sql, par.getRowMeta(), par.getData());
}
use of org.pentaho.di.core.row.value.ValueMetaString in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryJobDelegate method insertJob.
private synchronized void insertJob(JobMeta jobMeta) throws KettleException {
RowMetaAndData table = new RowMetaAndData();
table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_JOB_ID_JOB), jobMeta.getObjectId());
table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_JOB_ID_DIRECTORY), jobMeta.getRepositoryDirectory().getObjectId());
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_JOB_NAME), jobMeta.getName());
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_JOB_DESCRIPTION), jobMeta.getDescription());
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_JOB_EXTENDED_DESCRIPTION), jobMeta.getExtendedDescription());
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_JOB_JOB_VERSION), jobMeta.getJobversion());
table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_JOB_JOB_STATUS), new Long(jobMeta.getJobstatus() < 0 ? -1L : jobMeta.getJobstatus()));
table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_JOB_ID_DATABASE_LOG), jobMeta.getJobLogTable().getDatabaseMeta() != null ? jobMeta.getJobLogTable().getDatabaseMeta().getObjectId() : -1L);
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_JOB_TABLE_NAME_LOG), jobMeta.getJobLogTable().getTableName());
table.addValue(new ValueMetaBoolean(KettleDatabaseRepository.FIELD_JOB_USE_BATCH_ID), jobMeta.getJobLogTable().isBatchIdUsed());
table.addValue(new ValueMetaBoolean(KettleDatabaseRepository.FIELD_JOB_USE_LOGFIELD), jobMeta.getJobLogTable().isLogFieldUsed());
repository.connectionDelegate.insertJobAttribute(jobMeta.getObjectId(), 0, KettleDatabaseRepository.JOB_ATTRIBUTE_LOG_SIZE_LIMIT, 0, jobMeta.getJobLogTable().getLogSizeLimit());
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_JOB_CREATED_USER), jobMeta.getCreatedUser());
table.addValue(new ValueMetaDate(KettleDatabaseRepository.FIELD_JOB_CREATED_DATE), jobMeta.getCreatedDate());
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_JOB_MODIFIED_USER), jobMeta.getModifiedUser());
table.addValue(new ValueMetaDate(KettleDatabaseRepository.FIELD_JOB_MODIFIED_DATE), jobMeta.getModifiedDate());
table.addValue(new ValueMetaBoolean(KettleDatabaseRepository.FIELD_JOB_PASS_BATCH_ID), jobMeta.isBatchIdPassed());
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_JOB_SHARED_FILE), jobMeta.getSharedObjectsFile());
repository.connectionDelegate.getDatabase().prepareInsert(table.getRowMeta(), KettleDatabaseRepository.TABLE_R_JOB);
repository.connectionDelegate.getDatabase().setValuesInsert(table);
repository.connectionDelegate.getDatabase().insertRow();
if (log.isDebug()) {
log.logDebug("Inserted new record into table " + quoteTable(KettleDatabaseRepository.TABLE_R_JOB) + " with data : " + table);
}
repository.connectionDelegate.getDatabase().closeInsert();
// Save the logging connection link...
if (jobMeta.getJobLogTable().getDatabaseMeta() != null) {
repository.insertJobEntryDatabase(jobMeta.getObjectId(), null, jobMeta.getJobLogTable().getDatabaseMeta().getObjectId());
}
// Save the logging tables too..
//
RepositoryAttributeInterface attributeInterface = new KettleDatabaseRepositoryJobAttribute(repository.connectionDelegate, jobMeta.getObjectId());
for (LogTableInterface logTable : jobMeta.getLogTables()) {
logTable.saveToRepository(attributeInterface);
}
}
use of org.pentaho.di.core.row.value.ValueMetaString in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryMetaStoreDelegate method updateElementType.
public ObjectId updateElementType(ObjectId namespaceId, ObjectId elementTypeId, IMetaStoreElementType type) throws KettleException {
RowMetaAndData table = new RowMetaAndData();
table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_ELEMENT_TYPE_ID_ELEMENT_TYPE), elementTypeId);
table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_ELEMENT_TYPE_ID_NAMESPACE), namespaceId);
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_ELEMENT_TYPE_NAME), type.getName());
table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_ELEMENT_TYPE_DESCRIPTION), type.getDescription());
repository.connectionDelegate.updateTableRow(KettleDatabaseRepository.TABLE_R_ELEMENT_TYPE, KettleDatabaseRepository.FIELD_ELEMENT_TYPE_ID_ELEMENT_TYPE, table);
if (log.isDebug()) {
log.logDebug("Updated element type [" + type.getName() + "]");
}
return elementTypeId;
}
Aggregations