Search in sources :

Example 11 with ValueMetaInteger

use of org.apache.hop.core.row.value.ValueMetaInteger in project hop by apache.

the class SalesforceInputMeta method getFields.

@Override
public void getFields(IRowMeta r, String name, IRowMeta[] info, TransformMeta nextTransform, IVariables variables, IHopMetadataProvider metadataProvider) throws HopTransformException {
    int i;
    for (i = 0; i < inputFields.length; i++) {
        SalesforceInputField field = inputFields[i];
        int type = field.getType();
        if (type == IValueMeta.TYPE_NONE) {
            type = IValueMeta.TYPE_STRING;
        }
        try {
            IValueMeta v = ValueMetaFactory.createValueMeta(variables.resolve(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());
            r.addValueMeta(v);
        } catch (Exception e) {
            throw new HopTransformException(e);
        }
    }
    if (includeTargetURL && !Utils.isEmpty(targetURLField)) {
        IValueMeta v = new ValueMetaString(variables.resolve(targetURLField));
        v.setLength(250);
        v.setPrecision(-1);
        v.setOrigin(name);
        r.addValueMeta(v);
    }
    if (includeModule && !Utils.isEmpty(moduleField)) {
        IValueMeta v = new ValueMetaString(variables.resolve(moduleField));
        v.setLength(250);
        v.setPrecision(-1);
        v.setOrigin(name);
        r.addValueMeta(v);
    }
    if (includeSQL && !Utils.isEmpty(sqlField)) {
        IValueMeta v = new ValueMetaString(variables.resolve(sqlField));
        v.setLength(250);
        v.setPrecision(-1);
        v.setOrigin(name);
        r.addValueMeta(v);
    }
    if (includeTimestamp && !Utils.isEmpty(timestampField)) {
        IValueMeta v = new ValueMetaDate(variables.resolve(timestampField));
        v.setOrigin(name);
        r.addValueMeta(v);
    }
    if (includeRowNumber && !Utils.isEmpty(rowNumberField)) {
        IValueMeta v = new ValueMetaInteger(variables.resolve(rowNumberField));
        v.setLength(IValueMeta.DEFAULT_INTEGER_LENGTH, 0);
        v.setOrigin(name);
        r.addValueMeta(v);
    }
    if (includeDeletionDate && !Utils.isEmpty(deletionDateField)) {
        IValueMeta v = new ValueMetaDate(variables.resolve(deletionDateField));
        v.setOrigin(name);
        r.addValueMeta(v);
    }
}
Also used : IValueMeta(org.apache.hop.core.row.IValueMeta) ValueMetaString(org.apache.hop.core.row.value.ValueMetaString) ValueMetaInteger(org.apache.hop.core.row.value.ValueMetaInteger) HopTransformException(org.apache.hop.core.exception.HopTransformException) ValueMetaDate(org.apache.hop.core.row.value.ValueMetaDate) HopXmlException(org.apache.hop.core.exception.HopXmlException) HopTransformException(org.apache.hop.core.exception.HopTransformException)

Example 12 with ValueMetaInteger

use of org.apache.hop.core.row.value.ValueMetaInteger in project hop by apache.

the class RestMeta method getFields.

@Override
public void getFields(IRowMeta inputRowMeta, String name, IRowMeta[] info, TransformMeta nextTransform, IVariables variables, IHopMetadataProvider metadataProvider) throws HopTransformException {
    if (!Utils.isEmpty(fieldName)) {
        IValueMeta v = new ValueMetaString(variables.resolve(fieldName));
        v.setOrigin(name);
        inputRowMeta.addValueMeta(v);
    }
    if (!Utils.isEmpty(resultCodeFieldName)) {
        IValueMeta v = new ValueMetaInteger(variables.resolve(resultCodeFieldName));
        v.setOrigin(name);
        inputRowMeta.addValueMeta(v);
    }
    if (!Utils.isEmpty(responseTimeFieldName)) {
        IValueMeta v = new ValueMetaInteger(variables.resolve(responseTimeFieldName));
        v.setOrigin(name);
        inputRowMeta.addValueMeta(v);
    }
    String headerFieldName = variables.resolve(responseHeaderFieldName);
    if (!Utils.isEmpty(headerFieldName)) {
        IValueMeta v = new ValueMetaString(headerFieldName);
        v.setOrigin(name);
        inputRowMeta.addValueMeta(v);
    }
}
Also used : IValueMeta(org.apache.hop.core.row.IValueMeta) ValueMetaString(org.apache.hop.core.row.value.ValueMetaString) ValueMetaInteger(org.apache.hop.core.row.value.ValueMetaInteger) ValueMetaString(org.apache.hop.core.row.value.ValueMetaString)

Example 13 with ValueMetaInteger

use of org.apache.hop.core.row.value.ValueMetaInteger in project hop by apache.

the class ExecProcessMeta method getFields.

@Override
public void getFields(IRowMeta inputRowMeta, String name, IRowMeta[] info, TransformMeta nextTransform, IVariables variables, IHopMetadataProvider metadataProvider) throws HopTransformException {
    // Output fields (String)
    String realOutputFieldname = variables.resolve(resultfieldname);
    if (!Utils.isEmpty(realOutputFieldname)) {
        IValueMeta v = new ValueMetaString(realOutputFieldname);
        v.setLength(100, -1);
        v.setOrigin(name);
        inputRowMeta.addValueMeta(v);
    }
    String realerrofieldname = variables.resolve(errorfieldname);
    if (!Utils.isEmpty(realerrofieldname)) {
        IValueMeta v = new ValueMetaString(realerrofieldname);
        v.setLength(100, -1);
        v.setOrigin(name);
        inputRowMeta.addValueMeta(v);
    }
    String realexitvaluefieldname = variables.resolve(exitvaluefieldname);
    if (!Utils.isEmpty(realexitvaluefieldname)) {
        IValueMeta v = new ValueMetaInteger(realexitvaluefieldname);
        v.setLength(IValueMeta.DEFAULT_INTEGER_LENGTH, 0);
        v.setOrigin(name);
        inputRowMeta.addValueMeta(v);
    }
}
Also used : IValueMeta(org.apache.hop.core.row.IValueMeta) ValueMetaString(org.apache.hop.core.row.value.ValueMetaString) ValueMetaInteger(org.apache.hop.core.row.value.ValueMetaInteger) ValueMetaString(org.apache.hop.core.row.value.ValueMetaString)

Example 14 with ValueMetaInteger

use of org.apache.hop.core.row.value.ValueMetaInteger in project hop by apache.

the class FieldsChangeSequenceMeta method getFields.

@Override
public void getFields(IRowMeta r, String name, IRowMeta[] info, TransformMeta nextTransform, IVariables variables, IHopMetadataProvider metadataProvider) {
    if (!Utils.isEmpty(resultFieldName)) {
        IValueMeta v = new ValueMetaInteger(resultFieldName);
        v.setLength(IValueMeta.DEFAULT_INTEGER_LENGTH, 0);
        v.setOrigin(name);
        r.addValueMeta(v);
    }
}
Also used : IValueMeta(org.apache.hop.core.row.IValueMeta) ValueMetaInteger(org.apache.hop.core.row.value.ValueMetaInteger)

Example 15 with ValueMetaInteger

use of org.apache.hop.core.row.value.ValueMetaInteger in project hop by apache.

the class MemoryGroupByAggregationTest method testSqlCompatible.

@Test
@Ignore
public void testSqlCompatible() throws Exception {
    addColumn(new ValueMetaInteger("value"), null, -2L, null, 0L, null, 10L, null, null, 0L, null);
    RowMetaAndData output = runTransform();
    assertThat(output.getInteger("value_max"), is(10L));
    assertThat(output.getInteger("value_min"), is(-2L));
    assertThat(output.getInteger("value_sum"), is(8L));
    assertThat(output.getInteger("value_ave"), is(2L));
    assertThat(output.getInteger("value_count"), is(4L));
    assertThat(output.getInteger("value_count_any"), is(10L));
    assertThat(output.getInteger("value_count_distinct"), is(3L));
}
Also used : RowMetaAndData(org.apache.hop.core.RowMetaAndData) ValueMetaInteger(org.apache.hop.core.row.value.ValueMetaInteger)

Aggregations

ValueMetaInteger (org.apache.hop.core.row.value.ValueMetaInteger)103 IValueMeta (org.apache.hop.core.row.IValueMeta)62 ValueMetaString (org.apache.hop.core.row.value.ValueMetaString)53 RowMeta (org.apache.hop.core.row.RowMeta)43 IRowMeta (org.apache.hop.core.row.IRowMeta)38 ValueMetaDate (org.apache.hop.core.row.value.ValueMetaDate)22 Test (org.junit.Test)16 RowMetaAndData (org.apache.hop.core.RowMetaAndData)11 ValueMetaNumber (org.apache.hop.core.row.value.ValueMetaNumber)11 ArrayList (java.util.ArrayList)10 Date (java.util.Date)9 HopTransformException (org.apache.hop.core.exception.HopTransformException)8 ValueMetaBoolean (org.apache.hop.core.row.value.ValueMetaBoolean)8 HopException (org.apache.hop.core.exception.HopException)7 Database (org.apache.hop.core.database.Database)6 ILoggingObject (org.apache.hop.core.logging.ILoggingObject)6 DatabaseMeta (org.apache.hop.core.database.DatabaseMeta)5 SQLException (java.sql.SQLException)4 HopXmlException (org.apache.hop.core.exception.HopXmlException)4 DriverCqlRowHandler (org.apache.hop.databases.cassandra.datastax.DriverCqlRowHandler)4