1 21 package oracle.toplink.essentials.internal.parsing; 23 24 25 import java.util.*; 27 28 import oracle.toplink.essentials.queryframework.ReadAllQuery; 30 import oracle.toplink.essentials.queryframework.ObjectLevelReadQuery; 31 32 41 public class OrderByNode extends MajorNode { 42 43 List orderByItems = null; 44 45 48 public OrderByNode() { 49 super(); 50 } 51 52 56 private void addOrderByItem(Object theNode) { 57 getOrderByItems().add(theNode); 58 } 59 60 64 public void addOrderingToQuery(ObjectLevelReadQuery theQuery, GenerationContext context) { 65 if (theQuery.isReadAllQuery()) { 66 Iterator iter = getOrderByItems().iterator(); 67 while (iter.hasNext()) { 68 Node nextNode = (Node)iter.next(); 69 ((ReadAllQuery)theQuery).addOrdering(nextNode.generateExpression(context)); 70 } 71 } 72 } 73 74 78 public void validate(ParseTreeContext context, SelectNode selectNode) { 79 for (Iterator i = orderByItems.iterator(); i.hasNext(); ) { 80 Node item = (Node)i.next(); 81 item.validate(context); 82 } 83 } 84 85 89 public List getOrderByItems() { 90 if (orderByItems == null) { 91 setOrderByItems(new Vector()); 92 } 93 return orderByItems; 94 } 95 96 100 public void setOrderByItems(List newItems) { 101 orderByItems = newItems; 102 } 103 } 104 | Popular Tags |