1 package org.apache.ojb.broker.query; 2 3 17 18 import java.util.Map ; 19 20 27 public class ReportQueryByCriteria extends QueryByCriteria implements ReportQuery 28 { 29 private String [] m_attributes = null; 31 32 private int[] m_jdbcTypes = null; 34 35 private String [] m_joinAttributes = null; 37 38 private Map m_attrToFld = null; 40 41 48 public ReportQueryByCriteria(Class targetClass, String [] attributes, Criteria criteria, boolean distinct) 49 { 50 super(targetClass, criteria, distinct); 51 setAttributes(attributes); 52 } 53 54 60 public ReportQueryByCriteria(Class targetClass, String [] attributes, Criteria criteria) 61 { 62 this(targetClass, attributes, criteria, false); 63 } 64 65 70 public ReportQueryByCriteria(Class targetClass, Criteria criteria) 71 { 72 this(targetClass, null, criteria, false); 73 } 74 75 81 public ReportQueryByCriteria(Class targetClass, Criteria criteria, boolean distinct) 82 { 83 this(targetClass, null, criteria, distinct); 84 } 85 86 91 public String [] getColumns() 92 { 93 return getAttributes(); 94 } 95 96 101 public void setColumns(String [] columns) 102 { 103 setAttributes(columns); 104 } 105 106 111 public String [] getAttributes() 112 { 113 return m_attributes; 114 } 115 116 121 public void setAttributes(String [] attributes) 122 { 123 m_attributes = attributes; 124 } 125 126 129 public int[] getJdbcTypes() 130 { 131 return m_jdbcTypes; 132 } 133 134 137 public void setJdbcTypes(int[] jdbcTypes) 138 { 139 this.m_jdbcTypes = jdbcTypes; 140 } 141 142 145 public String [] getJoinAttributes() 146 { 147 return m_joinAttributes; 148 } 149 150 153 public void setJoinAttributes(String [] joinAttributes) 154 { 155 m_joinAttributes = joinAttributes; 156 } 157 158 161 public String toString() 162 { 163 String [] cols = getAttributes(); 164 StringBuffer buf = new StringBuffer ("ReportQuery from "); 165 buf.append(getSearchClass() + " "); 166 if (cols != null) 167 { 168 for (int i = 0; i < cols.length; i++) 169 { 170 buf.append(cols[i] + " "); 171 } 172 } 173 if (getCriteria() != null && !getCriteria().isEmpty()) 174 { 175 buf.append(" where " + getCriteria()); 176 } 177 178 return buf.toString(); 179 } 180 181 public Map getAttributeFieldDescriptors() 182 { 183 return m_attrToFld; 184 } 185 186 public void setAttributeFieldDescriptors(Map attrToFld) 187 { 188 m_attrToFld = attrToFld; 189 } 190 191 192 193 } 194 | Popular Tags |