Package railo.transformer.cfml.evaluator

Examples of railo.transformer.cfml.evaluator.EvaluatorException


   */
  public void evaluate(Tag tag,TagLibTag tagLibTag,FunctionLib[] flibs) throws EvaluatorException {
       
    // file loop     
        if(tag.containsAttribute("message") && tag.containsAttribute("object")) {
            throw new EvaluatorException("Wrong Context, when you use attribute message, attribute object is not allowed");
        }

  }
View Full Code Here


    String ns=libTag.getTagLib().getNameSpaceAndSeparator();
      String name=ns+"tree";
   
    // check if tag is direct inside if
    if(!ASMUtil.hasAncestorTag(tag,name))
      throw new EvaluatorException("Wrong Context, tag "+libTag.getFullName()+" must be inside a "+name+" tag")
  }
View Full Code Here

            if(!hasParentWithGroup)hasParentWithGroup=parent.hasGroup();
            if(hasParentWithQuery && hasParentWithGroup)break;
    }
       
        if(hasQuery && hasParentWithQuery)
      throw new EvaluatorException("Nesting of tags cfoutput with attribute query is not allowed");

        if(hasQuery)
          output.setType(TagOutput.TYPE_QUERY);
       
        else if(tag.containsAttribute("group") && hasParentWithQuery)
          output.setType(TagOutput.TYPE_GROUP);
       
        else if(hasParentWithQuery) {
          if(hasParentWithGroup) output.setType(TagOutput.TYPE_INNER_GROUP);
          else output.setType(TagOutput.TYPE_INNER_QUERY);
        }
        else
           output.setType(TagOutput.TYPE_NORMAL);
       
       
       
        // attribute maxrows and endrow not allowd at the same time
        if(tag.containsAttribute("maxrows") && tag.containsAttribute("endrow"))
          throw new EvaluatorException("Wrong Context, you cannot use attribute maxrows and endrow at the same time.");
       
       
  }
View Full Code Here

     * @return attribute value
     * @throws EvaluatorException
     */
  public static Boolean getAttributeBoolean(Tag tag,String attrName) throws EvaluatorException {
    Boolean b= getAttributeLiteral(tag, attrName).getBoolean(null);
    if(b==null)throw new EvaluatorException("attribute ["+attrName+"] must be a constant boolean value");
    return b;
    }
View Full Code Here

     * @throws EvaluatorException
     */
  public static Literal getAttributeLiteral(Tag tag,String attrName) throws EvaluatorException {
    Attribute attr = tag.getAttribute(attrName);
    if(attr!=null && attr.getValue() instanceof Literal) return ((Literal)attr.getValue());
        throw new EvaluatorException("attribute ["+attrName+"] must be a constant value");
    }
View Full Code Here

        if(CastString.toExprString(attr.getValue()) instanceof LitString) return true;
        strType=" string";
      break;
      }
      if(!throwWhenNot) return false;
      throw new EvaluatorException("Attribute ["+attr.getName()+"] of the Tag ["+tag.getFullname()+"] must be a literal"+strType+" value. "+
          "attributes java class type "+attr.getValue().getClass().getName());
    }
    if(required){
      if(!throwWhenNot) return false;
      throw new EvaluatorException("Attribute ["+attr.getName()+"] of the Tag ["+tag.getFullname()+"] is required");
    }
    return false;
  }
View Full Code Here

  }



  private static EvaluatorException cacheWithinException() {
    return new EvaluatorException("value of cachedWithin must be a literal timespan, like 0.1 or createTimespan(1,2,3,4)");
  }
View Full Code Here

  }


  private static double toDouble(Expression e) throws EvaluatorException {
    if(!(e instanceof Literal))
      throw new EvaluatorException("Paremeters of the function createTimeSpan have to be literal numeric values in this context");
    Double d = ((Literal)e).getDouble(null);
    if(d==null)
      throw new EvaluatorException("Paremeters of the function createTimeSpan have to be literal numeric values in this context");
   
    return d.doubleValue();
  }
View Full Code Here

    // attribute modifier
    Attribute attrModifier = tag.getAttribute("modifier");
    if(attrModifier!=null) {
      ExprString expr = CastString.toExprString(attrModifier.getValue());
      if(!(expr instanceof Literal))
        throw new EvaluatorException("Attribute modifier of the Tag Function, must be one of the following literal string values: [abstract] or [final]");
      String modifier=StringUtil.emptyIfNull(((Literal)expr).getString()).trim();
      if(!StringUtil.isEmpty(modifier) && !"abstract".equalsIgnoreCase(modifier) && !"final".equalsIgnoreCase(modifier))
        throw new EvaluatorException("Attribute modifier of the Tag Function, must be one of the following literal string values: [abstract] or [final]");
     
     
      boolean abstr = "abstract".equalsIgnoreCase(modifier);
      if(abstr)throwIfNotEmpty(tag);
    }
   
    // cachedWithin
    Attribute attrCachedWithin = tag.getAttribute("cachedwithin");
    if(attrCachedWithin!=null) {
      Expression val = attrCachedWithin.getValue();
      tag.addAttribute(new Attribute(attrCachedWithin.isDynamicType(), attrCachedWithin.getName(), LitLong.toExpr(ASMUtil.timeSpanToLong(val), null, null), "numeric"));
    }
   
    // Attribute localMode
    Attribute attrLocalMode = tag.getAttribute("localmode");
    if(attrLocalMode!=null) {
      Expression expr = attrLocalMode.getValue();
      String str = ASMUtil.toString(expr,null);
      if(!StringUtil.isEmpty(str) && AppListenerUtil.toLocalMode(str, -1)==-1)
        throw new EvaluatorException("Attribute localMode of the Tag Function, must be a literal value (modern, classic, true or false)");
      //boolean output = ((LitBoolean)expr).getBooleanValue();
      //if(!output) ASMUtil.removeLiterlChildren(tag, true);
    }
   
   
    // Attribute Output
    // "output=true" wird in "railo.transformer.cfml.attributes.impl.Function" geh�ndelt
    Attribute attrOutput = tag.getAttribute("output");
    if(attrOutput!=null) {
      Expression expr = CastBoolean.toExprBoolean(attrOutput.getValue());
      if(!(expr instanceof LitBoolean))
        throw new EvaluatorException("Attribute output of the Tag Function, must be a literal boolean value (true or false, yes or no)");
      //boolean output = ((LitBoolean)expr).getBooleanValue();
      //if(!output) ASMUtil.removeLiterlChildren(tag, true);
    }
   
    Attribute attrBufferOutput = tag.getAttribute("bufferoutput");
    if(attrBufferOutput!=null) {
      Expression expr = CastBoolean.toExprBoolean(attrBufferOutput.getValue());
      if(!(expr instanceof LitBoolean))
        throw new EvaluatorException("Attribute bufferOutput of the Tag Function, must be a literal boolean value (true or false, yes or no)");
      //boolean output = ((LitBoolean)expr).getBooleanValue();
      //if(!output) ASMUtil.removeLiterlChildren(tag, true);
    }
   
   
View Full Code Here

  public static void checkFunctionName(String name, FunctionLib[] flibs) throws EvaluatorException {
    FunctionLibFunction flf;
    for (int i = 0; i < flibs.length; i++) {
      flf = flibs[i].getFunction(name);
      if(flf!=null && flf.getClazz()!=CFFunction.class) {
        throw new EvaluatorException("The name ["+name+"] is already used by a built in Function");
      }
    }
  }
View Full Code Here

TOP

Related Classes of railo.transformer.cfml.evaluator.EvaluatorException

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.