Search in sources :

Example 21 with ValueMetaString

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;
}
Also used : ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) RowMetaAndData(org.pentaho.di.core.RowMetaAndData) LongObjectId(org.pentaho.di.repository.LongObjectId) ObjectId(org.pentaho.di.repository.ObjectId) ValueMetaInteger(org.pentaho.di.core.row.value.ValueMetaInteger) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString)

Example 22 with ValueMetaString

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());
    }
}
Also used : ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) RowMetaAndData(org.pentaho.di.core.RowMetaAndData) ValueMetaInteger(org.pentaho.di.core.row.value.ValueMetaInteger) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString)

Example 23 with ValueMetaString

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());
}
Also used : ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) RowMetaAndData(org.pentaho.di.core.RowMetaAndData) ValueMetaInteger(org.pentaho.di.core.row.value.ValueMetaInteger) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString)

Example 24 with ValueMetaString

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);
    }
}
Also used : ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) LogTableInterface(org.pentaho.di.core.logging.LogTableInterface) RowMetaAndData(org.pentaho.di.core.RowMetaAndData) ValueMetaInteger(org.pentaho.di.core.row.value.ValueMetaInteger) ValueMetaBoolean(org.pentaho.di.core.row.value.ValueMetaBoolean) ValueMetaDate(org.pentaho.di.core.row.value.ValueMetaDate) RepositoryAttributeInterface(org.pentaho.di.repository.RepositoryAttributeInterface)

Example 25 with ValueMetaString

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;
}
Also used : ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) RowMetaAndData(org.pentaho.di.core.RowMetaAndData) ValueMetaInteger(org.pentaho.di.core.row.value.ValueMetaInteger)

Aggregations

ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)447 RowMeta (org.pentaho.di.core.row.RowMeta)219 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)181 Test (org.junit.Test)179 ValueMetaInteger (org.pentaho.di.core.row.value.ValueMetaInteger)176 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)141 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)86 ValueMetaBoolean (org.pentaho.di.core.row.value.ValueMetaBoolean)67 ValueMetaNumber (org.pentaho.di.core.row.value.ValueMetaNumber)66 ValueMetaDate (org.pentaho.di.core.row.value.ValueMetaDate)57 KettleException (org.pentaho.di.core.exception.KettleException)40 ArrayList (java.util.ArrayList)33 LongObjectId (org.pentaho.di.repository.LongObjectId)29 ValueMetaBigNumber (org.pentaho.di.core.row.value.ValueMetaBigNumber)27 ValueMetaBinary (org.pentaho.di.core.row.value.ValueMetaBinary)26 ObjectId (org.pentaho.di.repository.ObjectId)26 ValueMetaTimestamp (org.pentaho.di.core.row.value.ValueMetaTimestamp)21 RowSet (org.pentaho.di.core.RowSet)18 Date (java.util.Date)17 ValueMetaBase (org.pentaho.di.core.row.value.ValueMetaBase)16