Search in sources :

Example 26 with ValueMetaInteger

use of org.pentaho.di.core.row.value.ValueMetaInteger in project pentaho-kettle by pentaho.

the class KettleDatabaseRepositoryClusterSchemaDelegate method updateCluster.

public synchronized void updateCluster(ClusterSchema clusterSchema) throws KettleException {
    RowMetaAndData table = new RowMetaAndData();
    table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_CLUSTER_ID_CLUSTER), clusterSchema.getObjectId());
    table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_CLUSTER_NAME), clusterSchema.getName());
    table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_CLUSTER_BASE_PORT), clusterSchema.getBasePort());
    table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_CLUSTER_SOCKETS_BUFFER_SIZE), clusterSchema.getSocketsBufferSize());
    table.addValue(new ValueMetaString(KettleDatabaseRepository.FIELD_CLUSTER_SOCKETS_FLUSH_INTERVAL), clusterSchema.getSocketsFlushInterval());
    table.addValue(new ValueMetaBoolean(KettleDatabaseRepository.FIELD_CLUSTER_SOCKETS_COMPRESSED), Boolean.valueOf(clusterSchema.isSocketsCompressed()));
    table.addValue(new ValueMetaBoolean(KettleDatabaseRepository.FIELD_CLUSTER_DYNAMIC), Boolean.valueOf(clusterSchema.isDynamic()));
    repository.connectionDelegate.updateTableRow(KettleDatabaseRepository.TABLE_R_CLUSTER, KettleDatabaseRepository.FIELD_CLUSTER_ID_CLUSTER, table, clusterSchema.getObjectId());
}
Also used : ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) RowMetaAndData(org.pentaho.di.core.RowMetaAndData) ValueMetaInteger(org.pentaho.di.core.row.value.ValueMetaInteger) ValueMetaBoolean(org.pentaho.di.core.row.value.ValueMetaBoolean)

Example 27 with ValueMetaInteger

use of org.pentaho.di.core.row.value.ValueMetaInteger in project pentaho-kettle by pentaho.

the class KettleDatabaseRepository method insertJobNote.

public synchronized void insertJobNote(ObjectId id_job, ObjectId id_note) throws KettleException {
    RowMetaAndData table = new RowMetaAndData();
    table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_JOB_NOTE_ID_JOB), id_job);
    table.addValue(new ValueMetaInteger(KettleDatabaseRepository.FIELD_JOB_NOTE_ID_NOTE), id_note);
    connectionDelegate.insertTableRow(KettleDatabaseRepository.TABLE_R_JOB_NOTE, table);
}
Also used : RowMetaAndData(org.pentaho.di.core.RowMetaAndData) ValueMetaInteger(org.pentaho.di.core.row.value.ValueMetaInteger)

Example 28 with ValueMetaInteger

use of org.pentaho.di.core.row.value.ValueMetaInteger in project pentaho-kettle by pentaho.

the class TextFileInputMeta method getFields.

