本文整理匯總了Java中org.pentaho.di.core.row.RowMetaInterface.addValueMeta方法的典型用法代碼示例。如果您正苦於以下問題:Java RowMetaInterface.addValueMeta方法的具體用法?Java RowMetaInterface.addValueMeta怎麽用?Java RowMetaInterface.addValueMeta使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.pentaho.di.core.row.RowMetaInterface
的用法示例。
在下文中一共展示了RowMetaInterface.addValueMeta方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getFields
import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的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.RowMetaInterface; //導入方法依賴的package包/類
@Override
public void getFields(RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep,
VariableSpace space, Repository repository, IMetaStore metaStore) throws KettleStepException {
// Optionally add a fields...
//
if (StringUtils.isNotEmpty(responseCodeField)) {
ValueMetaInterface codeValue = new ValueMetaInteger(responseCodeField);
codeValue.setLength(3);
codeValue.setOrigin(name);
inputRowMeta.addValueMeta(codeValue);
}
if (StringUtils.isNotEmpty(responseTimeField)) {
ValueMetaInterface timeValue = new ValueMetaInteger(responseTimeField);
timeValue.setLength(7);
timeValue.setOrigin(name);
inputRowMeta.addValueMeta(timeValue);
}
}
示例3: determineInputFieldScriptFieldSplit
import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
/**
* Given a fully defined output row metadata structure, determine which of the output fields are being copied from
* the input fields and which must be the output of the script.
*
* @param fullOutputRowMeta the fully defined output row metadata structure
* @param scriptFields row meta that will hold script only fields
* @param inputPresentInOutput row meta that will hold input fields being copied
* @param infos the array of info row metas
* @param stepName the name of the step
*/
protected void determineInputFieldScriptFieldSplit( RowMetaInterface fullOutputRowMeta, RowMetaInterface scriptFields,
RowMetaInterface inputPresentInOutput, RowMetaInterface[] infos, String stepName ) {
scriptFields.clear();
inputPresentInOutput.clear();
RowMetaInterface consolidatedInputFields = new RowMeta();
for ( RowMetaInterface r : infos ) {
consolidatedInputFields.addRowMeta( r );
}
for ( ValueMetaInterface vm : fullOutputRowMeta.getValueMetaList() ) {
int index = consolidatedInputFields.indexOfValue( vm.getName() );
if ( index >= 0 ) {
inputPresentInOutput.addValueMeta( vm );
} else {
// must be a script output (either a variable name field or data frame column name
scriptFields.addValueMeta( vm );
}
}
}
示例4: getTestObject
import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
@Override public RowMetaInterface getTestObject() {
int size = random.nextInt( 10 ) + 1;
RowMetaInterface result = new RowMeta();
for ( int i = 0; i < size; i++ ) {
try {
ValueMetaInterface vm =
ValueMetaFactory.createValueMeta( "field" + i,
i % 2 == 0 ? ValueMetaInterface.TYPE_STRING : ValueMetaInterface.TYPE_NUMBER );
result.addValueMeta( vm );
} catch ( KettlePluginException e ) {
throw new RuntimeException( e );
}
}
return result;
}
示例5: getFields
import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
@SuppressWarnings( "deprecation" )
@Override
public void getFields( RowMetaInterface rowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep,
VariableSpace space ) throws KettleStepException {
try {
if ( m_fields == null || m_fields.size() == 0 ){
// TODO: get the name "json" from dialog
ValueMetaInterface jsonValueMeta = ValueMetaFactory.createValueMeta("JSON", ValueMetaInterface.TYPE_STRING);
jsonValueMeta.setOrigin( origin );
rowMeta.addValueMeta( jsonValueMeta );
}else{
// get the selected fields
for ( SequoiaDBInputField f : m_fields ){
ValueMetaInterface vm = ValueMetaFactory.createValueMeta(f.m_fieldName, ValueMetaFactory.getIdForValueMeta( f.m_kettleType ));
vm.setOrigin( origin );
rowMeta.addValueMeta( vm );
}
}
} catch (KettlePluginException e) {
throw new KettleStepException(e);
}
}
示例6: getFields
import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
@Override
public void getFields(RowMetaInterface row, String name,
RowMetaInterface[] info, StepMeta nextStep, VariableSpace space,
Repository repository, IMetaStore metaStore)
throws KettleStepException {
// Check Target Field Name
if (Const.isEmpty(targetFieldName)) {
throw new KettleStepException(BaseMessages.getString(PKG,
"ConcatFieldsMeta.CheckResult.TargetFieldNameMissing"));
}
// add targetFieldName
ValueMetaInterface vValue = new ValueMetaDom(targetFieldName,
ValueMetaDom.TYPE_DOM, targetFieldLength, 0);
vValue.setOrigin(name);
row.addValueMeta(vValue);
}
示例7: getFields
import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
public void getFields(RowMetaInterface row, String origin, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space) throws KettleStepException
{
// The output for the closure table is:
//
// - parentId
// - childId
// - distance
//
// Nothing else.
//
RowMetaInterface result = new RowMeta();
ValueMetaInterface parentValueMeta = row.searchValueMeta(parentIdFieldName);
if (parentValueMeta!=null) result.addValueMeta(parentValueMeta);
ValueMetaInterface childValueMeta = row.searchValueMeta(childIdFieldName);
if (childValueMeta!=null) result.addValueMeta(childValueMeta);
ValueMetaInterface distanceValueMeta = new ValueMeta(distanceFieldName, ValueMetaInterface.TYPE_INTEGER);
distanceValueMeta.setLength(ValueMetaInterface.DEFAULT_INTEGER_LENGTH);
result.addValueMeta(distanceValueMeta);
row.clear();
row.addRowMeta(result);
}
示例8: createRowMetaInterface
import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
public RowMetaInterface createRowMetaInterface()
{
RowMetaInterface rm = new RowMeta();
ValueMetaInterface valuesMeta[] = {
new ValueMeta("KEY1", ValueMeta.TYPE_STRING),
new ValueMeta("KEY2", ValueMeta.TYPE_STRING),
};
for (int i=0; i < valuesMeta.length; i++ )
{
rm.addValueMeta(valuesMeta[i]);
}
return rm;
}
示例9: createSourceRowMetaInterface
import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
public RowMetaInterface createSourceRowMetaInterface()
{
RowMetaInterface rm = new RowMeta();
ValueMetaInterface valuesMeta[] = {
new ValueMeta("ID", ValueMeta.TYPE_INTEGER, 8, 0),
new ValueMeta("CODE", ValueMeta.TYPE_INTEGER, 8, 0),
new ValueMeta("STRING", ValueMeta.TYPE_STRING, 30, 0)
};
for (int i=0; i < valuesMeta.length; i++ )
{
rm.addValueMeta(valuesMeta[i]);
}
return rm;
}
示例10: getFields
import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
public void getFields( RowMetaInterface inputRowMeta, String origin, RowMetaInterface[] info, StepMeta nextStep,
VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException {
if ( !Const.isEmpty( this.valueFieldName ) ) {
// Add value field meta if not found, else set it
ValueMetaInterface v;
try {
v = ValueMetaFactory.createValueMeta( this.valueFieldName, ValueMeta.getType( this.valueTypeName ) );
} catch ( KettlePluginException e ) {
throw new KettleStepException( BaseMessages.getString( PKG,
"MemcachedInputMeta.Exception.ValueTypeNameNotFound" ), e );
}
v.setOrigin( origin );
int valueFieldIndex = inputRowMeta.indexOfValue( this.valueFieldName );
if ( valueFieldIndex < 0 ) {
inputRowMeta.addValueMeta( v );
} else {
inputRowMeta.setValueMeta( valueFieldIndex, v );
}
} else {
throw new KettleStepException( BaseMessages
.getString( PKG, "MemcachedInputMeta.Exception.ValueFieldNameNotFound" ) );
}
}
示例11: getFields
import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
public void getFields(RowMetaInterface inputRowMeta, String name, RowMetaInterface[] info, StepMeta nextStep, VariableSpace space, Repository repository, IMetaStore metaStore)
throws KettleStepException
{
for (int i = 0; i < outputField.length; i++)
{
ValueMetaInterface valueMeta = new ValueMeta(outputField[i], outputType[i]);
valueMeta.setLength(outputLength[i]);
valueMeta.setPrecision(outputPrecision[i]);
valueMeta.setCurrencySymbol(outputCurrency[i]);
valueMeta.setConversionMask(outputFormat[i]);
valueMeta.setDecimalSymbol(outputDecimal[i]);
valueMeta.setGroupingSymbol(outputGroup[i]);
valueMeta.setOrigin(name);
inputRowMeta.addValueMeta(valueMeta);
}
}
示例12: createResultRowMetaInterface
import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
public RowMetaInterface createResultRowMetaInterface() {
RowMetaInterface rm = new RowMeta();
ValueMetaInterface[] valuesMeta = {
new ValueMeta("field1", ValueMeta.TYPE_STRING),
new ValueMeta("objectid", ValueMeta.TYPE_STRING),
new ValueMeta("sapident", ValueMeta.TYPE_STRING),
new ValueMeta("quantity", ValueMeta.TYPE_STRING),
new ValueMeta("merkmalname", ValueMeta.TYPE_STRING),
new ValueMeta("merkmalswert", ValueMeta.TYPE_STRING),
};
for (int i = 0; i < valuesMeta.length; i++) {
rm.addValueMeta(valuesMeta[i]);
}
return rm;
}
示例13: getFields
import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
public RowMetaInterface getFields() throws KettleException {
String debug = "get attributes from Geotools datastore";
RowMetaInterface row = new RowMeta();
try {
debug = "allocate data types";
debug = "geometry attribute";
ValueMetaInterface value1 = new ValueMeta("name", ValueMetaInterface.TYPE_STRING);// le champ name issu des placemark
ValueMetaInterface value2 = new ValueMeta("description",
ValueMetaInterface.TYPE_STRING);// le champ description issu des placemark
ValueMetaInterface value3 = new ValueMeta("the_geom", ValueMetaInterface.TYPE_GEOMETRY);// le champ geometry
if (value1 != null)
row.addValueMeta(value1);
if (value2 != null)
row.addValueMeta(value2);
if (value3 != null)
row.addValueMeta(value3);
} catch (Exception e) {
throw new KettleException(
"Error reading KML file metadata (in part " + debug + ")",
e);
}
return row;
}
示例14: getFields
import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的package包/類
public void getFields(RowMetaInterface row, String origin, RowMetaInterface[] info,
StepMeta nextStep, VariableSpace space) throws KettleStepException
{
for (int i=0;i<calculation.length;i++)
{
CalculatorMetaFunction fn = calculation[i];
if (!fn.isRemovedFromResult())
{
if (!Const.isEmpty( fn.getFieldName()) ) // It's a new field!
{
ValueMetaInterface v = getValueMeta(fn, origin);
row.addValueMeta(v);
}
}
}
}
示例15: getFields
import org.pentaho.di.core.row.RowMetaInterface; //導入方法依賴的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);
}
}
}