Package it.eng.qbe.statement.jpa.JPQLStatementConditionalOperators

Examples of it.eng.qbe.statement.jpa.JPQLStatementConditionalOperators.IConditionalOperator


    String[] leftOperandElements;
       
    logger.debug("IN");
   
    try {
      IConditionalOperator conditionalOperator = null;
      conditionalOperator = (IConditionalOperator)JPQLStatementConditionalOperators.getOperator( whereField.getOperator() );
      Assert.assertNotNull(conditionalOperator, "Unsopported operator " + whereField.getOperator() + " used in query definition");
     
      if(whereField.getLeftOperand().values[0].contains("expression")){
        whereClauseElement = buildInLineCalculatedFieldClause(whereField.getOperator(), whereField.getLeftOperand(), whereField.isPromptable(), whereField.getRightOperand(), query, entityAliasesMaps, conditionalOperator);
      }else{
       
        leftOperandElements = buildOperand(whereField.getLeftOperand(), query, entityAliasesMaps);
       
        if (OPERAND_TYPE_STATIC.equalsIgnoreCase(whereField.getRightOperand().type)
            && whereField.isPromptable()) {
          // get last value first (the last value edited by the user)
          rightOperandElements = whereField.getRightOperand().lastValues;
        } else {
         
          rightOperandElements = buildOperand(whereField.getRightOperand(), query, entityAliasesMaps);
        }
       
        if (OPERAND_TYPE_STATIC.equalsIgnoreCase(whereField.getLeftOperand().type) )  {
          leftOperandElements = getTypeBoundedStaticOperand(whereField.getRightOperand(), whereField.getOperator(), leftOperandElements);
        }
       
        if (OPERAND_TYPE_STATIC.equalsIgnoreCase(whereField.getRightOperand().type) )  {
          rightOperandElements = getTypeBoundedStaticOperand(whereField.getLeftOperand(), whereField.getOperator(), rightOperandElements);
        }
       
        whereClauseElement = conditionalOperator.apply(leftOperandElements[0], rightOperandElements);
      }
     
      logger.debug("where element value [" + whereClauseElement + "]");
    } finally {
      logger.debug("OUT");
View Full Code Here


      Iterator it = query.getHavingFields().iterator();
      while (it.hasNext()) {
        HavingField field = (HavingField) it.next();
               
        if(field.getLeftOperand().values[0].contains("expression")){
          IConditionalOperator conditionalOperator = null;
          conditionalOperator = (IConditionalOperator)JPQLStatementConditionalOperators.getOperator( field.getOperator() );
          Assert.assertNotNull(conditionalOperator, "Unsopported operator " + field.getOperator() + " used in query definition");

          String havingClauseElement =  buildInLineCalculatedFieldClause(field.getOperator(), field.getLeftOperand(), field.isPromptable(), field.getRightOperand(), query, entityAliasesMaps, conditionalOperator);
          buffer.append(havingClauseElement);
View Full Code Here

    String[] rightOperandElements;
       
    logger.debug("IN");
   
    try {
      IConditionalOperator conditionalOperator = null;
      conditionalOperator = (IConditionalOperator)JPQLStatementConditionalOperators.getOperator( havingField.getOperator() );
      Assert.assertNotNull(conditionalOperator, "Unsopported operator " + havingField.getOperator() + " used in query definition");
     
      leftOperandElements = buildOperand(havingField.getLeftOperand(), query, entityAliasesMaps);
     
      if (OPERAND_TYPE_STATIC.equalsIgnoreCase(havingField.getRightOperand().type)
          && havingField.isPromptable()) {
        // get last value first (the last value edited by the user)
        rightOperandElements = havingField.getRightOperand().lastValues;
      } else {
        rightOperandElements = buildOperand(havingField.getRightOperand(), query, entityAliasesMaps);
      }
     
      if (OPERAND_TYPE_STATIC.equalsIgnoreCase(havingField.getLeftOperand().type) )  {
        leftOperandElements = getTypeBoundedStaticOperand(havingField.getRightOperand(), havingField.getOperator(), leftOperandElements);
      }
     
      if (OPERAND_TYPE_STATIC.equalsIgnoreCase(havingField.getRightOperand().type) )  {
        rightOperandElements = getTypeBoundedStaticOperand(havingField.getLeftOperand(), havingField.getOperator(), rightOperandElements);
      }
     
      havingClauseElement = conditionalOperator.apply(leftOperandElements[0], rightOperandElements);
      logger.debug("Having clause element value [" + havingClauseElement + "]");
    } finally {
      logger.debug("OUT");
    }
   
View Full Code Here

    // per il momento metto le join anche se non ce n'� bisogno
    for(String viewName : viewToInnerEntitiesMap.keySet()) {
      ModelViewEntity view = (ModelViewEntity)getDataSource().getModelStructure().getEntity( viewName );
      List<Join> joins = view.getJoins();
      for(Join join : joins) {
        IConditionalOperator conditionalOperator = null;
        conditionalOperator = (IConditionalOperator)JPQLStatementConditionalOperators.getOperator( CriteriaConstants.EQUALS_TO );
       
        String sourceEntityAlias = (String)entityAliases.get(join.getSourceEntity().getUniqueName());
        if(sourceEntityAlias == null) {
          sourceEntityAlias = getNextAlias(entityAliasesMaps);
          entityAliases.put(join.getSourceEntity().getUniqueName(), sourceEntityAlias);
        }
        String destinationEntityAlias = (String)entityAliases.get(join.getDestinationEntity().getUniqueName());
        if(destinationEntityAlias == null) {
          destinationEntityAlias = getNextAlias(entityAliasesMaps);
          entityAliases.put(join.getDestinationEntity().getUniqueName(), destinationEntityAlias);
        }
       
        for(int i = 0; i < join.getSourceFileds().size(); i++) {
          IModelField sourceField = join.getSourceFileds().get(i);
          IModelField destinationField = join.getDestinationFileds().get(i);
          String sourceFieldName = (String)sourceField.getQueryName().getFirst();
          String destinationFieldName = (String)destinationField.getQueryName().getFirst();
         
          String leftHandValue = sourceEntityAlias + "." + sourceFieldName;
          String rightHandValues = destinationEntityAlias + "." + destinationFieldName;
         
          String filterCondition = conditionalOperator.apply(leftHandValue, new String[]{rightHandValues});
         
          if(filterCondition != null) {
            if(buffer.toString().length() > 0) {
              buffer.append(" AND ");
            } else {
View Full Code Here

TOP

Related Classes of it.eng.qbe.statement.jpa.JPQLStatementConditionalOperators.IConditionalOperator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.