本文整理汇总了Java中org.pentaho.di.core.Condition.setRightValuename方法的典型用法代码示例。如果您正苦于以下问题:Java Condition.setRightValuename方法的具体用法?Java Condition.setRightValuename怎么用?Java Condition.setRightValuename使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.pentaho.di.core.Condition
的用法示例。
在下文中一共展示了Condition.setRightValuename方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTestObject
import org.pentaho.di.core.Condition; //导入方法依赖的package包/类
@Override
public Condition getTestObject() {
Condition rtn = new Condition();
rtn.setFunction( rand.nextInt( Condition.functions.length ) );
rtn.setLeftValuename( UUID.randomUUID().toString() );
rtn.setNegated( rand.nextBoolean() );
rtn.setOperator( rand.nextInt( Condition.operators.length ) );
rtn.setRightValuename( UUID.randomUUID().toString() );
return rtn;
}
示例2: loadCondition
import org.pentaho.di.core.Condition; //导入方法依赖的package包/类
/**
*
* Read a condition from the repository.
* @param id_condition The condition id
* @throws KettleException if something goes wrong.
*/
public Condition loadCondition(ObjectId id_condition) throws KettleException
{
Condition condition = new Condition();
try
{
RowMetaAndData r = getCondition(id_condition);
if (r!=null)
{
condition.setNegated( r.getBoolean("NEGATED", false));
condition.setOperator( Condition.getOperator( r.getString("OPERATOR", null) ) );
long conditionId = r.getInteger("ID_CONDITION", -1L);
if (conditionId>0) {
condition.setObjectId( new LongObjectId(conditionId) );
} else {
condition.setObjectId( null );
}
ObjectId subids[] = repository.getSubConditionIDs(condition.getObjectId());
if (subids.length==0)
{
condition.setLeftValuename( r.getString("LEFT_NAME", null) );
condition.setFunction( Condition.getFunction( r.getString("CONDITION_FUNCTION", null) ) );
condition.setRightValuename( r.getString("RIGHT_NAME", null) );
long id_value = r.getInteger("ID_VALUE_RIGHT", -1L);
if (id_value>0)
{
ValueMetaAndData v = repository.loadValueMetaAndData( new LongObjectId(id_value) );
condition.setRightExact( v );
}
}
else
{
for (int i=0;i<subids.length;i++)
{
condition.addCondition( loadCondition(subids[i]) );
}
}
return condition;
}
else
{
throw new KettleException("Condition with id_condition="+id_condition+" could not be found in the repository");
}
}
catch(KettleException dbe)
{
throw new KettleException("Error loading condition from the repository (id_condition="+id_condition+")", dbe);
}
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:60,代码来源:KettleDatabaseRepositoryConditionDelegate.java
示例3: testFilterConditionRefersToNonExistingFields
import org.pentaho.di.core.Condition; //导入方法依赖的package包/类
@Test
public void testFilterConditionRefersToNonExistingFields() throws Exception {
KettleEnvironment.init();
// Create a new transformation...
TransMeta transMeta = new TransMeta();
transMeta.setName( "filterrowstest" );
PluginRegistry registry = PluginRegistry.getInstance();
// create an injector step...
String injectorStepname = "injector step";
InjectorMeta im = new InjectorMeta();
// Set the information of the injector.
String injectorPid = registry.getPluginId( StepPluginType.class, im );
StepMeta injectorStep = new StepMeta( injectorPid, injectorStepname, im );
transMeta.addStep( injectorStep );
// Create a filter rows step
String filterStepName = "filter rows step";
FilterRowsMeta frm = new FilterRowsMeta();
Condition condition = new Condition();
String nonExistingFieldName = "non-existing-field";
condition.setLeftValuename( nonExistingFieldName );
condition.setFunction( 8 ); //IS NOT
condition.setRightValuename( null );
condition.setOperator( 0 );
frm.setCondition( condition );
String filterRowsStepPid = registry.getPluginId( StepPluginType.class, frm );
StepMeta filterRowsStep = new StepMeta( filterRowsStepPid, filterStepName, frm );
transMeta.addStep( filterRowsStep );
TransHopMeta hi = new TransHopMeta( injectorStep, filterRowsStep );
transMeta.addTransHop( hi );
// Now execute the transformation
Trans trans = new Trans( transMeta );
trans.prepareExecution( null );
RowProducer rp = trans.addRowProducer( injectorStepname, 0 );
// add rows
List<RowMetaAndData> inputList = createIntegerData();
for ( RowMetaAndData rm : inputList ) {
rp.putRow( rm.getRowMeta(), rm.getData() );
}
rp.finished();
trans.startThreads();
trans.waitUntilFinished();
assertEquals( 1, trans.getErrors() ); //expect errors
}
示例4: loadCondition
import org.pentaho.di.core.Condition; //导入方法依赖的package包/类
/**
*
* Read a condition from the repository.
*
* @param id_condition
* The condition id
* @throws KettleException
* if something goes wrong.
*/
public Condition loadCondition( ObjectId id_condition ) throws KettleException {
Condition condition = new Condition();
try {
RowMetaAndData r = getCondition( id_condition );
if ( r != null ) {
condition.setNegated( r.getBoolean( "NEGATED", false ) );
condition.setOperator( Condition.getOperator( r.getString( "OPERATOR", null ) ) );
long conditionId = r.getInteger( "ID_CONDITION", -1L );
if ( conditionId > 0 ) {
condition.setObjectId( new LongObjectId( conditionId ) );
} else {
condition.setObjectId( null );
}
ObjectId[] subids = repository.getSubConditionIDs( condition.getObjectId() );
if ( subids.length == 0 ) {
condition.setLeftValuename( r.getString( "LEFT_NAME", null ) );
condition.setFunction( Condition.getFunction( r.getString( "CONDITION_FUNCTION", null ) ) );
condition.setRightValuename( r.getString( "RIGHT_NAME", null ) );
long id_value = r.getInteger( "ID_VALUE_RIGHT", -1L );
if ( id_value > 0 ) {
ValueMetaAndData v = repository.loadValueMetaAndData( new LongObjectId( id_value ) );
condition.setRightExact( v );
}
} else {
for ( int i = 0; i < subids.length; i++ ) {
condition.addCondition( loadCondition( subids[i] ) );
}
}
return condition;
} else {
throw new KettleException( "Condition with id_condition="
+ id_condition + " could not be found in the repository" );
}
} catch ( KettleException dbe ) {
throw new KettleException(
"Error loading condition from the repository (id_condition=" + id_condition + ")", dbe );
}
}
示例5: testSearchConditionCase
import org.pentaho.di.core.Condition; //导入方法依赖的package包/类
@Test
public void testSearchConditionCase() {
String dummyStepname = "Output";
DummyTransMeta dummyMeta = new DummyTransMeta();
String dummyStepPid = PluginRegistry.getInstance().getPluginId( StepPluginType.class, dummyMeta );
StepMeta dummyStep = new StepMeta( dummyStepPid, dummyStepname, dummyMeta );
List<StringSearchResult> stringList = new ArrayList<StringSearchResult>();
StringSearcher.findMetaData( dummyStep, 0, stringList, dummyMeta, 0 );
int checkCount = 0;
String aResult = null;
// Check that it found a couple of fields and emits the values properly
for ( int i = 0; i < stringList.size(); i++ ) {
aResult = stringList.get( i ).toString();
if ( aResult.endsWith( "Dummy (stepid)" ) ) {
checkCount++;
} else if ( aResult.endsWith( "Output (name)" ) ) {
checkCount++;
}
if ( checkCount == 2 ) {
break;
}
}
assertEquals( 2, checkCount );
FilterRowsMeta filterRowsMeta = new FilterRowsMeta();
Condition condition = new Condition();
condition.setNegated( false );
condition.setLeftValuename( "wibble_t" );
condition.setRightValuename( "wobble_s" );
condition.setFunction( org.pentaho.di.core.Condition.FUNC_EQUAL );
filterRowsMeta.setDefault();
filterRowsMeta.setCondition( condition );
String filterRowsPluginPid = PluginRegistry.getInstance().getPluginId( StepPluginType.class, filterRowsMeta );
StepMeta filterRowsStep = new StepMeta( filterRowsPluginPid, "Filter Rows", filterRowsMeta );
stringList.clear();
StringSearcher.findMetaData( filterRowsStep, 0, stringList, filterRowsMeta, 0 );
checkCount = 0;
for ( int i = 0; i < stringList.size(); i++ ) {
aResult = stringList.get( i ).toString();
if ( aResult.endsWith( "FilterRows (stepid)" ) ) {
checkCount++;
} else if ( aResult.endsWith( "Filter Rows (name)" ) ) {
checkCount++;
}
if ( checkCount == 2 ) {
break;
}
}
assertEquals( 2, checkCount );
}