本文整理汇总了Java中org.pentaho.di.core.row.ValueMetaInterface.TYPE_DATE属性的典型用法代码示例。如果您正苦于以下问题:Java ValueMetaInterface.TYPE_DATE属性的具体用法?Java ValueMetaInterface.TYPE_DATE怎么用?Java ValueMetaInterface.TYPE_DATE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.pentaho.di.core.row.ValueMetaInterface
的用法示例。
在下文中一共展示了ValueMetaInterface.TYPE_DATE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: kettleToJavaType
public static Class<?> kettleToJavaType(int t) {
switch (t) {
case ValueMetaInterface.TYPE_STRING:
return String.class;
case ValueMetaInterface.TYPE_INTEGER:
return long.class;
case ValueMetaInterface.TYPE_NUMBER:
return double.class;
case ValueMetaInterface.TYPE_BIGNUMBER:
return BigDecimal.class;
case ValueMetaInterface.TYPE_DATE:
return Date.class;
case ValueMetaInterface.TYPE_BOOLEAN:
return boolean.class;
case ValueMetaInterface.TYPE_BINARY:
return byte[].class;
default:
return null;
}
}
示例2: addRowData
private Object[] addRowData(Object[] r) throws KettleException
{
// Parsing field
final JSON json = JSONSerializer.toJSON(r[data.fieldPos].toString());
final JXPathContext context = JXPathContext.newContext(json);
final String[] fieldNames = meta.getFieldName();
final RowMetaInterface rowMeta = data.outputRowMeta;
// Parsing each path into otuput rows
for (int i = 0; i < fieldNames.length; i++) {
final String fieldPath = meta.getXPath()[i];
final String fieldName = meta.getFieldName()[i];
final Object fieldValue = context.getValue(fieldPath);
final Integer fieldIndex = rowMeta.indexOfValue(fieldNames[i]);
final ValueMetaInterface valueMeta = rowMeta.getValueMeta(fieldIndex);
final DateFormat df = (valueMeta.getType() == ValueMetaInterface.TYPE_DATE)
? new SimpleDateFormat(meta.getFieldFormat()[i])
: null;
// safely add the unique field at the end of the output row
r = RowDataUtil.addValueData(r, fieldIndex, getRowDataValue(fieldName, valueMeta, valueMeta, fieldValue, df));
}
return r;
}
示例3: convertDataType
public static int convertDataType(DataType type) {
switch (type.getName()) {
case SMALLINT:
case INT:
case BIGINT:
case COUNTER:
case TIME:
return ValueMetaInterface.TYPE_INTEGER; // 5 > java.lang.Long
case ASCII:
case TEXT:
case VARCHAR:
case UUID:
case TIMEUUID:
return ValueMetaInterface.TYPE_STRING; // 2 > java.lang.String
case INET:
return ValueMetaInterface.TYPE_INET; // 10 >
case BOOLEAN:
return ValueMetaInterface.TYPE_BOOLEAN; // 4 > java.lang.Boolean
case DECIMAL:
case FLOAT:
case DOUBLE:
return ValueMetaInterface.TYPE_NUMBER; // 1 > java.lang.Double
case VARINT:
return ValueMetaInterface.TYPE_BIGNUMBER; // 6 > java.math.BigDecimal
case TIMESTAMP:
return ValueMetaInterface.TYPE_DATE; // 3 > java.util.Date
case BLOB:
return ValueMetaInterface.TYPE_BINARY; // 8 > java.lang.byte[]
case LIST:
case MAP:
case SET:
return ValueMetaInterface.TYPE_SERIALIZABLE; // 0
default:
return ValueMetaInterface.TYPE_STRING;
}
}
示例4: setMinimalWidth
private void setMinimalWidth() {
int nrNonEmptyFields = wFields.nrNonEmpty();
for (int i = 0; i < nrNonEmptyFields; i++) {
TableItem item = wFields.getNonEmpty(i);
item.setText(4, "");
item.setText(5, "");
item.setText(9, ValueMeta.getTrimTypeDesc(ValueMetaInterface.TRIM_TYPE_BOTH));
int type = ValueMeta.getType(item.getText(2));
switch (type) {
case ValueMetaInterface.TYPE_STRING:
item.setText(3, "");
break;
case ValueMetaInterface.TYPE_INTEGER:
item.setText(3, "0");
break;
case ValueMetaInterface.TYPE_NUMBER:
item.setText(3, "0.#####");
break;
case ValueMetaInterface.TYPE_DATE:
break;
default:
break;
}
}
for (int i = 0; i < input.getOutputFields().length; i++) {
input.getOutputFields()[i].setTrimType(ValueMetaInterface.TRIM_TYPE_BOTH);
}
wFields.optWidth(true);
}
示例5: setMinimalWidth
/**
* Sets the output width to minimal width...
*
*/
public void setMinimalWidth() {
int nrNonEmptyFields = wFields.nrNonEmpty();
for ( int i = 0; i < nrNonEmptyFields; i++ ) {
TableItem item = wFields.getNonEmpty( i );
item.setText( 4, "" );
item.setText( 5, "" );
item.setText( 9, ValueMeta.getTrimTypeDesc( ValueMetaInterface.TRIM_TYPE_BOTH ) );
int type = ValueMeta.getType( item.getText( 2 ) );
switch ( type ) {
case ValueMetaInterface.TYPE_STRING:
item.setText( 3, "" );
break;
case ValueMetaInterface.TYPE_INTEGER:
item.setText( 3, "0" );
break;
case ValueMetaInterface.TYPE_NUMBER:
item.setText( 3, "0.#####" );
break;
case ValueMetaInterface.TYPE_DATE:
break;
default:
break;
}
}
for ( int i = 0; i < input.getOutputFields().length; i++ ) {
input.getOutputFields()[i].setTrimType( ValueMetaInterface.TRIM_TYPE_BOTH );
}
wFields.optWidth( true );
}
示例6: setMinimalWidth
/**
* Sets the output width to minimal width...
*
*/
public void setMinimalWidth() {
int nrNonEmptyFields = wFields.nrNonEmpty();
for ( int i = 0; i < nrNonEmptyFields; i++ ) {
TableItem item = wFields.getNonEmpty( i );
item.setText( 5, "" );
item.setText( 6, "" );
int type = ValueMeta.getType( item.getText( 2 ) );
switch ( type ) {
case ValueMetaInterface.TYPE_STRING:
item.setText( 4, "" );
break;
case ValueMetaInterface.TYPE_INTEGER:
item.setText( 4, "0" );
break;
case ValueMetaInterface.TYPE_NUMBER:
item.setText( 4, "0.#####" );
break;
case ValueMetaInterface.TYPE_DATE:
break;
default:
break;
}
}
wFields.optWidth( true );
}
示例7: checkType
private void checkType(Cell cell, ValueMetaInterface v) throws KettleException
{
if (!meta.isStrictTypes()) return;
CellType cellType = cell.getType();
if (cellType.equals(CellType.BOOLEAN))
{
if (!(v.getType() == ValueMetaInterface.TYPE_STRING || v.getType() == ValueMetaInterface.TYPE_NONE || v.getType() == ValueMetaInterface.TYPE_BOOLEAN))
throw new KettleException(Messages.getString("ExcelInput.Exception.InvalidTypeBoolean",v.getTypeDesc()));
}
else if (cellType.equals(CellType.DATE))
{
if (!(v.getType() == ValueMetaInterface.TYPE_STRING || v.getType() == ValueMetaInterface.TYPE_NONE || v.getType() == ValueMetaInterface.TYPE_DATE))
throw new KettleException(Messages.getString("ExcelInput.Exception.InvalidTypeDate", cell.getContents(),v.getTypeDesc()));
}
else if (cellType.equals(CellType.LABEL))
{
if (v.getType() == ValueMetaInterface.TYPE_BOOLEAN || v.getType() == ValueMetaInterface.TYPE_DATE || v.getType() == ValueMetaInterface.TYPE_INTEGER || v.getType() == ValueMetaInterface.TYPE_NUMBER)
throw new KettleException(Messages.getString("ExcelInput.Exception.InvalidTypeLabel", cell.getContents(),v.getTypeDesc()));
}
else if (cellType.equals(CellType.EMPTY))
{
// ok
}
else if (cellType.equals(CellType.NUMBER))
{
if (!(v.getType() == ValueMetaInterface.TYPE_STRING || v.getType() == ValueMetaInterface.TYPE_NONE || v.getType() == ValueMetaInterface.TYPE_INTEGER || v.getType() == ValueMetaInterface.TYPE_BIGNUMBER || v.getType() == ValueMetaInterface.TYPE_NUMBER))
throw new KettleException(Messages.getString("ExcelInput.Exception.InvalidTypeNumber", cell.getContents(),v.getTypeDesc()));
}
else
{
throw new KettleException(Messages.getString("ExcelInput.Exception.UnsupportedType", ""+cellType,cell.getContents()));
}
}
示例8: getGKBinding
public static int getGKBinding(AttributeType at) {
Class<?> c = at.getBinding();
int binding;
if (c == java.lang.Integer.class || c == java.lang.Long.class)
binding = ValueMetaInterface.TYPE_INTEGER;
else if (c == java.lang.Double.class)
binding = ValueMetaInterface.TYPE_NUMBER;
else if (c == java.util.Date.class)
binding = ValueMetaInterface.TYPE_DATE;
else if (com.vividsolutions.jts.geom.Geometry.class.isAssignableFrom(c))
binding = ValueMetaInterface.TYPE_GEOMETRY;
else
binding = ValueMetaInterface.TYPE_STRING;
return binding;
}
示例9: writeToDataFile
/**
* Write a single row to the temporary data file.
*
* @param row
* row entries
* @throws KettleException
* ...
*/
private void writeToDataFile(final Object[] row) throws KettleException {
try {
int tableCol = 0;
for (Integer index : this.columnSortOrder) {
int length = 0;
if (this.tableRowMeta.getValueMeta(tableCol).getType() == ValueMetaInterface.TYPE_DATE) {
length = FastloadControlBuilder.DEFAULT_DATE_FORMAT.length();
} else {
length = this.tableRowMeta.getValueMeta(tableCol)
.getLength();
}
byte[] rowData = new byte[length];
System.arraycopy(row[index], 0, rowData, 0, length);
if (((byte[]) row[index]).length < rowData.length) { // fillup padding with ' ' instead of 0
Arrays.fill(rowData, ((byte[]) row[index]).length, rowData.length, (byte) ' ');
}
String nullString = new String(rowData).trim();
if (FastloadControlBuilder.DEFAULT_NULL_VALUE.equals(nullString)) {
rowData = String.format("%1$#" + rowData.length + "s", FastloadControlBuilder.DEFAULT_NULL_VALUE).getBytes();
}
this.dataFile.write(rowData);
this.dataFile.write(FastloadControlBuilder.DATAFILE_COLUMN_SEPERATOR.getBytes());
tableCol++;
}
this.dataFile.write(SystemUtils.LINE_SEPARATOR.getBytes());
} catch (IOException e) {
throw new KettleException("Cannot write data file [path=" + this.dataFile + "]", e);
}
}
示例10: init
public boolean init(StepMetaInterface smi, StepDataInterface sdi)
{
meta=(MonetDBBulkLoaderMeta)smi;
data=(MonetDBBulkLoaderData)sdi;
if (super.init(smi, sdi))
{
data.quote = "\"".getBytes();
data.separator = "|".getBytes();
data.newline = Const.CR.getBytes();
data.monetDateMeta = new ValueMeta("dateMeta", ValueMetaInterface.TYPE_DATE);
data.monetDateMeta.setConversionMask("yyyy/MM/dd HH:mm:ss");
data.monetDateMeta.setStringEncoding(meta.getEncoding());
data.monetNumberMeta = new ValueMeta("numberMeta", ValueMetaInterface.TYPE_NUMBER);
data.monetNumberMeta.setConversionMask("#.#");
data.monetNumberMeta.setGroupingSymbol(",");
data.monetNumberMeta.setDecimalSymbol(".");
data.monetNumberMeta.setStringEncoding(meta.getEncoding());
data.bufferSize = Const.toInt(environmentSubstitute(meta.getBufferSize()), 100000);
// Allocate the buffer
//
data.rowBuffer = new byte[data.bufferSize][];
data.bufferIndex = 0;
// Schema-table combination...
data.schemaTable = meta.getDatabaseMeta().getSchemaTableCombination(environmentSubstitute(meta.getSchemaName()), environmentSubstitute(meta.getTableName()));
return true;
}
return false;
}
示例11: getUpdate
private void getUpdate()
{
try
{
RowMetaInterface r = transMeta.getPrevStepFields(stepname);
if (r != null)
{
TableItemInsertListener listener = new TableItemInsertListener()
{
public boolean tableItemInserted(TableItem tableItem, ValueMetaInterface v)
{
if ( v.getType() == ValueMetaInterface.TYPE_DATE )
{
// The default is : format is OK for dates, see if this sticks later on...
//
tableItem.setText(3, "Y");
}
else
{
tableItem.setText(3, "Y"); // default is OK too...
}
return true;
}
};
BaseStepDialog.getFieldsFromPrevious(r, wReturn, 1, new int[] { 1, 2}, new int[] {}, -1, -1, listener);
}
}
catch (KettleException ke)
{
new ErrorDialog(shell, BaseMessages.getString(PKG, "TeraDataBulkLoaderDialog.FailedToGetFields.DialogTitle"),
BaseMessages.getString(PKG, "TeraDataBulkLoaderDialog.FailedToGetFields.DialogMessage"), ke);
}
}
示例12: setMinimalWidth
/**
* Sets the output width to minimal width...
*
*/
public void setMinimalWidth()
{
int nrNonEmptyFields = wFields.nrNonEmpty();
for (int i=0;i<nrNonEmptyFields;i++)
{
TableItem item = wFields.getNonEmpty(i);
item.setText(4, "");
item.setText(5, "");
item.setText(9, ValueMeta.getTrimTypeDesc(ValueMetaInterface.TRIM_TYPE_BOTH));
int type = ValueMeta.getType(item.getText(2));
switch(type)
{
case ValueMetaInterface.TYPE_STRING: item.setText(3, ""); break;
case ValueMetaInterface.TYPE_INTEGER: item.setText(3, "0"); break;
case ValueMetaInterface.TYPE_NUMBER: item.setText(3, "0.#####"); break;
case ValueMetaInterface.TYPE_DATE: break;
default: break;
}
}
for (int i=0;i<input.getOutputFields().length;i++)
input.getOutputFields()[i].setTrimType(ValueMetaInterface.TRIM_TYPE_BOTH);
wFields.optWidth(true);
}
示例13: getPrimitiveClass
public static Class<?> getPrimitiveClass(int valueType)
{
switch(valueType)
{
case ValueMetaInterface.TYPE_BIGNUMBER: return BigDecimal.class;
case ValueMetaInterface.TYPE_BINARY: return (new byte[] {}).getClass();
case ValueMetaInterface.TYPE_BOOLEAN: return Boolean.class;
case ValueMetaInterface.TYPE_DATE: return Date.class;
case ValueMetaInterface.TYPE_INTEGER: return Long.class;
case ValueMetaInterface.TYPE_NUMBER: return Double.class;
// case Value.VALUE_TYPE_SERIALIZABLE: return Serializable.class;
case ValueMetaInterface.TYPE_STRING: return String.class;
default: return null;
}
}
示例14: getFieldDefinition
public String getFieldDefinition(ValueMetaInterface v, String tk, String pk, boolean use_autoinc, boolean add_fieldname, boolean add_cr)
{
String retval="";
String fieldname = v.getName();
int length = v.getLength();
// Unused in vertica
//int precision = v.getPrecision();
if (add_fieldname) retval+=fieldname+" ";
int type = v.getType();
switch(type)
{
case ValueMetaInterface.TYPE_DATE : retval+="TIMESTAMP"; break;
case ValueMetaInterface.TYPE_BOOLEAN: retval+="BOOLEAN"; break;
case ValueMetaInterface.TYPE_NUMBER :
case ValueMetaInterface.TYPE_BIGNUMBER:
retval+="FLOAT";
break;
case ValueMetaInterface.TYPE_INTEGER:
retval+="INTEGER";
break;
case ValueMetaInterface.TYPE_STRING:
retval+="VARCHAR("+length+")";
break;
default:
retval+=" UNKNOWN";
break;
}
if (add_cr) retval+=Const.CR;
return retval;
}
示例15: init
public boolean init(StepMetaInterface smi, StepDataInterface sdi)
{
meta=(LucidDBBulkLoaderMeta)smi;
data=(LucidDBBulkLoaderData)sdi;
if (super.init(smi, sdi))
{
data.quote = "\"".getBytes();
data.separator = ",".getBytes();
data.newline = Const.CR.getBytes();
data.bulkTimestampMeta = new ValueMeta("timestampMeta", ValueMetaInterface.TYPE_DATE);
data.bulkTimestampMeta.setConversionMask("yyyy-MM-dd HH:mm:ss");
data.bulkTimestampMeta.setStringEncoding(meta.getEncoding());
data.bulkDateMeta = new ValueMeta("dateMeta", ValueMetaInterface.TYPE_DATE);
data.bulkDateMeta.setConversionMask("yyyy-MM-dd");
data.bulkDateMeta.setStringEncoding(meta.getEncoding());
data.bulkNumberMeta = new ValueMeta("numberMeta", ValueMetaInterface.TYPE_NUMBER);
data.bulkNumberMeta.setConversionMask("#.#");
data.bulkNumberMeta.setGroupingSymbol(",");
data.bulkNumberMeta.setDecimalSymbol(".");
data.bulkNumberMeta.setStringEncoding(meta.getEncoding());
data.bufferSize = Const.toInt(environmentSubstitute(meta.getBufferSize()), 100000);
// Allocate the buffer
//
data.rowBuffer = new byte[data.bufferSize][];
data.bufferIndex = 0;
// Schema-table combination...
data.schemaTable = meta.getDatabaseMeta().getSchemaTableCombination(environmentSubstitute(meta.getSchemaName()), environmentSubstitute(meta.getTableName()));
return true;
}
return false;
}