/**
   * @param inputAttrs
   * @param inputParamAttrs
   * @param paramHandle
   */
  protected void updateDefaultStaticValues(
      InputElementAttributes inputAttrs, AbstractScalarParameterHandle paramHandle) {
    // update default values.

    StaticValues newValues = null;
    List<Expression> tmpValues = paramHandle.getDefaultValueList();
    if (tmpValues != null) {
      for (int i = 0; i < tmpValues.size(); i++) {
        if (newValues == null) newValues = designFactory.createStaticValues();

        Expression tmpExpr = tmpValues.get(i);
        String odaValue = null;

        // for the constant, there is no need to remove quotes
        if (ExpressionType.CONSTANT.equalsIgnoreCase(tmpExpr.getType())) {
          odaValue = tmpExpr.getStringExpression();
        } else {
          odaValue =
              ParameterValueUtil.toODAValue(
                  tmpValues.get(i).getStringExpression(), paramHandle.getDataType());
        }
        newValues.add(odaValue);
      }
    }
    inputAttrs.setDefaultValues(newValues);
  }
Exemplo n.º 2
0
 @Override
 public List<SemanticException> validate(Module module, DesignElement element) {
   List<SemanticException> ret = new ArrayList<SemanticException>();
   Object obj = element.getProperty(module, IReportItemModel.BOOKMARK_PROP);
   if (obj != null && obj instanceof Expression) {
     Expression expr = (Expression) obj;
     if (ExpressionType.CONSTANT.equals(expr.getType())) {
       if (!Pattern.matches(BOOKMARK_PATTERN, expr.getStringExpression())) {
         ret.add(
             new SemanticException(
                 element,
                 "The bookmark is invalid, must begin with a letter(A-Za-z) and be followed by these chars (A-Za-z0-9-_:.)"));
       }
     }
     return ret;
   }
   return Collections.emptyList();
 }