1 19 package org.apache.cayenne.ejbql.parser; 20 21 import java.util.Map ; 22 23 import org.apache.cayenne.ejbql.EJBQLCompiledExpression; 24 import org.apache.cayenne.ejbql.EJBQLExpression; 25 import org.apache.cayenne.map.ObjRelationship; 26 import org.apache.cayenne.query.SQLResultSetMapping; 27 import org.apache.cayenne.reflect.ClassDescriptor; 28 29 35 class CompiledExpression implements EJBQLCompiledExpression { 36 37 private String source; 38 private String rootId; 39 private Map descriptorsById; 40 private Map incomingById; 41 private EJBQLExpression expression; 42 private SQLResultSetMapping resultSetMapping; 43 44 public ClassDescriptor getEntityDescriptor(String idVariable) { 45 if (idVariable == null) { 46 return null; 47 } 48 49 return (ClassDescriptor) descriptorsById 50 .get(Compiler.normalizeIdPath(idVariable)); 51 } 52 53 public SQLResultSetMapping getResultSetMapping() { 54 return resultSetMapping; 55 } 56 57 public ClassDescriptor getRootDescriptor() { 58 return rootId != null ? getEntityDescriptor(rootId) : null; 59 } 60 61 public ObjRelationship getIncomingRelationship(String identifier) { 62 return (ObjRelationship) incomingById.get(identifier); 63 } 64 65 public EJBQLExpression getExpression() { 66 return expression; 67 } 68 69 public String getSource() { 70 return source; 71 } 72 73 void setExpression(EJBQLExpression expression) { 74 this.expression = expression; 75 } 76 77 void setDescriptorsById(Map descriptorsById) { 78 this.descriptorsById = descriptorsById; 79 } 80 81 void setIncomingById(Map incomingById) { 82 this.incomingById = incomingById; 83 } 84 85 void setSource(String source) { 86 this.source = source; 87 } 88 89 void setRootId(String rootId) { 90 this.rootId = rootId; 91 } 92 93 void setResultSetMapping(SQLResultSetMapping resultSetMapping) { 94 this.resultSetMapping = resultSetMapping; 95 } 96 } 97 | Popular Tags |