Search in sources :

Example 96 with ValueMetaDate

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

the class BlockingStep_PDI_11344_Test method createRowMetaInterface.

private static RowMetaInterface createRowMetaInterface() {
    RowMetaInterface rm = new RowMeta();
    ValueMetaInterface[] valuesMeta = { new ValueMetaString("field1"), new ValueMetaInteger("field2"), new ValueMetaNumber("field3"), new ValueMetaDate("field4"), new ValueMetaBoolean("field5"), new ValueMetaBigNumber("field6"), new ValueMetaBigNumber("field7") };
    for (ValueMetaInterface aValuesMeta : valuesMeta) {
        rm.addValueMeta(aValuesMeta);
    }
    return rm;
}
Also used : ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) RowMeta(org.pentaho.di.core.row.RowMeta) ValueMetaNumber(org.pentaho.di.core.row.value.ValueMetaNumber) ValueMetaBigNumber(org.pentaho.di.core.row.value.ValueMetaBigNumber) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) ValueMetaInteger(org.pentaho.di.core.row.value.ValueMetaInteger) ValueMetaBoolean(org.pentaho.di.core.row.value.ValueMetaBoolean) ValueMetaDate(org.pentaho.di.core.row.value.ValueMetaDate) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface)

Example 97 with ValueMetaDate

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

the class JaninoStepIT method createRowMetaInterface.

public RowMetaInterface createRowMetaInterface() {
    RowMetaInterface rm = new RowMeta();
    ValueMetaInterface[] valuesMeta = { new ValueMetaString("string"), new ValueMetaInteger("integer"), new ValueMetaNumber("number"), new ValueMetaBigNumber("bigdecimal"), new ValueMetaDate("date"), new ValueMetaBinary("binary"), new ValueMetaBoolean("bool"), new ValueMetaTimestamp("timestamp"), new ValueMetaInternetAddress("inetaddress") };
    for (int i = 0; i < valuesMeta.length; i++) {
        rm.addValueMeta(valuesMeta[i]);
    }
    return rm;
}
Also used : ValueMetaTimestamp(org.pentaho.di.core.row.value.ValueMetaTimestamp) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) RowMeta(org.pentaho.di.core.row.RowMeta) ValueMetaInternetAddress(org.pentaho.di.core.row.value.ValueMetaInternetAddress) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) ValueMetaBoolean(org.pentaho.di.core.row.value.ValueMetaBoolean) ValueMetaInterface(org.pentaho.di.core.row.ValueMetaInterface) ValueMetaBinary(org.pentaho.di.core.row.value.ValueMetaBinary) ValueMetaNumber(org.pentaho.di.core.row.value.ValueMetaNumber) ValueMetaBigNumber(org.pentaho.di.core.row.value.ValueMetaBigNumber) ValueMetaInteger(org.pentaho.di.core.row.value.ValueMetaInteger) ValueMetaDate(org.pentaho.di.core.row.value.ValueMetaDate)

Example 98 with ValueMetaDate

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

the class JavaScriptSpecialIT method createDateAddResultData.

public List<RowMetaAndData> createDateAddResultData() throws ParseException {
    List<RowMetaAndData> list = new ArrayList<RowMetaAndData>();
    // Create RowMeta
    RowMetaInterface rm = new RowMeta();
    rm.addValueMeta(new ValueMetaDate("input"));
    rm.addValueMeta(new ValueMetaDate("new_weekday"));
    rm.addValueMeta(new ValueMetaDate("new_year"));
    rm.addValueMeta(new ValueMetaDate("new_month"));
    rm.addValueMeta(new ValueMetaDate("new_week"));
    rm.addValueMeta(new ValueMetaDate("new_day"));
    rm.addValueMeta(new ValueMetaDate("new_hour"));
    rm.addValueMeta(new ValueMetaDate("new_minute"));
    rm.addValueMeta(new ValueMetaDate("new_second"));
    DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Object[] r1 = new Object[] { // input
    format.parse("2014-01-01 00:00:00"), // weekday
    format.parse("2014-01-06 00:00:00"), // year
    format.parse("2019-01-01 00:00:00"), // month
    format.parse("2014-06-01 00:00:00"), // week
    format.parse("2014-02-05 00:00:00"), // day
    format.parse("2014-01-06 00:00:00"), // hour
    format.parse("2014-01-01 05:00:00"), // minute
    format.parse("2014-01-01 00:05:00"), // second
    format.parse("2014-01-01 00:00:05") };
    list.add(new RowMetaAndData(rm, r1));
    return list;
}
Also used : RowMetaAndData(org.pentaho.di.core.RowMetaAndData) RowMeta(org.pentaho.di.core.row.RowMeta) SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) ArrayList(java.util.ArrayList) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) ValueMetaDate(org.pentaho.di.core.row.value.ValueMetaDate) SimpleDateFormat(java.text.SimpleDateFormat)

Example 99 with ValueMetaDate

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

the class JavaScriptSpecialIT method createDateAddData.

