当前位置: 首页>>代码示例>>Java>>正文


Java Condition.FUNC_LARGER_EQUAL属性代码示例

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


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

示例1: convertAtomicConditionToSql

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,代码行数:26,代码来源:SqlTransExecutor.java

示例2: convertAtomicConditionToJson

private String convertAtomicConditionToJson(Condition atomicCondition) throws KettleValueException {
  StringBuilder sql = new StringBuilder();
  
  if (atomicCondition.getRightValuename()!=null) {
    throw new KettleValueException("Converting a condition that compares 2 fields is not yet supported in a JSON query");
  }
  
  String fieldName = atomicCondition.getLeftValuename();
  FieldVariableMapping mapping = FieldVariableMapping.findFieldVariableMappingByFieldName(service.getFieldVariableMappings(), atomicCondition.getLeftValuename());
  if (mapping!=null) {
    fieldName=mapping.getTargetName();
  }
  
  switch(atomicCondition.getFunction()) {
  case Condition.FUNC_EQUAL: sql.append("'").append(fieldName).append("' : ").append(getJsonString(atomicCondition.getRightExact())); break;
  case Condition.FUNC_NOT_EQUAL: sql.append("'").append(fieldName).append("' : { '$ne' : ").append(getJsonString(atomicCondition.getRightExact())).append(" }"); break;
  case Condition.FUNC_LARGER: sql.append(">"); sql.append("'").append(fieldName).append("' : { '$gt' : ").append(getJsonString(atomicCondition.getRightExact())).append(" }"); break;
  case Condition.FUNC_LARGER_EQUAL: sql.append(">"); sql.append("'").append(fieldName).append("' : { '$gte' : ").append(getJsonString(atomicCondition.getRightExact())).append(" }"); break;
  case Condition.FUNC_SMALLER: sql.append("<"); sql.append(">"); sql.append("'").append(fieldName).append("' : { '$lt' : ").append(getJsonString(atomicCondition.getRightExact())).append(" }"); break;
  case Condition.FUNC_SMALLER_EQUAL: sql.append("<="); sql.append(">"); sql.append("'").append(fieldName).append("' : { '$lte' : ").append(getJsonString(atomicCondition.getRightExact())).append(" }"); break;
  case Condition.FUNC_NULL: sql.append("IS NULL"); sql.append(">"); sql.append("'").append(fieldName).append("' : \"\""); break;
  case Condition.FUNC_NOT_NULL: sql.append("'").append(fieldName).append("' : { '$ne' : ").append("\"\"").append(" }"); break;
  case Condition.FUNC_CONTAINS: sql.append("'").append(fieldName).append("' : { '$regex' : '.*").append(atomicCondition.getRightExactString()).append(".*', '$options' : 'i' }"); break;
  }
  
  return sql.toString();
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:27,代码来源:SqlTransExecutor.java

示例3: splitConditionClause

/**
 * We need to split conditions on a single operator (for now)
 * 
 * @param clause
 * @return 3 string list (left, operator, right)
 * @throws KettleSQLException 
 */
private List<String> splitConditionClause(String clause) throws KettleSQLException {
  List<String> strings = new ArrayList<String>();
  
  String[] operators = new String[] { "<>", ">=", "=>", "<=", "=<", "<", ">", "=", " REGEX ", " IN ", " IS NOT NULL", " IS NULL", " LIKE", "CONTAINS " }; 
  int[] functions = new int[] { 
      Condition.FUNC_NOT_EQUAL,
      Condition.FUNC_LARGER_EQUAL,
      Condition.FUNC_LARGER_EQUAL,
      Condition.FUNC_SMALLER_EQUAL,
      Condition.FUNC_SMALLER_EQUAL,
      Condition.FUNC_SMALLER, 
      Condition.FUNC_LARGER,
      Condition.FUNC_EQUAL,
      Condition.FUNC_REGEXP,
      Condition.FUNC_IN_LIST,
      Condition.FUNC_NOT_NULL,
      Condition.FUNC_NULL,
      Condition.FUNC_LIKE,
      Condition.FUNC_CONTAINS,
    };
  int index=0;
  while (index<clause.length()) {
    index = ThinUtil.skipChars(clause, index, '\'', '"' );
    for (String operator : operators) {
      if (index<=clause.length()-operator.length()) {
        if (clause.substring(index).toUpperCase().startsWith(operator)) {
          int functionIndex = Const.indexOfString(operator, operators);
          
          // OK, we found an operator.
          // The part before is the first string
          //
          String left = Const.trim(clause.substring(0, index));
          String op = Condition.functions[functions[functionIndex]];
          String right = Const.trim(clause.substring(index+operator.length()));
          strings.add(left);
          strings.add(op);
          strings.add(right);
          return strings;
        }
      }
    }
    index++;
  }
  
  return strings;
}
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:53,代码来源:SQLCondition.java


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