@Override
public void getFields(RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore) throws KettleStepException {
    if (!inputFiles.passingThruFields) {
        // all incoming fields are not transmitted !
        row.clear();
    } else {
        if (info != null) {
            boolean found = false;
            for (int i = 0; i < info.length && !found; i++) {
                if (info[i] != null) {
                    row.mergeRowMeta(info[i], name);
                    found = true;
                }
            }
        }
    }
    for (int i = 0; i < inputFields.length; i++) {
        BaseFileField field = inputFields[i];
        int type = field.getType();
        if (type == ValueMetaInterface.TYPE_NONE) {
            type = ValueMetaInterface.TYPE_STRING;
        }
        try {
            ValueMetaInterface v = ValueMetaFactory.createValueMeta(field.getName(), type);
            v.setLength(field.getLength());
            v.setPrecision(field.getPrecision());
            v.setOrigin(name);
            v.setConversionMask(field.getFormat());
            v.setDecimalSymbol(field.getDecimalSymbol());
            v.setGroupingSymbol(field.getGroupSymbol());
            v.setCurrencySymbol(field.getCurrencySymbol());
            v.setDateFormatLenient(content.dateFormatLenient);
            v.setDateFormatLocale(content.dateFormatLocale);
            v.setTrimType(field.getTrimType());
            row.addValueMeta(v);
        } catch (Exception e) {
            throw new KettleStepException(e);
        }
    }
    if (errorHandling.errorIgnored) {
        if (errorCountField != null && errorCountField.length() > 0) {
            ValueMetaInterface v = new ValueMetaInteger(errorCountField);
            v.setLength(ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0);
            v.setOrigin(name);
            row.addValueMeta(v);
        }
        if (errorFieldsField != null && errorFieldsField.length() > 0) {
            ValueMetaInterface v = new ValueMetaString(errorFieldsField);
            v.setOrigin(name);
            row.addValueMeta(v);
        }
        if (errorTextField != null && errorTextField.length() > 0) {
            ValueMetaInterface v = new ValueMetaString(errorTextField);
            v.setOrigin(name);
            row.addValueMeta(v);
        }
    }
    if (content.includeFilename) {
        ValueMetaInterface v = new ValueMetaString(content.filenameField);
        v.setLength(100);
        v.setOrigin(name);
        row.addValueMeta(v);
    }
    if (content.includeRowNumber) {
        ValueMetaInterface v = new ValueMetaInteger(content.rowNumberField);
        v.setLength(ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0);
        v.setOrigin(name);
        row.addValueMeta(v);
    }
    if (StringUtils.isNotBlank(additionalOutputFields.shortFilenameField)) {
        ValueMetaInterface v = new ValueMetaString(space.environmentSubstitute(additionalOutputFields.shortFilenameField));
        v.setLength(100, -1);
        v.setOrigin(name);
        row.addValueMeta(v);
    }
    if (StringUtils.isNotBlank(additionalOutputFields.extensionField)) {
        ValueMetaInterface v = new ValueMetaString(space.environmentSubstitute(additionalOutputFields.extensionField));
        v.setLength(100, -1);
        v.setOrigin(name);
        row.addValueMeta(v);
    }
    if (StringUtils.isNotBlank(additionalOutputFields.pathField)) {
        ValueMetaInterface v = new ValueMetaString(space.environmentSubstitute(additionalOutputFields.pathField));
        v.setLength(100, -1);
        v.setOrigin(name);
        row.addValueMeta(v);
    }
    if (StringUtils.isNotBlank(additionalOutputFields.sizeField)) {
        ValueMetaInterface v = new ValueMetaString(space.environmentSubstitute(additionalOutputFields.sizeField));
        v.setOrigin(name);
        v.setLength(9);
        row.addValueMeta(v);
    }
    if (StringUtils.isNotBlank(additionalOutputFields.hiddenField)) {
        ValueMetaInterface v = new ValueMetaBoolean(space.environmentSubstitute(additionalOutputFields.hiddenField));
        v.setOrigin(name);
        row.addValueMeta(v);
    }
    if (StringUtils.isNotBlank(additionalOutputFields.lastModificationField)) {
        ValueMetaInterface v = new ValueMetaDate(space.environmentSubstitute(additionalOutputFields.lastModificationField));
        v.setOrigin(name);
        row.addValueMeta(v);
    }
    if (StringUtils.isNotBlank(additionalOutputFields.uriField)) {
        ValueMetaInterface v = new ValueMetaString(space.environmentSubstitute(additionalOutputFields.uriField));
        v.setLength(100, -1);
        v.setOrigin(name);
        row.addValueMeta(v);
    }
    if (StringUtils.isNotBlank(additionalOutputFields.rootUriField)) {
        ValueMetaInterface v = new ValueMetaString(additionalOutputFields.rootUriField);
        v.setLength(100, -1);
        v.setOrigin(name);
        row.addValueMeta(v);
    }
}
Also used : ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) KettleStepException(org.pentaho.di.core.exception.KettleStepException) BaseFileField(org.pentaho.di.trans.steps.file.BaseFileField) ValueMetaInteger(org.pentaho.di.core.row.value.ValueMetaInteger) ValueMetaBoolean(org.pentaho.di.core.row.value.ValueMetaBoolean) ValueMetaDate(org.pentaho.di.core.row.value.ValueMetaDate) KettleXMLException(org.pentaho.di.core.exception.KettleXMLException) KettleFileException(org.pentaho.di.core.exception.KettleFileException) KettleStepException(org.pentaho.di.core.exception.KettleStepException) KettleException(org.pentaho.di.core.exception.KettleException) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface)

Example 29 with ValueMetaInteger

use of org.pentaho.di.core.row.value.ValueMetaInteger in project pentaho-kettle by pentaho.

the class FuzzyMatchMeta method getFields.

