本文整理汇总了Java中org.pentaho.di.core.row.value.ValueMetaString类的典型用法代码示例。如果您正苦于以下问题:Java ValueMetaString类的具体用法?Java ValueMetaString怎么用?Java ValueMetaString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ValueMetaString类属于org.pentaho.di.core.row.value包,在下文中一共展示了ValueMetaString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getValueMetaInterface
import org.pentaho.di.core.row.value.ValueMetaString; //导入依赖的package包/类
private ValueMetaInterface getValueMetaInterface( String fieldName, int fieldType ) {
switch ( fieldType ) {
case ValueMetaInterface.TYPE_INET:
return new ValueMetaInternetAddress( fieldName );
case ValueMetaInterface.TYPE_STRING:
return new ValueMetaString( fieldName );
case ValueMetaInterface.TYPE_INTEGER:
return new ValueMetaInteger( fieldName );
case ValueMetaInterface.TYPE_NUMBER:
return new ValueMetaNumber( fieldName );
case ValueMetaInterface.TYPE_BIGNUMBER:
return new ValueMetaBigNumber( fieldName );
case ValueMetaInterface.TYPE_TIMESTAMP:
return new ValueMetaTimestamp( fieldName );
case ValueMetaInterface.TYPE_DATE:
return new ValueMetaDate( fieldName );
case ValueMetaInterface.TYPE_BOOLEAN:
return new ValueMetaBoolean( fieldName );
case ValueMetaInterface.TYPE_BINARY:
return new ValueMetaBinary( fieldName );
}
return null;
}
示例2: testServerReturnsCorrectlyEncodedParams
import org.pentaho.di.core.row.value.ValueMetaString; //导入依赖的package包/类
public void testServerReturnsCorrectlyEncodedParams( String testString, String testCharset ) throws Exception {
AtomicBoolean testStatus = new AtomicBoolean();
startHttpServer( getEncodingCheckingHandler( testString, testCharset, testStatus ) );
HTTPPOSTData data = new HTTPPOSTData();
RowMeta meta = new RowMeta();
meta.addValueMeta( new ValueMetaString( "fieldName" ) );
HTTPPOSTHandler httpPost = new HTTPPOSTHandler(
stepMockHelper.stepMeta, data, 0, stepMockHelper.transMeta, stepMockHelper.trans, false );
RowMetaInterface inputRowMeta = mock( RowMetaInterface.class );
httpPost.setInputRowMeta( inputRowMeta );
httpPost.row = new Object[] { testString };
when( inputRowMeta.clone() ).thenReturn( inputRowMeta );
when( inputRowMeta.getString( httpPost.row, 0 ) ).thenReturn( testString );
when( stepMockHelper.processRowsStepMetaInterface.getUrl() ).thenReturn( HTTP_LOCALHOST_9998 );
when( stepMockHelper.processRowsStepMetaInterface.getQueryField() ).thenReturn( new String[] {} );
when( stepMockHelper.processRowsStepMetaInterface.getArgumentField() )
.thenReturn( new String[] { "testBodyField" } );
when( stepMockHelper.processRowsStepMetaInterface.getArgumentParameter() )
.thenReturn( new String[] { "testBodyParam" } );
when( stepMockHelper.processRowsStepMetaInterface.getArgumentHeader() ).thenReturn( new boolean[] { false } );
when( stepMockHelper.processRowsStepMetaInterface.getFieldName() ).thenReturn( "ResultFieldName" );
when( stepMockHelper.processRowsStepMetaInterface.getEncoding() ).thenReturn( testCharset );
httpPost.init( stepMockHelper.processRowsStepMetaInterface, data );
Assert.assertTrue( httpPost.processRow( stepMockHelper.processRowsStepMetaInterface, data ) );
Assert.assertTrue( testStatus.get(), "Test failed" );
}
示例3: getFields
import org.pentaho.di.core.row.value.ValueMetaString; //导入依赖的package包/类
@Override
public void getFields( RowMetaInterface r, String name, RowMetaInterface[] info, StepMeta nextStep,
VariableSpace space, Repository repository, IMetaStore metaStore ) throws KettleStepException {
// We don't have any input fields here in "r" as they are all info fields.
// So we just merge in the info fields.
//
if ( info != null ) {
boolean found = false;
for ( int i = 0; i < info.length && !found; i++ ) {
if ( info[i] != null ) {
r.mergeRowMeta( info[i], name );
found = true;
}
}
}
if ( Utils.isEmpty( flagField ) ) {
throw new KettleStepException( BaseMessages.getString( PKG, "MergeRowsMeta.Exception.FlagFieldNotSpecified" ) );
}
ValueMetaInterface flagFieldValue = new ValueMetaString( flagField );
flagFieldValue.setOrigin( name );
r.addValueMeta( flagFieldValue );
}
示例4: testWriteToSalesForceForNotNullExtIdField_WithExtIdYES
import org.pentaho.di.core.row.value.ValueMetaString; //导入依赖的package包/类
@Test
public void testWriteToSalesForceForNotNullExtIdField_WithExtIdYES() throws Exception {
SalesforceInsert sfInputStep =
new SalesforceInsert( smh.stepMeta, smh.stepDataInterface, 0, smh.transMeta, smh.trans );
SalesforceInsertMeta meta =
generateSalesforceInsertMeta( new String[] { ACCOUNT_EXT_ID_ACCOUNT_ID_C_ACCOUNT }, new Boolean[] { true } );
SalesforceInsertData data = generateSalesforceInsertData();
sfInputStep.init( meta, data );
RowMeta rowMeta = new RowMeta();
ValueMetaBase valueMeta = new ValueMetaString( "AccExtId" );
rowMeta.addValueMeta( valueMeta );
smh.initStepDataInterface.inputRowMeta = rowMeta;
sfInputStep.writeToSalesForce( new Object[] { "tkas88" } );
assertEquals( 0, data.sfBuffer[0].getFieldsToNull().length );
assertEquals( 1, SalesforceConnection.getChildren( data.sfBuffer[0] ).length );
assertEquals( Constants.PARTNER_SOBJECT_NS,
SalesforceConnection.getChildren( data.sfBuffer[0] )[0].getName().getNamespaceURI() );
assertEquals( "Account", SalesforceConnection.getChildren( data.sfBuffer[0] )[0].getName().getLocalPart() );
assertNull( SalesforceConnection.getChildren( data.sfBuffer[0] )[0].getValue() );
assertFalse( SalesforceConnection.getChildren( data.sfBuffer[0] )[0].hasChildren() );
}
示例5: createRowMetaInterface
import org.pentaho.di.core.row.value.ValueMetaString; //导入依赖的package包/类
public 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 ( int i = 0; i < valuesMeta.length; i++ ) {
rm.addValueMeta( valuesMeta[i] );
}
return rm;
}
示例6: testWriteToSalesForceForNullExtIdField_WithExtIdNO
import org.pentaho.di.core.row.value.ValueMetaString; //导入依赖的package包/类
@Test
public void testWriteToSalesForceForNullExtIdField_WithExtIdNO() throws Exception {
SalesforceInsert sfInputStep =
new SalesforceInsert( smh.stepMeta, smh.stepDataInterface, 0, smh.transMeta, smh.trans );
SalesforceInsertMeta meta = generateSalesforceInsertMeta( new String[] { ACCOUNT_ID }, new Boolean[] { false } );
SalesforceInsertData data = generateSalesforceInsertData();
sfInputStep.init( meta, data );
RowMeta rowMeta = new RowMeta();
ValueMetaBase valueMeta = new ValueMetaString( "AccNoExtId" );
rowMeta.addValueMeta( valueMeta );
smh.initStepDataInterface.inputRowMeta = rowMeta;
sfInputStep.writeToSalesForce( new Object[] { null } );
assertEquals( 1, data.sfBuffer[0].getFieldsToNull().length );
assertEquals( ACCOUNT_ID, data.sfBuffer[0].getFieldsToNull()[0] );
assertNull( SalesforceConnection.getChildren( data.sfBuffer[0] ) );
}
示例7: test204Answer
import org.pentaho.di.core.row.value.ValueMetaString; //导入依赖的package包/类
@Test
public void test204Answer() throws Exception {
startHttpServer( get204AnswerHandler() );
HTTPData data = new HTTPData();
int[] index = { 0, 1 };
RowMeta meta = new RowMeta();
meta.addValueMeta( new ValueMetaString( "fieldName" ) );
meta.addValueMeta( new ValueMetaInteger( "codeFieldName" ) );
Object[] expectedRow = new Object[] { "", 204L };
HTTP http =
new HTTPHandler( stepMockHelper.stepMeta, data, 0, stepMockHelper.transMeta, stepMockHelper.trans, false );
RowMetaInterface inputRowMeta = mock( RowMetaInterface.class );
http.setInputRowMeta( inputRowMeta );
when( inputRowMeta.clone() ).thenReturn( inputRowMeta );
when( stepMockHelper.processRowsStepMetaInterface.getUrl() ).thenReturn( HTTP_LOCALHOST_9998 );
when( stepMockHelper.processRowsStepMetaInterface.getHeaderField() ).thenReturn( new String[] {} );
when( stepMockHelper.processRowsStepMetaInterface.getArgumentField() ).thenReturn( new String[] {} );
when( stepMockHelper.processRowsStepMetaInterface.getResultCodeFieldName() ).thenReturn( "ResultCodeFieldName" );
when( stepMockHelper.processRowsStepMetaInterface.getFieldName() ).thenReturn( "ResultFieldName" );
http.init( stepMockHelper.processRowsStepMetaInterface, data );
Assert.assertTrue( http.processRow( stepMockHelper.processRowsStepMetaInterface, data ) );
Object[] out = ( (HTTPHandler) http ).getOutputRow();
Assert.assertTrue( meta.equals( out, expectedRow, index ) );
}
示例8: getTransAttributes
import org.pentaho.di.core.row.value.ValueMetaString; //导入依赖的package包/类
public synchronized List<Object[]> getTransAttributes( ObjectId id_transformation, String code, long nr ) throws KettleException {
String sql =
"SELECT *"
+ " FROM "
+ databaseMeta
.getQuotedSchemaTableCombination( null, KettleDatabaseRepository.TABLE_R_TRANS_ATTRIBUTE )
+ " WHERE " + quote( KettleDatabaseRepository.FIELD_TRANS_ATTRIBUTE_ID_TRANSFORMATION ) + " = ? AND "
+ quote( KettleDatabaseRepository.FIELD_TRANS_ATTRIBUTE_CODE ) + " = ? AND "
+ quote( KettleDatabaseRepository.FIELD_TRANS_ATTRIBUTE_NR ) + " = ?" + " ORDER BY "
+ quote( KettleDatabaseRepository.FIELD_TRANS_ATTRIBUTE_VALUE_NUM );
RowMetaAndData table = new RowMetaAndData();
table.addValue(
new ValueMetaInteger(
KettleDatabaseRepository.FIELD_TRANS_ATTRIBUTE_ID_TRANSFORMATION ),
new LongObjectId( id_transformation ) );
table.addValue( new ValueMetaString(
KettleDatabaseRepository.FIELD_TRANS_ATTRIBUTE_CODE ), code );
table.addValue( new ValueMetaInteger(
KettleDatabaseRepository.FIELD_TRANS_ATTRIBUTE_NR ), new Long( nr ) );
return callRead( () -> database.getRows( sql, table.getRowMeta(), table.getData(), ResultSet.FETCH_FORWARD, false, 0, null ) );
}
示例9: insertNamespace
import org.pentaho.di.core.row.value.ValueMetaString; //导入依赖的package包/类
public ObjectId insertNamespace( String namespace ) throws KettleException {
ObjectId idNamespace =
repository.connectionDelegate.getNextID(
quoteTable( KettleDatabaseRepository.TABLE_R_NAMESPACE ),
quote( KettleDatabaseRepository.FIELD_NAMESPACE_ID_NAMESPACE ) );
RowMetaAndData table = new RowMetaAndData();
table.addValue( new ValueMetaInteger(
KettleDatabaseRepository.FIELD_NAMESPACE_ID_NAMESPACE ), idNamespace );
table.addValue(
new ValueMetaString( KettleDatabaseRepository.FIELD_NAMESPACE_NAME ), namespace );
repository.connectionDelegate.getDatabase().prepareInsert(
table.getRowMeta(), KettleDatabaseRepository.TABLE_R_NAMESPACE );
repository.connectionDelegate.getDatabase().setValuesInsert( table );
repository.connectionDelegate.getDatabase().insertRow();
repository.connectionDelegate.getDatabase().closeInsert();
if ( log.isDebug() ) {
log.logDebug( "Saved namespace [" + namespace + "]" );
}
return idNamespace;
}
示例10: getJobAttributeRow
import org.pentaho.di.core.row.value.ValueMetaString; //导入依赖的package包/类
public RowMetaAndData getJobAttributeRow( ObjectId id_job, int nr, String code ) throws KettleException {
RowMetaAndData par = new RowMetaAndData();
par.addValue( new ValueMetaInteger(
KettleDatabaseRepository.FIELD_JOB_ATTRIBUTE_ID_JOB ), id_job );
par.addValue(
new ValueMetaString( KettleDatabaseRepository.FIELD_JOB_ATTRIBUTE_CODE ), code );
par.addValue(
new ValueMetaInteger( KettleDatabaseRepository.FIELD_JOB_ATTRIBUTE_NR ),
new Long( nr ) );
if ( psJobAttributesLookup == null ) {
setLookupJobAttribute();
}
database.setValues( par, psJobAttributesLookup );
return callRead( new Callable<RowMetaAndData>() {
@Override public RowMetaAndData call() throws Exception {
Object[] r = database.getLookup( psJobAttributesLookup );
if ( r == null ) {
return null;
}
return new RowMetaAndData( database.getReturnRowMeta(), r );
}
} );
}
示例11: createTargetRowMetaInterface
import org.pentaho.di.core.row.value.ValueMetaString; //导入依赖的package包/类
public RowMetaInterface createTargetRowMetaInterface() {
RowMetaInterface rm = new RowMeta();
ValueMetaInterface[] valuesMeta =
{
new ValueMetaInteger( "ID", 8, 0 ),
new ValueMetaString( "DLR_CD", 8, 0 ),
new ValueMetaString( "DLR_NM", 30, 0 ),
new ValueMetaString( "DLR_DESC", 30, 0 ), };
for ( int i = 0; i < valuesMeta.length; i++ ) {
rm.addValueMeta( valuesMeta[i] );
}
return rm;
}
示例12: createRowMetaInterface
import org.pentaho.di.core.row.value.ValueMetaString; //导入依赖的package包/类
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;
}
示例13: init
import org.pentaho.di.core.row.value.ValueMetaString; //导入依赖的package包/类
public boolean init( StepMetaInterface stepMetaInterface, StepDataInterface stepDataInterface ) {
super.init( stepMetaInterface, stepDataInterface );
Preconditions.checkNotNull( stepMetaInterface );
fileStreamMeta = (FileStreamMeta) stepMetaInterface;
String sourceFile = getFilePath( fileStreamMeta.getSourcePath() );
RowMeta rowMeta = new RowMeta();
rowMeta.addValueMeta( new ValueMetaString( "line" ) );
window = new FixedTimeStreamWindow<>( subtransExecutor, rowMeta, getDuration(), getBatchSize() );
try {
source = new TailFileStreamSource( sourceFile, this );
} catch ( FileNotFoundException e ) {
logError( e.getLocalizedMessage(), e );
return false;
}
return true;
}
示例14: createRowMetaInterfaceResult1
import org.pentaho.di.core.row.value.ValueMetaString; //导入依赖的package包/类
/**
* Create the meta data for the results (ltrim/rtrim/trim).
*/
public RowMetaInterface createRowMetaInterfaceResult1() {
RowMetaInterface rm = new RowMeta();
ValueMetaInterface[] valuesMeta =
{
new ValueMetaString( "string" ), new ValueMetaString( "original" ),
new ValueMetaString( "ltrimStr" ),
new ValueMetaString( "rtrimStr" ), new ValueMetaString( "trimStr" ), };
for ( int i = 0; i < valuesMeta.length; i++ ) {
rm.addValueMeta( valuesMeta[ i ] );
}
return rm;
}
示例15: moveTransformation
import org.pentaho.di.core.row.value.ValueMetaString; //导入依赖的package包/类
public synchronized void moveTransformation( String transname, ObjectId id_directory_from,
ObjectId id_directory_to ) throws KettleException {
String nameField = quote( KettleDatabaseRepository.FIELD_TRANSFORMATION_NAME );
String sql =
"UPDATE "
+ quoteTable( KettleDatabaseRepository.TABLE_R_TRANSFORMATION ) + " SET "
+ quote( KettleDatabaseRepository.FIELD_TRANSFORMATION_ID_DIRECTORY ) + " = ? WHERE " + nameField
+ " = ? AND " + quote( KettleDatabaseRepository.FIELD_TRANSFORMATION_ID_DIRECTORY ) + " = ?";
RowMetaAndData par = new RowMetaAndData();
par
.addValue(
new ValueMetaInteger(
KettleDatabaseRepository.FIELD_TRANSFORMATION_ID_DIRECTORY ),
id_directory_to );
par.addValue( new ValueMetaString(
KettleDatabaseRepository.FIELD_TRANSFORMATION_NAME ), transname );
par
.addValue(
new ValueMetaInteger(
KettleDatabaseRepository.FIELD_TRANSFORMATION_ID_DIRECTORY ),
id_directory_from );
repository.connectionDelegate.getDatabase().execStatement( sql, par.getRowMeta(), par.getData() );
}