• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Condition类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.pentaho.di.core.Condition的典型用法代码示例。如果您正苦于以下问题:Java Condition类的具体用法?Java Condition怎么用?Java Condition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Condition类属于org.pentaho.di.core包,在下文中一共展示了Condition类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: saveCondition

import org.pentaho.di.core.Condition; //导入依赖的package包/类
public ObjectId saveCondition(Condition condition, ObjectId id_condition_parent) throws KettleException
{
	try
	{
		condition.setObjectId( insertCondition( id_condition_parent, condition ) );
		for (int i=0;i<condition.nrConditions();i++)
		{
			Condition subc = condition.getCondition(i);
			repository.saveCondition(subc, condition.getObjectId());
		}
		
		return condition.getObjectId();
	}
	catch(KettleException dbe)
	{
		throw new KettleException("Error saving condition to the repository.", dbe);
	}
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:19,代码来源:KettleDatabaseRepositoryConditionDelegate.java


示例2: testSqlField13Alias_Function

import org.pentaho.di.core.Condition; //导入依赖的package包/类
public void testSqlField13Alias_Function() throws KettleSQLException {
  RowMetaInterface rowMeta = SQLTest.generateTest2RowMeta();
  
  String fieldClause= "IIF( Service.B>50, 'high', 'low' ) as nrSize";
  
  SQLField field = new SQLField("Service", fieldClause, rowMeta);
  assertEquals("IIF( Service.B>50, 'high', 'low' )", field.getName());
  assertEquals("nrSize", field.getAlias());
  assertNull("The service data type was discovered", field.getValueMeta());
  
  assertNotNull(field.getIif());
  Condition condition = field.getIif().getSqlCondition().getCondition();
  assertNotNull(condition);
  assertFalse(condition.isEmpty());
  assertTrue(condition.isAtomic());
  assertEquals("B", condition.getLeftValuename());
  assertEquals(">", condition.getFunctionDesc());
  assertEquals("50", condition.getRightExactString());
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:20,代码来源:SQLFieldTest.java


示例3: test

import org.pentaho.di.core.Condition; //导入依赖的package包/类
@Test
public void test() throws Exception {

  check( "SEND_FALSE_STEP", new StringGetter() {
    public String get() {
      return meta.getFalseStepname();
    }
  } );

  check( "SEND_TRUE_STEP", new StringGetter() {
    public String get() {
      return meta.getTrueStepname();
    }
  } );

  check( "CONDITION", new StringGetter() {
    public String get() {
      return meta.getConditionXML();
    }
  }, new Condition().getXML() );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:22,代码来源:FilterRowsMetaInjectionTest.java


示例4: testIifFunction01

import org.pentaho.di.core.Condition; //导入依赖的package包/类
public void testIifFunction01() throws Exception {
  
  RowMetaInterface serviceFields = generateTestRowMeta();
  
  String conditionClause = "B>5000";
  String trueValueString= "'Big'";
  String falseValueString= "'Small'";

  IifFunction function = new IifFunction("Service", conditionClause, trueValueString, falseValueString, serviceFields);
  assertNotNull(function.getSqlCondition());
  Condition condition = function.getSqlCondition().getCondition();
  assertNotNull(condition);
  assertTrue(condition.isAtomic());
  assertEquals("B", condition.getLeftValuename());
  assertEquals(">", condition.getFunctionDesc());
  assertEquals("5000", condition.getRightExactString());
  
  // test the value data type determination
  //
  assertNotNull(function.getTrueValue());
  assertEquals(ValueMetaInterface.TYPE_STRING, function.getTrueValue().getValueMeta().getType());
  assertEquals("Big", function.getTrueValue().getValueData());
  assertNotNull(function.getFalseValue());
  assertEquals(ValueMetaInterface.TYPE_STRING, function.getFalseValue().getValueMeta().getType());
  assertEquals("Small", function.getFalseValue().getValueData());
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:27,代码来源:IifFunctionTest.java


示例5: createStepMeta1

import org.pentaho.di.core.Condition; //导入依赖的package包/类
protected StepMeta createStepMeta1( final TransMeta transMeta, final DatabaseMeta dbMeta, final Condition condition )
  throws Exception {
  TransStepAttributeTesterTransStep step1 = new TransStepAttributeTesterTransStep();
  step1.setDatabaseMeta( dbMeta );
  step1.setCondition( condition );
  StepMeta stepMeta1 = new StepMeta( EXP_TRANS_STEP_1_NAME, step1 );
  StepErrorMeta stepErrorMeta1 = new StepErrorMeta( transMeta, stepMeta1 );
  stepErrorMeta1.setEnabled( EXP_TRANS_STEP_ERROR_META_1_ENABLED );
  stepErrorMeta1.setNrErrorsValuename( EXP_TRANS_STEP_ERROR_META_1_NR_ERRORS_VALUE_NAME );
  stepErrorMeta1.setErrorDescriptionsValuename( EXP_TRANS_STEP_ERROR_META_1_DESC_VALUE_NAME );
  stepErrorMeta1.setErrorFieldsValuename( EXP_TRANS_STEP_ERROR_META_1_FIELDS_VALUE_NAME );
  stepErrorMeta1.setErrorCodesValuename( EXP_TRANS_STEP_ERROR_META_1_CODES_VALUE_NAME );
  stepErrorMeta1.setMaxErrors( EXP_TRANS_STEP_ERROR_META_1_MAX_ERRORS );
  stepErrorMeta1.setMaxPercentErrors( EXP_TRANS_STEP_ERROR_META_1_MAX_PERCENT_ERRORS );
  stepErrorMeta1.setMinPercentRows( EXP_TRANS_STEP_ERROR_META_1_MIN_PERCENT_ROWS );
  stepMeta1.setStepErrorMeta( stepErrorMeta1 );
  return stepMeta1;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:19,代码来源:RepositoryTestBase.java


示例6: convertAtomicConditionToSql

import org.pentaho.di.core.Condition; //导入依赖的package包/类
private String convertAtomicConditionToSql(Condition atomicCondition) throws KettleValueException {
  StringBuilder sql = new StringBuilder();
  
  String fieldName = atomicCondition.getLeftValuename();
  FieldVariableMapping mapping = FieldVariableMapping.findFieldVariableMappingByFieldName(service.getFieldVariableMappings(), atomicCondition.getLeftValuename());
  if (mapping!=null) {
    fieldName=mapping.getTargetName();
  }
  sql.append(fieldName).append(" ");
  
  switch(atomicCondition.getFunction()) {
  case Condition.FUNC_EQUAL: sql.append("="); break;
  case Condition.FUNC_NOT_EQUAL: sql.append("<>"); break;
  case Condition.FUNC_LARGER: sql.append(">"); break;
  case Condition.FUNC_LARGER_EQUAL: sql.append(">="); break;
  case Condition.FUNC_SMALLER: sql.append("<"); break;
  case Condition.FUNC_SMALLER_EQUAL: sql.append("<="); break;
  case Condition.FUNC_NULL: sql.append("IS NULL"); break;
  case Condition.FUNC_NOT_NULL: sql.append("IS NOT NULL"); break;
  case Condition.FUNC_CONTAINS: sql.append("LIKE"); break;
  }
  sql.append(" ");
  sql.append(getAtomicConditionRightSql(atomicCondition));
  
  return sql.toString();
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:27,代码来源:SqlTransExecutor.java


示例7: convertConditionToJson

import org.pentaho.di.core.Condition; //导入依赖的package包/类
protected String convertConditionToJson(Condition condition) throws KettleValueException {
  if (condition.isAtomic()) {
    return convertAtomicConditionToJson(condition);
  }
  StringBuilder sql = new StringBuilder();
  if (condition.isNegated()) {
    throw new KettleValueException("Negated conditions can't be converted to JSON");
  }

  for (int i=0;i<condition.nrConditions();i++) {
    Condition c = condition.getCondition(i);
    if (i>0) {
      sql.append(", ");
    }
    sql.append(convertConditionToJson(c));
  }
  
  return sql.toString();
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:20,代码来源:SqlTransExecutor.java


示例8: getOrphanFields

import org.pentaho.di.core.Condition; //导入依赖的package包/类
/**
 * Get non-existing referenced input fields
 * @param condition
 * @param prev
 * @return
 */
public List<String> getOrphanFields( Condition condition, RowMetaInterface prev ) {
  List<String> orphans = new ArrayList<String>(  );
  if ( condition == null || prev == null ) {
    return orphans;
  }
  String[] key = condition.getUsedFields();
  for ( int i = 0; i < key.length; i++ ) {
    if ( Utils.isEmpty( key[i] ) ) {
      continue;
    }
    ValueMetaInterface v = prev.searchValueMeta( key[i] );
    if ( v == null ) {
      orphans.add( key[i] );
    }
  }
  return orphans;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:24,代码来源:FilterRowsMeta.java


示例9: testCondition03

import org.pentaho.di.core.Condition; //导入依赖的package包/类
public void testCondition03() throws KettleSQLException {
  RowMetaInterface rowMeta = SQLTest.generateTest4RowMeta();
  
  String fieldsClause= "A, B";
  String conditionClause = "B < 123";
  
  // Correctness of the next statement is tested in SQLFieldsTest
  //
  SQLFields fields = new SQLFields("Service", rowMeta, fieldsClause);

  SQLCondition sqlCondition = new SQLCondition("Service", conditionClause, rowMeta, fields);
  Condition condition = sqlCondition.getCondition();
  
  assertNotNull(condition);
  assertFalse(condition.isEmpty());
  assertTrue(condition.isAtomic());
  assertEquals("B", condition.getLeftValuename());
  assertEquals("<", condition.getFunctionDesc());
  assertEquals("123", condition.getRightExactString());
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:21,代码来源:SQLConditionTest.java


示例10: testCondition04

import org.pentaho.di.core.Condition; //导入依赖的package包/类
public void testCondition04() throws KettleSQLException {
  RowMetaInterface rowMeta = SQLTest.generateTest4RowMeta();
  
  String fieldsClause= "A, B";
  String conditionClause = "B >= 123";
  
  // Correctness of the next statement is tested in SQLFieldsTest
  //
  SQLFields fields = new SQLFields("Service", rowMeta, fieldsClause);

  SQLCondition sqlCondition = new SQLCondition("Service", conditionClause, rowMeta, fields);
  Condition condition = sqlCondition.getCondition();
  
  assertNotNull(condition);
  assertFalse(condition.isEmpty());
  assertTrue(condition.isAtomic());
  assertEquals("B", condition.getLeftValuename());
  assertEquals(">=", condition.getFunctionDesc());
  assertEquals("123", condition.getRightExactString());
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:21,代码来源:SQLConditionTest.java


示例11: testCondition06

import org.pentaho.di.core.Condition; //导入依赖的package包/类
public void testCondition06() throws KettleSQLException {
  RowMetaInterface rowMeta = SQLTest.generateTest4RowMeta();
  
  String fieldsClause= "A, B";
  String conditionClause = "B <= 123";
  
  // Correctness of the next statement is tested in SQLFieldsTest
  //
  SQLFields fields = new SQLFields("Service", rowMeta, fieldsClause);

  SQLCondition sqlCondition = new SQLCondition("Service", conditionClause, rowMeta, fields);
  Condition condition = sqlCondition.getCondition();
  
  assertNotNull(condition);
  assertFalse(condition.isEmpty());
  assertTrue(condition.isAtomic());
  assertEquals("B", condition.getLeftValuename());
  assertEquals("<=", condition.getFunctionDesc());
  assertEquals("123", condition.getRightExactString());
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:21,代码来源:SQLConditionTest.java


示例12: testCondition07

import org.pentaho.di.core.Condition; //导入依赖的package包/类
public void testCondition07() throws KettleSQLException {
  RowMetaInterface rowMeta = SQLTest.generateTest4RowMeta();
  
  String fieldsClause= "A, B";
  String conditionClause = "B >= 123";
  
  // Correctness of the next statement is tested in SQLFieldsTest
  //
  SQLFields fields = new SQLFields("Service", rowMeta, fieldsClause);

  SQLCondition sqlCondition = new SQLCondition("Service", conditionClause, rowMeta, fields);
  Condition condition = sqlCondition.getCondition();
  
  assertNotNull(condition);
  assertFalse(condition.isEmpty());
  assertTrue(condition.isAtomic());
  assertEquals("B", condition.getLeftValuename());
  assertEquals(">=", condition.getFunctionDesc());
  assertEquals("123", condition.getRightExactString());
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:21,代码来源:SQLConditionTest.java


示例13: testSqlField12_Function

import org.pentaho.di.core.Condition; //导入依赖的package包/类
public void testSqlField12_Function() throws KettleSQLException {
  RowMetaInterface rowMeta = SQLTest.generateTest2RowMeta();
  
  String fieldClause= "IIF( B>5000, 'Big', 'Small' ) as \"Sales size\"";
  
  SQLField field = new SQLField("Service", fieldClause, rowMeta);
  assertEquals("IIF( B>5000, 'Big', 'Small' )", field.getName());
  assertEquals("Sales size", field.getAlias());
  assertNull("The service data type was discovered", field.getValueMeta());
  
  assertNotNull(field.getIif());
  Condition condition = field.getIif().getSqlCondition().getCondition();
  assertNotNull(condition);
  assertFalse(condition.isEmpty());
  assertTrue(condition.isAtomic());
  assertEquals("B", condition.getLeftValuename());
  assertEquals(">", condition.getFunctionDesc());
  assertEquals("5000", condition.getRightExactString());
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:20,代码来源:SQLFieldTest.java


示例14: testCondition13

import org.pentaho.di.core.Condition; //导入依赖的package包/类
public void testCondition13() throws KettleSQLException {
  RowMetaInterface rowMeta = SQLTest.generateTest4RowMeta();
  
  String fieldsClause= "A, B";
  String conditionClause = "A LIKE 'foo%'";
  
  // Correctness of the next statement is tested in SQLFieldsTest
  //
  SQLFields fields = new SQLFields("Service", rowMeta, fieldsClause);

  SQLCondition sqlCondition = new SQLCondition("Service", conditionClause, rowMeta, fields);
  Condition condition = sqlCondition.getCondition();
  
  assertNotNull(condition);
  assertFalse(condition.isEmpty());
  assertTrue(condition.isAtomic());
  assertEquals("A", condition.getLeftValuename());
  assertEquals("LIKE", condition.getFunctionDesc());
  assertEquals("foo%", condition.getRightExactString());
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:21,代码来源:SQLConditionTest.java


示例15: testCondition14

import org.pentaho.di.core.Condition; //导入依赖的package包/类
public void testCondition14() throws KettleSQLException {
  RowMetaInterface rowMeta = SQLTest.generateTest4RowMeta();
  
  String fieldsClause= "A, B";
  String conditionClause = "A LIKE 'foo??bar'";
  
  // Correctness of the next statement is tested in SQLFieldsTest
  //
  SQLFields fields = new SQLFields("Service", rowMeta, fieldsClause);

  SQLCondition sqlCondition = new SQLCondition("Service", conditionClause, rowMeta, fields);
  Condition condition = sqlCondition.getCondition();
  
  assertNotNull(condition);
  assertFalse(condition.isEmpty());
  assertTrue(condition.isAtomic());
  assertEquals("A", condition.getLeftValuename());
  assertEquals("LIKE", condition.getFunctionDesc());
  assertEquals("foo??bar", condition.getRightExactString());
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:21,代码来源:SQLConditionTest.java


示例16: splitByOperator

import org.pentaho.di.core.Condition; //导入依赖的package包/类
private int splitByOperator(String clause, Condition parentCondition, String operatorString, int conditionOperator) throws KettleSQLException {
  int lastIndex=0;
  int index=0;
  while ( index<clause.length() && (index = searchForString(clause, operatorString, index))>=0) {
    // Split on the index --> ( clause1 ), ( clause2), (clause 3)
    //
    String left = clause.substring(lastIndex, index);
    splitConditionByOperator(left, parentCondition, conditionOperator);
    index+=operatorString.length();
    lastIndex=index;
  }
  
  // let's not forget to split the last right part or the OR(s)
  //
  if (lastIndex>0) {
    String right = clause.substring(lastIndex);
    splitConditionByOperator(right, parentCondition, conditionOperator);
  }

  
  return lastIndex;
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:23,代码来源:SQLCondition.java


示例17: testCondition20

import org.pentaho.di.core.Condition; //导入依赖的package包/类
public void testCondition20() throws KettleSQLException {
  RowMetaInterface rowMeta = SQLTest.generateTest4RowMeta();
  
  String fieldsClause= "A, B";
  String conditionClause = "NOT ( A = 'FOO' )";
  
  // Correctness of the next statement is tested in SQLFieldsTest
  //
  SQLFields fields = new SQLFields("Service", rowMeta, fieldsClause);

  SQLCondition sqlCondition = new SQLCondition("Service", conditionClause, rowMeta, fields);
  Condition condition = sqlCondition.getCondition();
  
  assertNotNull(condition);
  assertFalse(condition.isEmpty());
  assertTrue(condition.isAtomic());
  assertTrue(condition.isNegated());
  assertEquals("A", condition.getLeftValuename());
  assertEquals("=", condition.getFunctionDesc());
  assertEquals("FOO", condition.getRightExactString());
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:22,代码来源:SQLConditionTest.java


示例18: testSqlField13_Function

import org.pentaho.di.core.Condition; //导入依赖的package包/类
public void testSqlField13_Function() throws KettleSQLException {
  RowMetaInterface rowMeta = SQLTest.generateTest2RowMeta();
  
  String fieldClause= "IIF( B>50, 'high', 'low' ) as nrSize";
  
  SQLField field = new SQLField("Service", fieldClause, rowMeta);
  assertEquals("IIF( B>50, 'high', 'low' )", field.getName());
  assertEquals("nrSize", field.getAlias());
  assertNull("The service data type was discovered", field.getValueMeta());
  
  assertNotNull(field.getIif());
  Condition condition = field.getIif().getSqlCondition().getCondition();
  assertNotNull(condition);
  assertFalse(condition.isEmpty());
  assertTrue(condition.isAtomic());
  assertEquals("B", condition.getLeftValuename());
  assertEquals(">", condition.getFunctionDesc());
  assertEquals("50", condition.getRightExactString());
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:20,代码来源:SQLFieldTest.java


示例19: clone

import org.pentaho.di.core.Condition; //导入依赖的package包/类
public Object clone()
{
	FilterRowsMeta retval = (FilterRowsMeta)super.clone();

	if (condition!=null)
       {
           retval.condition = (Condition)condition.clone();
       }
       else 
       {
           retval.condition=null;
       }

	return retval;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:16,代码来源:FilterRowsMeta.java


示例20: FilterRowsDialog

import org.pentaho.di.core.Condition; //导入依赖的package包/类
public FilterRowsDialog(Shell parent, Object in, TransMeta tr, String sname)
{
	super(parent, (BaseStepMeta)in, tr, sname);
	input=(FilterRowsMeta)in;
       
       condition = (Condition)input.getCondition().clone();

   }
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:9,代码来源:FilterRowsDialog.java



注:本文中的org.pentaho.di.core.Condition类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EntityFishingHook类代码示例发布时间:2022-05-22
下一篇:
Java PreparedSentence类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap