public static void addParameterBinding(
      QueryDefinition queryDefn, AbstractScalarParameterHandle parameter, IModelAdapter adapter)
      throws DataException {
    String labelColumnName = getLabelColumnName(parameter);
    String valueColumnName = getValueColumnName(parameter);
    if (labelColumnName != null) {
      org.eclipse.birt.report.model.api.Expression mexpr =
          (org.eclipse.birt.report.model.api.Expression)
              parameter.getExpressionProperty(AbstractScalarParameter.LABEL_EXPR_PROP).getValue();
      ScriptExpression dexpr = adapter.adaptExpression(mexpr);
      addBinding(queryDefn, labelColumnName, dexpr);
    }
    org.eclipse.birt.report.model.api.Expression mexpr =
        (org.eclipse.birt.report.model.api.Expression)
            parameter.getExpressionProperty(AbstractScalarParameter.VALUE_EXPR_PROP).getValue();

    String dataType = parameter.getDataType();
    if (DesignChoiceConstants.PARAM_TYPE_STRING.equals(dataType)) {
      dataType = DesignChoiceConstants.PARAM_TYPE_JAVA_OBJECT;
    }
    ScriptExpression dexpr = adapter.adaptExpression(mexpr, dataType);
    addBinding(queryDefn, valueColumnName, dexpr);
  }
 public static void addParameterSortBy(
     QueryDefinition queryDefn, AbstractScalarParameterHandle parameter, IModelAdapter adapter) {
   String sortBy = parameter.getSortByColumn();
   if (sortBy != null) {
     String sortDirection = parameter.getSortDirection();
     if (sortDirection != null) {
       org.eclipse.birt.report.model.api.Expression mexpr =
           (org.eclipse.birt.report.model.api.Expression)
               parameter
                   .getExpressionProperty(AbstractScalarParameter.SORT_BY_COLUMN_PROP)
                   .getValue();
       ScriptExpression dexpr = adapter.adaptExpression(mexpr);
       SortDefinition sort = new SortDefinition();
       sort.setExpression(dexpr);
       boolean direction =
           DesignChoiceConstants.SORT_DIRECTION_ASC.equalsIgnoreCase(sortDirection);
       sort.setSortDirection(direction ? ISortDefinition.SORT_ASC : ISortDefinition.SORT_DESC);
       queryDefn.addSort(sort);
     }
   }
 }