1 21 package oracle.toplink.essentials.queryframework; 23 24 import java.util.Vector ; 25 import java.util.List ; 26 import oracle.toplink.essentials.exceptions.QueryException; 27 import oracle.toplink.essentials.expressions.Expression; 28 import oracle.toplink.essentials.internal.queryframework.ReportItem; 29 30 31 45 public class ConstructorReportItem extends ReportItem { 46 47 protected Class [] constructorArgTypes; 48 protected List constructorMappings; 49 public List reportItems; 50 51 public ConstructorReportItem() { 52 } 53 54 59 public ConstructorReportItem(String name) { 60 super(name,null); 61 } 62 63 68 public void addAttribute( Expression attributeExpression) { 69 ReportItem item = new ReportItem(getName()+getReportItems().size(), attributeExpression); 70 getReportItems().add(item); 71 } 72 73 public void addAttribute(String attributeName, Expression attributeExpression, List joinedExpressions) { 74 ReportItem item = new ReportItem(attributeName, attributeExpression); 75 item.getJoinedAttributeManager().setJoinedAttributeExpressions_(joinedExpressions); 76 getReportItems().add(item); 77 } 78 79 public void addItem(ReportItem item) { 80 getReportItems().add(item); 81 } 82 83 public Class [] getConstructorArgTypes(){ 84 return constructorArgTypes; 85 } 86 87 public List getConstructorMappings(){ 88 return constructorMappings; 89 } 90 91 public List getReportItems(){ 92 if (reportItems==null){ 93 reportItems=new Vector (); 94 } 95 return reportItems; 96 } 97 98 102 public void initialize(ReportQuery query) throws QueryException { 103 int size= getReportItems().size(); 104 List mappings = new Vector (); 105 for (int i=0;i<size;i++){ 106 ReportItem item = (ReportItem)reportItems.get(i); 107 item.initialize(query); 108 mappings.add(item.getMapping()); 109 } 110 setConstructorMappings(mappings); 111 } 112 113 public boolean isContructorItem(){ 114 return true; 115 } 116 117 public void setConstructorArgTypes(Class [] constructorArgTypes){ 118 this.constructorArgTypes = constructorArgTypes; 119 } 120 121 public void setConstructorMappings(List constructorMappings){ 122 this.constructorMappings = constructorMappings; 123 } 124 125 public void setReportItems(List reportItems){ 126 this.reportItems = reportItems; 127 } 128 129 public String toString() { 130 String string = "ConstructorReportItem(" + getName() + " -> ["; 131 if (reportItems!=null){ 133 int size=reportItems.size(); 134 for(int i=0;i<size;i++){ 135 string =string + reportItems.get(i).toString(); 136 } 137 } 138 return string +"])"; 139 } 140 141 } 142 | Popular Tags |