1 21 23 30 package oracle.toplink.essentials.internal.parsing; 31 32 import oracle.toplink.essentials.queryframework.ReportQuery; 34 import oracle.toplink.essentials.queryframework.ObjectLevelReadQuery; 35 import oracle.toplink.essentials.exceptions.EJBQLException; 36 import oracle.toplink.essentials.expressions.Expression; 37 38 public class HavingNode extends MajorNode { 39 40 private Node having = null; 41 42 46 public void validate(ParseTreeContext context, GroupByNode groupbyNode) { 47 if (having != null) { 48 having.validate(context); 49 50 if ((groupbyNode != null) && !groupbyNode.isValidHavingExpr(having)) { 51 throw EJBQLException.invalidHavingExpression( 52 having.getAsString(), groupbyNode.getAsString()); 53 } 54 } 55 } 56 57 61 public void addHavingToQuery(ObjectLevelReadQuery theQuery, GenerationContext context) { 62 if (theQuery.isReportQuery()) { 63 Expression havingExpression = getHaving().generateExpression(context); 64 ((ReportQuery)theQuery).setHavingExpression(havingExpression); 65 } 66 } 67 68 72 public Node getHaving() { 73 return having; 74 } 75 76 80 public void setHaving(Node having) { 81 this.having = having; 82 } 83 } 84 | Popular Tags |