Package it.eng.qbe.query

Examples of it.eng.qbe.query.CalculatedSelectField


            } else {
              nature = QuerySerializationConstants.FIELD_NATURE_ATTRIBUTE;
            }
           
          } else if (field.isCalculatedField()){
            CalculatedSelectField calculatedSelectField = (CalculatedSelectField)field;
           
            fieldJSON.put(QuerySerializationConstants.FIELD_TYPE, field.CALCULATED_FIELD);
           
            JSONObject fieldClaculationDescriptor = new JSONObject();
            fieldClaculationDescriptor.put(QuerySerializationConstants.FIELD_TYPE, calculatedSelectField.getType());
            fieldClaculationDescriptor.put(QuerySerializationConstants.FIELD_EXPRESSION, calculatedSelectField.getExpression());
            fieldJSON.put(QuerySerializationConstants.FIELD_ID, fieldClaculationDescriptor);
           
            fieldJSON.put(QuerySerializationConstants.FIELD_ICON_CLS, "calculation");
           
            nature = QuerySerializationConstants.FIELD_NATURE_POST_LINE_CALCULATED;
           
          } else if (field.isInLineCalculatedField()) {
            InLineCalculatedSelectField calculatedSelectField = (InLineCalculatedSelectField)field;
           
            fieldJSON.put(QuerySerializationConstants.FIELD_TYPE, field.IN_LINE_CALCULATED_FIELD);
           
            JSONObject fieldClaculationDescriptor = new JSONObject();
            fieldClaculationDescriptor.put(QuerySerializationConstants.FIELD_ALIAS, calculatedSelectField.getAlias());
            fieldClaculationDescriptor.put(QuerySerializationConstants.FIELD_TYPE, calculatedSelectField.getType());
            fieldClaculationDescriptor.put(QuerySerializationConstants.FIELD_EXPRESSION, calculatedSelectField.getExpression());
            fieldJSON.put(QuerySerializationConstants.FIELD_ID, fieldClaculationDescriptor);
            fieldJSON.put(QuerySerializationConstants.FIELD_LONG_DESCRIPTION, calculatedSelectField.getExpression());

            if ( calculatedSelectField.isGroupByField() ) {
              fieldJSON.put(QuerySerializationConstants.FIELD_GROUP, "true");
            } else {
              fieldJSON.put(QuerySerializationConstants.FIELD_GROUP, "");
            }
           
            fieldJSON.put(QuerySerializationConstants.FIELD_AGGREGATION_FUNCTION, calculatedSelectField.getFunction().getName());
            fieldJSON.put(QuerySerializationConstants.FIELD_ORDER, calculatedSelectField.getOrderType());
           
            //fieldJSON.put(SerializationConstants.FIELD_GROUP, "");
            fieldJSON.put(QuerySerializationConstants.FIELD_ORDER, "");
            //fieldJSON.put(SerializationConstants.FIELD_AGGREGATION_FUNCTION, "");
           
            fieldJSON.put(QuerySerializationConstants.FIELD_ICON_CLS, "calculation");
           
            /*
             * We should understand if the calculated field is an attribute (i.e. a composition of attributes)
             * or a measure (i.e. a composition of measures).
             * The easiest way to understand this it to see if it is a grouping field.
             * TODO manage queries without any aggregation and grouping.
             * At the time being this information is used only in crosstab definition, and crosstab base query SHOULD
             * make aggregation.
             */
            if ( calculatedSelectField.isGroupByField() ) {
              nature = QuerySerializationConstants.FIELD_NATURE_ATTRIBUTE;
            } else {
              nature = QuerySerializationConstants.FIELD_NATURE_MEASURE;
            }
           
View Full Code Here


        String format = dataMartSelectField.getPattern();
        if (format != null && !format.trim().equals("")) {
          dataStoreFieldMeta.setProperty("format", format);
        }
      } else if(queryFiled.isCalculatedField()){
        CalculatedSelectField claculatedQueryField = (CalculatedSelectField)queryFiled;
        dataStoreFieldMeta.setName(claculatedQueryField.getAlias());
        dataStoreFieldMeta.setProperty("calculated", new Boolean(true))
        // FIXME also calculated field must have uniquename for uniformity
        dataStoreFieldMeta.setProperty("uniqueName", claculatedQueryField.getAlias());
        DataSetVariable variable = new DataSetVariable(claculatedQueryField.getAlias(), claculatedQueryField.getType(), claculatedQueryField.getExpression());
        dataStoreFieldMeta.setProperty("variable", variable)
        dataStoreFieldMeta.setType( variable.getTypeClass() )
       
      } else if(queryFiled.isInLineCalculatedField()){
        InLineCalculatedSelectField claculatedQueryField = (InLineCalculatedSelectField)queryFiled;
        dataStoreFieldMeta.setName(claculatedQueryField.getAlias());
        dataStoreFieldMeta.setProperty("calculated", new Boolean(false))
        // FIXME also calculated field must have uniquename for uniformity
        dataStoreFieldMeta.setProperty("uniqueName", claculatedQueryField.getAlias());
        DataSetVariable variable = new DataSetVariable(claculatedQueryField.getAlias(), claculatedQueryField.getType(), claculatedQueryField.getExpression());
        dataStoreFieldMeta.setProperty("variable", variable)
        dataStoreFieldMeta.setType( variable.getTypeClass() )
       
      }
      dataStoreFieldMeta.setProperty("visible", new Boolean(queryFiled.isVisible()))
View Full Code Here

TOP

Related Classes of it.eng.qbe.query.CalculatedSelectField

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.