public List<RowMetaAndData> createDateAddData() throws ParseException {
    List<RowMetaAndData> list = new ArrayList<RowMetaAndData>();
    // Create RowMeta
    RowMetaInterface rm = new RowMeta();
    rm.addValueMeta(new ValueMetaDate("input"));
    // Populate Row
    DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    list.add(new RowMetaAndData(rm, new Object[] { format.parse("2014-01-01 00:00:00") }));
    return list;
}
Also used : RowMetaAndData(org.pentaho.di.core.RowMetaAndData) RowMeta(org.pentaho.di.core.row.RowMeta) SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) ArrayList(java.util.ArrayList) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) ValueMetaDate(org.pentaho.di.core.row.value.ValueMetaDate) SimpleDateFormat(java.text.SimpleDateFormat)

Example 100 with ValueMetaDate

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

the class SortRowsIT method createGlobalData.

/**
 * Generate rows for couple of possible combinations
 * <ul>
 * <li>String
 * <li>String (with dup)
 * <li>Timestamp
 * <li>Integer
 * <li>String (CaseSensitive)
 * <li>Integer (pre-sorted) 1 grp
 * <li>String (pre-sorted) 2 grp
 * </ul>
 *
 * @return
 */
List<RowMetaAndData> createGlobalData() {
    List<RowMetaAndData> list = new ArrayList<RowMetaAndData>();
    RowMetaInterface rm = new RowMeta();
    rm.addValueMeta(new ValueMetaString(KEY1));
    rm.addValueMeta(new ValueMetaString(KEY2));
    rm.addValueMeta(new ValueMetaDate(TMS));
    rm.addValueMeta(new ValueMetaInteger(INT));
    rm.addValueMeta(new ValueMetaString(STR));
    rm.addValueMeta(new ValueMetaInteger(INTG1));
    rm.addValueMeta(new ValueMetaString(STRG2));
    rm.addValueMeta(new ValueMetaString(CONST));
    long time = new Date().getTime();
    String prevKey = null;
    int counter = 0;
    int group = 0;
    for (int idx = 0; idx < MAX_COUNT; idx++) {
        String key1 = UUID.randomUUID().toString();
        String key2 = null;
        if ((idx % 10 == 0 || idx == 11) && idx != 0) {
            key2 = prevKey;
        } else {
            key2 = UUID.randomUUID().toString();
            prevKey = key2;
        }
        int rand = Math.abs(RN.nextInt() % 10000);
        Timestamp tms = new Timestamp(time + rand);
        Long igr = new Long(rand);
        String caseSen = TestUtilities.generateString(RN, 10);
        char ch = (char) (65 + counter);
        String gr2 = String.valueOf(ch);
        Object[] row = new Object[] { key1, key2, tms, igr, caseSen, new Long(group), gr2, "stable" };
        list.add(new RowMetaAndData(rm, row));
        if (counter == 13) {
            counter = 0;
            group++;
        } else {
            counter++;
        }
    }
    return list;
}
Also used : ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) RowMeta(org.pentaho.di.core.row.RowMeta) ArrayList(java.util.ArrayList) RowMetaInterface(org.pentaho.di.core.row.RowMetaInterface) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) Timestamp(java.sql.Timestamp) ValueMetaTimestamp(org.pentaho.di.core.row.value.ValueMetaTimestamp) Date(java.util.Date) ValueMetaDate(org.pentaho.di.core.row.value.ValueMetaDate) RowMetaAndData(org.pentaho.di.core.RowMetaAndData) ValueMetaInteger(org.pentaho.di.core.row.value.ValueMetaInteger) ValueMetaDate(org.pentaho.di.core.row.value.ValueMetaDate)

Aggregations

ValueMetaDate (org.pentaho.di.core.row.value.ValueMetaDate)104 ValueMetaInteger (org.pentaho.di.core.row.value.ValueMetaInteger)63 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)59 Test (org.junit.Test)50 ValueMetaBoolean (org.pentaho.di.core.row.value.ValueMetaBoolean)44 RowMeta (org.pentaho.di.core.row.RowMeta)43 ValueMetaNumber (org.pentaho.di.core.row.value.ValueMetaNumber)34 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)33 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)25 ValueMetaBigNumber (org.pentaho.di.core.row.value.ValueMetaBigNumber)23 ValueMetaTimestamp (org.pentaho.di.core.row.value.ValueMetaTimestamp)21 Calendar (java.util.Calendar)17 Date (java.util.Date)17 KettleException (org.pentaho.di.core.exception.KettleException)15 ValueMetaInternetAddress (org.pentaho.di.core.row.value.ValueMetaInternetAddress)15 RowMetaAndData (org.pentaho.di.core.RowMetaAndData)14 ValueMetaBinary (org.pentaho.di.core.row.value.ValueMetaBinary)13 KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)10 KettleStepException (org.pentaho.di.core.exception.KettleStepException)10 SQLException (java.sql.SQLException)8