Search in sources :

Example 51 with RowMetaAndData

use of org.pentaho.di.core.RowMetaAndData in project pentaho-kettle by pentaho.

the class KettleDatabaseRepositoryConnectionDelegate method getTransAttributeBoolean.

public synchronized boolean getTransAttributeBoolean(ObjectId id_transformation, int nr, String code) throws KettleException {
    RowMetaAndData r = null;
    r = getTransAttributeRow(id_transformation, nr, code);
    if (r == null) {
        return false;
    }
    return r.getBoolean(KettleDatabaseRepository.FIELD_TRANS_ATTRIBUTE_VALUE_STR, false);
}
Also used : RowMetaAndData(org.pentaho.di.core.RowMetaAndData)

Example 52 with RowMetaAndData

use of org.pentaho.di.core.RowMetaAndData in project pentaho-kettle by pentaho.

the class KettleDatabaseRepositoryConnectionDelegate method getTransAttributeNumber.

public synchronized double getTransAttributeNumber(ObjectId id_transformation, int nr, String code) throws KettleException {
    RowMetaAndData r = null;
    r = getTransAttributeRow(id_transformation, nr, code);
    if (r == null) {
        return 0.0;
    }
    return r.getNumber(KettleDatabaseRepository.FIELD_TRANS_ATTRIBUTE_VALUE_NUM, 0.0);
}
Also used : RowMetaAndData(org.pentaho.di.core.RowMetaAndData)

Example 53 with RowMetaAndData

use of org.pentaho.di.core.RowMetaAndData in project pentaho-kettle by pentaho.

the class KettleDatabaseRepositoryConnectionDelegate method insertJobEntryAttribute.

public synchronized ObjectId insertJobEntryAttribute(ObjectId id_job, ObjectId id_jobentry, long nr, String code, double value_num, String value_str) throws KettleException {
    ObjectId id = getNextJobEntryAttributeID();
    RowMetaAndData table = new RowMetaAndData();
    // CHECKSTYLE:LineLength:OFF
    table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_JOBENTRY_ATTRIBUTE_ID_JOBENTRY_ATTRIBUTE), id);
    table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_JOBENTRY_ATTRIBUTE_ID_JOB), id_job);
    table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_JOBENTRY_ATTRIBUTE_ID_JOBENTRY), id_jobentry);
    table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_JOBENTRY_ATTRIBUTE_NR), new Long(nr));
    table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_JOBENTRY_ATTRIBUTE_CODE), code);
    table.addValue(new ValueMetaNumber(KettleDatabaseRepository.FIELD_JOBENTRY_ATTRIBUTE_VALUE_NUM), new Double(value_num));
    table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_JOBENTRY_ATTRIBUTE_VALUE_STR), value_str);
    database.prepareInsert(table.getRowMeta(), KettleDatabaseRepository.TABLE_R_JOBENTRY_ATTRIBUTE);
    database.setValuesInsert(table);
    database.insertRow();
    database.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) ValueMetaNumber(org.pentaho.di.core.row.value.ValueMetaNumber) ValueMetaInteger(org.pentaho.di.core.row.value.ValueMetaInteger)

Example 54 with RowMetaAndData

use of org.pentaho.di.core.RowMetaAndData in project pentaho-kettle by pentaho.

the class KettleDatabaseRepositoryConnectionDelegate method getNextTableID.

private synchronized LongObjectId getNextTableID(String tablename, String idfield) throws KettleException {
    LongObjectId retval = null;
    RowMetaAndData r = callRead(() -> database.getOneRow("SELECT MAX(" + idfield + ") FROM " + tablename));
    if (r != null) {
        Long id = r.getInteger(0);
        if (id == null) {
            if (log.isDebug()) {
                log.logDebug("no max(" + idfield + ") found in table " + tablename);
            }
            retval = new LongObjectId(1);
        } else {
            if (log.isDebug()) {
                log.logDebug("max(" + idfield + ") found in table " + tablename + " --> " + idfield + " number: " + id);
            }
            retval = new LongObjectId(id.longValue() + 1L);
        }
    }
    return retval;
}
Also used : RowMetaAndData(org.pentaho.di.core.RowMetaAndData) LongObjectId(org.pentaho.di.repository.LongObjectId)

Example 55 with RowMetaAndData

use of org.pentaho.di.core.RowMetaAndData in project pentaho-kettle by pentaho.

the class KettleDatabaseRepositoryConnectionDelegate method getJobAttributeInteger.

public synchronized long getJobAttributeInteger(ObjectId id_job, int nr, String code) throws KettleException {
    RowMetaAndData r = null;
    r = getJobAttributeRow(id_job, nr, code);
    if (r == null) {
        return 0L;
    }
    return r.getInteger(KettleDatabaseRepository.FIELD_JOB_ATTRIBUTE_VALUE_NUM, 0L);
}
Also used : RowMetaAndData(org.pentaho.di.core.RowMetaAndData)

Aggregations

RowMetaAndData (org.pentaho.di.core.RowMetaAndData)563 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)225 ArrayList (java.util.ArrayList)172 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)145 TransMeta (org.pentaho.di.trans.TransMeta)116 Test (org.junit.Test)108 ValueMetaInteger (org.pentaho.di.core.row.value.ValueMetaInteger)94 KettleException (org.pentaho.di.core.exception.KettleException)89 StepMeta (org.pentaho.di.trans.step.StepMeta)80 LongObjectId (org.pentaho.di.repository.LongObjectId)75 StepInterface (org.pentaho.di.trans.step.StepInterface)75 RowStepCollector (org.pentaho.di.trans.RowStepCollector)73 Trans (org.pentaho.di.trans.Trans)73 PluginRegistry (org.pentaho.di.core.plugins.PluginRegistry)71 TransHopMeta (org.pentaho.di.trans.TransHopMeta)71 KettleValueException (org.pentaho.di.core.exception.KettleValueException)58 RowProducer (org.pentaho.di.trans.RowProducer)56 DummyTransMeta (org.pentaho.di.trans.steps.dummytrans.DummyTransMeta)54 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)53 RowMeta (org.pentaho.di.core.row.RowMeta)51