本文整理汇总了Java中org.pentaho.di.core.row.ValueMetaInterface.setPrecision方法的典型用法代码示例。如果您正苦于以下问题:Java ValueMetaInterface.setPrecision方法的具体用法?Java ValueMetaInterface.setPrecision怎么用?Java ValueMetaInterface.setPrecision使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.core.row.ValueMetaInterface
的用法示例。
在下文中一共展示了ValueMetaInterface.setPrecision方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFields
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
/**
* This method is called to determine the changes the step is making to the row-stream.
* To that end a RowMetaInterface object is passed in, containing the row-stream structure as it is when entering
* the step. This method must apply any changes the step makes to the row stream. Usually a step adds fields to the
* row-stream.
*
* @param inputRowMeta the row structure coming in to the step
* @param name the name of the step making the changes
* @param info row structures of any info steps coming in
* @param nextStep the description of a step this step is passing rows to
* @param space the variable space for resolving variables
* @param repository the repository instance optionally read from
* @param metaStore the metaStore to optionally read from
*/
@Override
public void getFields(RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore) throws KettleStepException{
for ( int i = 0; i < fields.length; i++ ) {
int type = fields[i].getType();
if ( type == ValueMetaInterface.TYPE_NONE) type = ValueMetaInterface.TYPE_STRING;
try {
ValueMetaInterface v = ValueMetaFactory.createValueMeta( fields[i].getName(), type );
v.setConversionMask( fields[i].getFormat() );
v.setLength( fields[i].getLength() );
v.setPrecision( fields[i].getPrecision() );
v.setCurrencySymbol( fields[i].getCurrencySymbol() );
v.setDecimalSymbol( fields[i].getDecimalSymbol() );
v.setGroupingSymbol( fields[i].getGroupSymbol() );
v.setTrimType( fields[i].getTrimType() );
v.setOrigin( name );
inputRowMeta.addValueMeta( v );
} catch (KettlePluginException e) {
throw new KettleStepException( e );
}
}
}
示例2: getFields
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public void getFields(RowMetaInterface rowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) throws KettleStepException
{
for (int i=0;i<fieldName.length;i++)
{
if (fieldName[i]!=null && fieldName[i].length()!=0)
{
int type=ValueMeta.getType(fieldType[i]);
if (type==ValueMetaInterface.TYPE_NONE) type=ValueMetaInterface.TYPE_STRING;
ValueMetaInterface v=new ValueMeta(fieldName[i], type);
v.setLength(fieldLength[i]);
v.setPrecision(fieldPrecision[i]);
v.setOrigin(name);
rowMeta.addValueMeta(v);
}
}
}
示例3: getValue
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
private ValueMetaAndData getValue(String valuename) throws KettleValueException {
int valtype = ValueMeta.getType(wValueType.getText());
ValueMetaAndData val = new ValueMetaAndData(valuename, wInputString.getText());
ValueMetaInterface valueMeta = val.getValueMeta();
Object valueData = val.getValueData();
valueMeta.setType(valtype);
int formatIndex = wFormat.getSelectionIndex();
valueMeta.setConversionMask(formatIndex >= 0 ? wFormat.getItem(formatIndex) : wFormat.getText());
valueMeta.setLength(Const.toInt(wLength.getText(), -1));
valueMeta.setPrecision(Const.toInt(wPrecision.getText(), -1));
ValueMetaInterface stringValueMeta = new ValueMeta(valuename, ValueMetaInterface.TYPE_STRING);
stringValueMeta.setConversionMetadata(valueMeta);
Object targetData = stringValueMeta.convertDataUsingConversionMetaData(valueData);
val.setValueData(targetData);
return val;
}
示例4: getFields
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public void getFields(RowMetaInterface inputRowMeta, String name, RowMetaInterface info[], StepMeta nextStep, VariableSpace space) throws KettleStepException
{
// Add new field?
for(int i=0;i<fieldOutStream.length;i++) {
if (!Const.isEmpty(fieldOutStream[i])){
int index=inputRowMeta.indexOfValue(fieldInStream[i]);
if(index>=0)
{
ValueMetaInterface in=inputRowMeta.getValueMeta(index);
ValueMetaInterface v = new ValueMeta(space.environmentSubstitute(fieldOutStream[i]), in.getType());
v.setName(space.environmentSubstitute(fieldOutStream[i]));
v.setLength(in.getLength());
v.setPrecision(in.getPrecision());
v.setConversionMask(in.getConversionMask());
v.setOrigin(name);
inputRowMeta.addValueMeta(v);
}
}
}
}
示例5: getFields
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public void getFields(RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) throws KettleStepException
{
ValueMetaInterface v=new ValueMeta(technicalKeyField, ValueMetaInterface.TYPE_INTEGER);
v.setLength(10);
v.setPrecision(0);
v.setOrigin(origin);
row.addValueMeta(v);
if (replaceFields)
{
for (int i=0;i<keyField.length;i++)
{
int idx = row.indexOfValue(keyField[i]);
if (idx>=0)
{
row.removeValueMeta(idx);
}
}
}
}
示例6: getFields
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public void getFields(RowMetaInterface rowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) throws KettleStepException
{
for (int i=0;i<fieldName.length;i++) {
if (!Const.isEmpty(fieldName[i])) {
int type=ValueMeta.getType(fieldType[i]);
if (type==ValueMetaInterface.TYPE_NONE) type=ValueMetaInterface.TYPE_STRING;
ValueMetaInterface v=new ValueMeta(fieldName[i], type);
v.setLength(fieldLength[i]);
v.setPrecision(fieldPrecision[i]);
v.setOrigin(name);
v.setConversionMask(fieldFormat[i]);
v.setCurrencySymbol(currency[i]);
v.setGroupingSymbol(group[i]);
v.setDecimalSymbol(decimal[i]);
rowMeta.addValueMeta(v);
}
}
}
示例7: getFields
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public void getFields( RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep,
VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException {
// determine the maximum length
int length = -1;
for ( int i = 0; i < fieldName.length; i++ ) {
if ( variableName[ i ] != null ) {
String string = space.environmentSubstitute( variableName[ i ] );
if ( string.length() > length ) {
length = string.length();
}
}
}
RowMetaInterface row = new RowMeta();
for ( int i = 0; i < fieldName.length; i++ ) {
ValueMetaInterface valueMeta = new ValueMeta( fieldName[ i ], fieldType[ i ] );
if ( fieldLength[ i ] < 0 ) {
valueMeta.setLength( length );
} else {
valueMeta.setLength( fieldLength[ i ] );
}
if ( fieldPrecision[ i ] >= 0 ) {
valueMeta.setPrecision( fieldPrecision[ i ] );
}
valueMeta.setConversionMask( fieldFormat[ i ] );
valueMeta.setGroupingSymbol( group[ i ] );
valueMeta.setDecimalSymbol( decimal[ i ] );
valueMeta.setCurrencySymbol( currency[ i ] );
valueMeta.setTrimType( trimType[ i ] );
valueMeta.setOrigin( name );
row.addValueMeta( valueMeta );
}
inputRowMeta.mergeRowMeta( row );
}
示例8: setValueMeta
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
private void setValueMeta(ValueMetaInterface v, int i, String name){
int type = fieldType[i];
if (type == ValueMetaInterface.TYPE_NONE) type = ValueMetaInterface.TYPE_STRING;
v.setType(type);
v.setLength(fieldLength[i]);
v.setPrecision(fieldPrecision[i]);
v.setOrigin(name);
v.setConversionMask(fieldFormat[i]);
v.setDecimalSymbol(fieldDecimal[i]);
v.setGroupingSymbol(fieldGroup[i]);
v.setCurrencySymbol(fieldCurrency[i]);
v.setTrimType(fieldTrimType[i]);
}
示例9: getFields
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public void getFields(RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) throws KettleStepException
{
for (int i=0;i<fieldDefinition.length;i++) {
FixedFileInputField field = fieldDefinition[i];
ValueMetaInterface valueMeta = new ValueMeta(field.getName(), field.getType());
valueMeta.setConversionMask(field.getFormat());
valueMeta.setTrimType(field.getTrimType());
valueMeta.setLength(field.getLength());
valueMeta.setPrecision(field.getPrecision());
valueMeta.setConversionMask(field.getFormat());
valueMeta.setDecimalSymbol(field.getDecimal());
valueMeta.setGroupingSymbol(field.getGrouping());
valueMeta.setCurrencySymbol(field.getCurrency());
valueMeta.setStringEncoding(space.environmentSubstitute(encoding));
if (lazyConversionActive) valueMeta.setStorageType(ValueMetaInterface.STORAGE_TYPE_BINARY_STRING);
// In case we want to convert Strings...
//
ValueMetaInterface storageMetadata = valueMeta.clone();
storageMetadata.setType(ValueMetaInterface.TYPE_STRING);
storageMetadata.setStorageType(ValueMetaInterface.STORAGE_TYPE_NORMAL);
valueMeta.setStorageMetadata(storageMetadata);
valueMeta.setOrigin(origin);
rowMeta.addValueMeta(valueMeta);
}
}
示例10: getFields
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public void getFields(RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) throws KettleStepException
{
// No values are added to the row in this type of step
// However, in case of Fixed length records,
// the field precisions and lengths are altered!
for (int i=0;i<outputFields.length;i++)
{
TextFileField field = outputFields[i];
ValueMetaInterface v = row.searchValueMeta(field.getName());
if (v!=null)
{
v.setLength(field.getLength());
v.setPrecision(field.getPrecision());
v.setConversionMask(field.getFormat());
v.setDecimalSymbol(field.getDecimalSymbol());
v.setGroupingSymbol(field.getGroupingSymbol());
v.setCurrencySymbol(field.getCurrencySymbol());
v.setOutputPaddingEnabled( isPadded() );
v.setTrimType(field.getTrimType());
if ( ! Const.isEmpty(getEncoding()) )
{
v.setStringEncoding(getEncoding());
}
// enable output padding by default to be compatible with v2.5.x
//
v.setOutputPaddingEnabled(true);
}
}
}
示例11: getFields
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public void getFields(RowMetaInterface inputRowMeta, String name, RowMetaInterface info[], StepMeta nextStep, VariableSpace space) throws KettleStepException
{
// Determine the maximum length...
//
int length = -1;
for (int i=0;i<fieldName.length;i++)
{
if (variableString[i]!=null)
{
String string = space.environmentSubstitute(variableString[i]);
if (string.length()>length) length=string.length();
}
}
RowMetaInterface row=new RowMeta();
for (int i=0;i<fieldName.length;i++)
{
ValueMetaInterface v = new ValueMeta(fieldName[i], fieldType[i]);
if (fieldLength[i]<0) v.setLength(length); else v.setLength(fieldLength[i]);
if (fieldPrecision[i]>=0) v.setPrecision(fieldPrecision[i]);
v.setConversionMask(fieldFormat[i]);
v.setGroupingSymbol(group[i]);
v.setDecimalSymbol(decimal[i]);
v.setCurrencySymbol(currency[i]);
v.setTrimType(trimType[i]);
v.setOrigin(name);
row.addValueMeta(v);
}
inputRowMeta.mergeRowMeta(row);
}
示例12: getFields
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public void getFields(RowMetaInterface rowMeta, String origin, RowMetaInterface[] info,
StepMeta nextStep, VariableSpace space) throws KettleStepException {
rowMeta.clear(); // Start with a clean slate, eats the input
for (int i = 0; i < inputFields.length; i++) {
TextFileInputField field = inputFields[i];
ValueMetaInterface valueMeta = new ValueMeta(field.getName(), field.getType());
valueMeta.setConversionMask(field.getFormat());
valueMeta.setLength(field.getLength());
valueMeta.setPrecision(field.getPrecision());
valueMeta.setConversionMask(field.getFormat());
valueMeta.setDecimalSymbol(field.getDecimalSymbol());
valueMeta.setGroupingSymbol(field.getGroupSymbol());
valueMeta.setCurrencySymbol(field.getCurrencySymbol());
valueMeta.setTrimType(field.getTrimType());
if (lazyConversionActive) {
valueMeta.setStorageType(ValueMetaInterface.STORAGE_TYPE_BINARY_STRING);
}
valueMeta.setStringEncoding(space.environmentSubstitute(encoding));
// In case we want to convert Strings...
// Using a copy of the valueMeta object means that the inner and outer representation
// format is the same.
// Preview will show the data the same way as we read it.
// This layout is then taken further down the road by the metadata through the transformation.
//
ValueMetaInterface storageMetadata = valueMeta.clone();
storageMetadata.setType(ValueMetaInterface.TYPE_STRING);
storageMetadata.setStorageType(ValueMetaInterface.STORAGE_TYPE_NORMAL);
storageMetadata
.setLength(-1, -1); // we don't really know the lengths of the strings read in advance.
valueMeta.setStorageMetadata(storageMetadata);
valueMeta.setOrigin(origin);
rowMeta.addValueMeta(valueMeta);
}
if (!Const.isEmpty(filenameField) && includingFilename) {
ValueMetaInterface filenameMeta =
new ValueMeta(filenameField, ValueMetaInterface.TYPE_STRING);
filenameMeta.setOrigin(origin);
if (lazyConversionActive) {
filenameMeta.setStorageType(ValueMetaInterface.STORAGE_TYPE_BINARY_STRING);
filenameMeta
.setStorageMetadata(new ValueMeta(filenameField, ValueMetaInterface.TYPE_STRING));
}
rowMeta.addValueMeta(filenameMeta);
}
if (!Const.isEmpty(rowNumField)) {
ValueMetaInterface rowNumMeta = new ValueMeta(rowNumField, ValueMetaInterface.TYPE_INTEGER);
rowNumMeta.setLength(10);
rowNumMeta.setOrigin(origin);
rowMeta.addValueMeta(rowNumMeta);
}
}
示例13: getFields
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public void getFields(RowMetaInterface row, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) throws KettleStepException
{
// the folderName
ValueMetaInterface folderName = new ValueMeta("folderName",ValueMeta.TYPE_STRING);
folderName.setLength(500);
folderName.setPrecision(-1);
folderName.setOrigin(name);
row.addValueMeta(folderName);
// the short folderName
ValueMetaInterface short_folderName = new ValueMeta("short_folderName",ValueMeta.TYPE_STRING);
short_folderName.setLength(500);
short_folderName.setPrecision(-1);
short_folderName.setOrigin(name);
row.addValueMeta(short_folderName);
// the path
ValueMetaInterface path = new ValueMeta("path",ValueMeta.TYPE_STRING);
path.setLength(500);
path.setPrecision(-1);
path.setOrigin(name);
row.addValueMeta(path);
// the ishidden
ValueMetaInterface ishidden = new ValueMeta("ishidden",ValueMeta.TYPE_BOOLEAN);
ishidden.setOrigin(name);
row.addValueMeta(ishidden);
// the isreadable
ValueMetaInterface isreadable = new ValueMeta("isreadable",ValueMeta.TYPE_BOOLEAN);
isreadable.setOrigin(name);
row.addValueMeta(isreadable);
// the iswriteable
ValueMetaInterface iswriteable = new ValueMeta("iswriteable",ValueMeta.TYPE_BOOLEAN);
iswriteable.setOrigin(name);
row.addValueMeta(iswriteable);
// the lastmodifiedtime
ValueMetaInterface lastmodifiedtime = new ValueMeta("lastmodifiedtime",ValueMeta.TYPE_DATE);
lastmodifiedtime.setOrigin(name);
row.addValueMeta(lastmodifiedtime);
// the uri
ValueMetaInterface uri = new ValueMeta("uri", ValueMeta.TYPE_STRING);
uri.setOrigin(name);
row.addValueMeta(uri);
// the rooturi
ValueMetaInterface rooturi = new ValueMeta("rooturi", ValueMeta.TYPE_STRING);
rooturi.setOrigin(name);
row.addValueMeta(rooturi);
// childrens
ValueMetaInterface childrens = new ValueMeta(space.environmentSubstitute("childrens"), ValueMeta.TYPE_INTEGER);
childrens.setLength(ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0);
childrens.setOrigin(name);
row.addValueMeta(childrens);
if (includeRowNumber)
{
ValueMetaInterface v = new ValueMeta(space.environmentSubstitute(rowNumberField), ValueMeta.TYPE_INTEGER);
v.setLength(ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0);
v.setOrigin(name);
row.addValueMeta(v);
}
}
示例14: getFields
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public void getFields(RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) throws KettleStepException
{
rowMeta.clear(); // Start with a clean slate, eats the input
for (int i=0;i<inputFields.length;i++) {
TextFileInputField field = inputFields[i];
ValueMetaInterface valueMeta = new ValueMeta(field.getName(), field.getType());
valueMeta.setConversionMask( field.getFormat() );
valueMeta.setLength( field.getLength() );
valueMeta.setPrecision( field.getPrecision() );
valueMeta.setConversionMask( field.getFormat() );
valueMeta.setDecimalSymbol( field.getDecimalSymbol() );
valueMeta.setGroupingSymbol( field.getGroupSymbol() );
valueMeta.setCurrencySymbol( field.getCurrencySymbol() );
valueMeta.setTrimType( field.getTrimType() );
if (lazyConversionActive) valueMeta.setStorageType(ValueMetaInterface.STORAGE_TYPE_BINARY_STRING);
valueMeta.setStringEncoding(space.environmentSubstitute(encoding));
// In case we want to convert Strings...
// Using a copy of the valueMeta object means that the inner and outer representation format is the same.
// Preview will show the data the same way as we read it.
// This layout is then taken further down the road by the metadata through the transformation.
//
ValueMetaInterface storageMetadata = valueMeta.clone();
storageMetadata.setType(ValueMetaInterface.TYPE_STRING);
storageMetadata.setStorageType(ValueMetaInterface.STORAGE_TYPE_NORMAL);
storageMetadata.setLength(-1,-1); // we don't really know the lengths of the strings read in advance.
valueMeta.setStorageMetadata(storageMetadata);
valueMeta.setOrigin(origin);
rowMeta.addValueMeta(valueMeta);
}
if (!Const.isEmpty(filenameField) && includingFilename) {
ValueMetaInterface filenameMeta = new ValueMeta(filenameField, ValueMetaInterface.TYPE_STRING);
filenameMeta.setOrigin(origin);
if (lazyConversionActive) {
filenameMeta.setStorageType(ValueMetaInterface.STORAGE_TYPE_BINARY_STRING);
filenameMeta.setStorageMetadata(new ValueMeta(filenameField, ValueMetaInterface.TYPE_STRING));
}
rowMeta.addValueMeta(filenameMeta);
}
if (!Const.isEmpty(rowNumField)) {
ValueMetaInterface rowNumMeta = new ValueMeta(rowNumField, ValueMetaInterface.TYPE_INTEGER);
rowNumMeta.setLength(10);
rowNumMeta.setOrigin(origin);
rowMeta.addValueMeta(rowNumMeta);
}
}
示例15: getFields
import org.pentaho.di.core.row.ValueMetaInterface; //导入方法依赖的package包/类
public void getFields(RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) throws KettleStepException {
// the directory and name of the object
//
ValueMetaInterface object = new ValueMeta("object", ValueMeta.TYPE_STRING);
object.setLength(500);
object.setPrecision(-1);
object.setOrigin(origin);
row.addValueMeta(object);
// the directory
//
ValueMetaInterface directory = new ValueMeta("directory", ValueMeta.TYPE_STRING);
directory.setLength(500);
directory.setPrecision(-1);
directory.setOrigin(origin);
row.addValueMeta(directory);
// the name
//
ValueMetaInterface name = new ValueMeta("name", ValueMeta.TYPE_STRING);
name.setLength(500);
name.setPrecision(-1);
name.setOrigin(origin);
row.addValueMeta(name);
// the object type
//
ValueMetaInterface objectType = new ValueMeta("object_type", ValueMeta.TYPE_STRING);
objectType.setLength(500);
objectType.setPrecision(-1);
objectType.setOrigin(origin);
row.addValueMeta(objectType);
// object_id
//
ValueMetaInterface objectId = new ValueMeta("object_id", ValueMeta.TYPE_STRING);
object.setLength(500);
object.setPrecision(-1);
objectId.setOrigin(origin);
row.addValueMeta(objectId);
// modified by
//
ValueMetaInterface modifiedBy = new ValueMeta("modified_by", ValueMeta.TYPE_STRING);
object.setLength(500);
object.setPrecision(-1);
modifiedBy.setOrigin(origin);
row.addValueMeta(modifiedBy);
// modified date
//
ValueMetaInterface modifiedDate = new ValueMeta("modified_date", ValueMeta.TYPE_DATE);
modifiedDate.setOrigin(origin);
row.addValueMeta(modifiedDate);
// description
//
ValueMetaInterface description = new ValueMeta("description", ValueMeta.TYPE_STRING);
description.setLength(500);
description.setPrecision(-1);
description.setOrigin(origin);
row.addValueMeta(description);
if (includeRowNumber) {
ValueMetaInterface v = new ValueMeta(space.environmentSubstitute(rowNumberField), ValueMeta.TYPE_INTEGER);
v.setLength(ValueMetaInterface.DEFAULT_INTEGER_LENGTH, 0);
v.setOrigin(origin);
row.addValueMeta(v);
}
}