1 21 package oracle.toplink.essentials.internal.expressions; 23 24 import java.util.*; 25 import oracle.toplink.essentials.expressions.*; 26 import oracle.toplink.essentials.internal.sessions.AbstractSession; 27 28 31 public class ExpressionNormalizer { 32 33 34 protected Expression additionalExpression; 35 36 37 protected SQLSelectStatement statement; 38 39 40 protected Vector subSelectExpressions; 41 42 43 protected AbstractSession session; 44 45 public ExpressionNormalizer(SQLSelectStatement statement) { 46 this.statement = statement; 47 } 48 49 public void addAdditionalExpression(Expression theExpression) { 50 additionalExpression = (additionalExpression == null) ? theExpression : additionalExpression.and(theExpression); 53 } 54 55 60 public void addSubSelectExpression(SubSelectExpression subSelectExpression) { 61 if (subSelectExpressions == null) { 62 subSelectExpressions = new Vector(1); 63 } 64 subSelectExpressions.add(subSelectExpression); 65 } 66 67 public Expression getAdditionalExpression() { 68 return additionalExpression; 69 } 70 71 public AbstractSession getSession() { 72 return session; 73 } 74 75 public SQLSelectStatement getStatement() { 76 return statement; 77 } 78 79 84 public boolean encounteredSubSelectExpressions() { 85 return (subSelectExpressions != null); 86 } 87 88 99 public void normalizeSubSelects(Dictionary clonedExpressions) { 100 for (Enumeration enumtr = subSelectExpressions.elements(); enumtr.hasMoreElements();) { 101 SubSelectExpression next = (SubSelectExpression)enumtr.nextElement(); 102 next.normalizeSubSelect(this, clonedExpressions); 103 } 104 } 105 106 public void setAdditionalExpression(Expression additionalExpression) { 107 this.additionalExpression = additionalExpression; 108 } 109 110 public void setSession(AbstractSession session) { 111 this.session = session; 112 } 113 114 public void setStatement(SQLSelectStatement statement) { 115 this.statement = statement; 116 } 117 } 118 | Popular Tags |