public void getFields(RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore) throws KettleStepException {
    // Add match field
    ValueMetaInterface v = new ValueMetaString(space.environmentSubstitute(getOutputMatchField()));
    v.setOrigin(name);
    v.setStorageType(ValueMetaInterface.STORAGE_TYPE_NORMAL);
    inputRowMeta.addValueMeta(v);
    String mainField = space.environmentSubstitute(getOutputValueField());
    if (!Utils.isEmpty(mainField) && isGetCloserValue()) {
        switch(getAlgorithmType()) {
            case FuzzyMatchMeta.OPERATION_TYPE_DAMERAU_LEVENSHTEIN:
            case FuzzyMatchMeta.OPERATION_TYPE_LEVENSHTEIN:
                v = new ValueMetaInteger(mainField);
                v.setLength(ValueMetaInterface.DEFAULT_INTEGER_LENGTH);
                break;
            case FuzzyMatchMeta.OPERATION_TYPE_JARO:
            case FuzzyMatchMeta.OPERATION_TYPE_JARO_WINKLER:
            case FuzzyMatchMeta.OPERATION_TYPE_PAIR_SIMILARITY:
                v = new ValueMetaNumber(mainField);
                break;
            default:
                // Phonetic algorithms
                v = new ValueMetaString(mainField);
                break;
        }
        v.setStorageType(ValueMetaInterface.STORAGE_TYPE_NORMAL);
        v.setOrigin(name);
        inputRowMeta.addValueMeta(v);
    }
    boolean activateAdditionalFields = isGetCloserValue() || (getAlgorithmType() == FuzzyMatchMeta.OPERATION_TYPE_DOUBLE_METAPHONE) || (getAlgorithmType() == FuzzyMatchMeta.OPERATION_TYPE_SOUNDEX) || (getAlgorithmType() == FuzzyMatchMeta.OPERATION_TYPE_REFINED_SOUNDEX) || (getAlgorithmType() == FuzzyMatchMeta.OPERATION_TYPE_METAPHONE);
    if (activateAdditionalFields) {
        if (info != null && info.length == 1 && info[0] != null) {
            for (int i = 0; i < valueName.length; i++) {
                v = info[0].searchValueMeta(value[i]);
                if (v != null) {
                    // Configuration error/missing resources...
                    v.setName(valueName[i]);
                    v.setOrigin(name);
                    // Only normal storage goes into the cache
                    v.setStorageType(ValueMetaInterface.STORAGE_TYPE_NORMAL);
                    inputRowMeta.addValueMeta(v);
                } else {
                    throw new KettleStepException(BaseMessages.getString(PKG, "FuzzyMatchMeta.Exception.ReturnValueCanNotBeFound", value[i]));
                }
            }
        } else {
            for (int i = 0; i < valueName.length; i++) {
                v = new ValueMetaString(valueName[i]);
                v.setOrigin(name);
                inputRowMeta.addValueMeta(v);
            }
        }
    }
}
Also used : ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) KettleStepException(org.pentaho.di.core.exception.KettleStepException) ValueMetaNumber(org.pentaho.di.core.row.value.ValueMetaNumber) ValueMetaInteger(org.pentaho.di.core.row.value.ValueMetaInteger) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface)

Example 30 with ValueMetaInteger

use of org.pentaho.di.core.row.value.ValueMetaInteger in project pentaho-kettle by pentaho.

the class GetSlaveSequenceMeta method getFields.

@Override
public void getFields(RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore) throws KettleStepException {
    ValueMetaInterface v = new ValueMetaInteger(valuename);
    v.setOrigin(name);
    row.addValueMeta(v);
}
Also used : ValueMetaInteger(org.pentaho.di.core.row.value.ValueMetaInteger) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface)

Aggregations

ValueMetaInteger (org.pentaho.di.core.row.value.ValueMetaInteger)314 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)209 RowMeta (org.pentaho.di.core.row.RowMeta)146 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)137 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)113 Test (org.junit.Test)90 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)89 ValueMetaDate (org.pentaho.di.core.row.value.ValueMetaDate)64 ValueMetaBoolean (org.pentaho.di.core.row.value.ValueMetaBoolean)61 ValueMetaNumber (org.pentaho.di.core.row.value.ValueMetaNumber)57 KettleException (org.pentaho.di.core.exception.KettleException)41 LongObjectId (org.pentaho.di.repository.LongObjectId)38 ValueMetaBigNumber (org.pentaho.di.core.row.value.ValueMetaBigNumber)34 ObjectId (org.pentaho.di.repository.ObjectId)33 ArrayList (java.util.ArrayList)32 KettleStepException (org.pentaho.di.core.exception.KettleStepException)26 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)21 ValueMetaTimestamp (org.pentaho.di.core.row.value.ValueMetaTimestamp)20 ValueMetaBinary (org.pentaho.di.core.row.value.ValueMetaBinary)18 SQLException (java.sql.SQLException)17