1 package org.apache.ojb.broker.query;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 import java.util.Map;
19
20
21
22
23
24
25
26
27 public class ReportQueryByCriteria extends QueryByCriteria implements ReportQuery
28 {
29
30 private String[] m_attributes = null;
31
32
33 private int[] m_jdbcTypes = null;
34
35
36 private String[] m_joinAttributes = null;
37
38
39 private Map m_attrToFld = null;
40
41
42
43
44
45
46
47
48 public ReportQueryByCriteria(Class targetClass, String[] attributes, Criteria criteria, boolean distinct)
49 {
50 super(targetClass, criteria, distinct);
51 setAttributes(attributes);
52 }
53
54
55
56
57
58
59
60 public ReportQueryByCriteria(Class targetClass, String[] attributes, Criteria criteria)
61 {
62 this(targetClass, attributes, criteria, false);
63 }
64
65
66
67
68
69
70 public ReportQueryByCriteria(Class targetClass, Criteria criteria)
71 {
72 this(targetClass, null, criteria, false);
73 }
74
75
76
77
78
79
80
81 public ReportQueryByCriteria(Class targetClass, Criteria criteria, boolean distinct)
82 {
83 this(targetClass, null, criteria, distinct);
84 }
85
86
87
88
89
90
91 public String[] getColumns()
92 {
93 return getAttributes();
94 }
95
96
97
98
99
100
101 public void setColumns(String[] columns)
102 {
103 setAttributes(columns);
104 }
105
106
107
108
109
110
111 public String[] getAttributes()
112 {
113 return m_attributes;
114 }
115
116
117
118
119
120
121 public void setAttributes(String[] attributes)
122 {
123 m_attributes = attributes;
124 }
125
126
127
128
129 public int[] getJdbcTypes()
130 {
131 return m_jdbcTypes;
132 }
133
134
135
136
137 public void setJdbcTypes(int[] jdbcTypes)
138 {
139 this.m_jdbcTypes = jdbcTypes;
140 }
141
142
143
144
145 public String[] getJoinAttributes()
146 {
147 return m_joinAttributes;
148 }
149
150
151
152
153 public void setJoinAttributes(String[] joinAttributes)
154 {
155 m_joinAttributes = joinAttributes;
156 }
157
158
159
160
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 }