1 2 12 package com.versant.core.ejb.query; 13 14 17 public class JoinNode extends Node { 18 19 private boolean outer; 20 private boolean fetch; 21 private PathNode path; 22 private String identifier; 23 24 private NavField navField; 25 26 public JoinNode(boolean left, boolean fetch, PathNode path, 27 String identifier) { 28 this.outer = left; 29 this.fetch = fetch; 30 this.path = path; 31 this.identifier = identifier; 32 } 33 34 public boolean isOuter() { 35 return outer; 36 } 37 38 public boolean isFetch() { 39 return fetch; 40 } 41 42 public PathNode getPath() { 43 return path; 44 } 45 46 public String getIdentifier() { 47 return identifier; 48 } 49 50 public Object arrive(NodeVisitor v, Object msg) { 51 return v.arriveJoinNode(this, msg); 52 } 53 54 public String toStringImp() { 55 StringBuffer s = new StringBuffer (); 56 if (outer) { 57 s.append("LEFT OUTER "); 58 } 59 s.append("JOIN "); 60 if (fetch) { 61 s.append("FETCH "); 62 } 63 s.append(path); 64 if (navField != null) { 65 s.append('%'); 66 s.append(navField.getFmd().name); 67 } 68 s.append(" AS "); 69 s.append(identifier); 70 return s.toString(); 71 } 72 73 public NavField getNavField() { 74 return navField; 75 } 76 77 public void resolve(ResolveContext rc) { 78 rc.checkIdVarDoesNotExist(identifier, this); 79 NavBase res = rc.resolveJoinPath(path, outer, fetch); 80 if (!(res instanceof NavField)) { 81 rc.createUserException("Expected field navigation path: " + 82 path.toStringImp(), path); 83 } 84 navField = (NavField)res; 85 } 86 87 } 88 89 | Popular Tags |