svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.db / org.gvsig.fmap.dal.db.jdbc / src / test / java / org / gvsig / fmap / dal / store / jdbc2 / AbstractTestDistinctOnUngrouped.java @ 46542
History | View | Annotate | Download (64.2 KB)
1 |
package org.gvsig.fmap.dal.store.jdbc2; |
---|---|
2 |
|
3 |
import java.util.ArrayList; |
4 |
import java.util.List; |
5 |
import junit.framework.TestCase; |
6 |
import static junit.framework.TestCase.assertEquals; |
7 |
import org.gvsig.expressionevaluator.ExpressionUtils; |
8 |
import org.gvsig.fmap.dal.DataTypes; |
9 |
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor; |
10 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
11 |
import org.gvsig.fmap.dal.feature.Feature; |
12 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
13 |
import org.gvsig.fmap.dal.feature.FeatureQuery; |
14 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
15 |
import org.gvsig.fmap.dal.feature.FeatureType; |
16 |
import org.gvsig.fmap.dal.impl.expressionevaluator.DefaultFeatureAttributeEmulatorExpression; |
17 |
import org.gvsig.fmap.dal.store.jdbc2.OperationsFactory.TableReference; |
18 |
import org.gvsig.fmap.dal.store.jdbc2.spi.JDBCSQLBuilderBase; |
19 |
import org.gvsig.fmap.dal.swing.DALSwingLocator; |
20 |
import org.gvsig.fmap.dal.swing.DataSwingManager; |
21 |
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.AggregateOperation.AggregateOperationFactory; |
22 |
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.DistinctOn; |
23 |
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.FirstAggregateOperation.FirstAggregateOperationFactory; |
24 |
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.LastAggregateOperation.LastAggregateOperationFactory; |
25 |
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.MaxAggregateOperation.MaxAggregateOperationFactory; |
26 |
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.MinAggregateOperation.MinAggregateOperationFactory; |
27 |
import org.gvsig.fmap.dal.swing.impl.searchPostProcess.distinctOn.SumAggregateOperation.SumAggregateOperationFactory; |
28 |
import org.gvsig.fmap.dal.swing.searchPostProcess.SearchPostProcess; |
29 |
import org.gvsig.fmap.dal.swing.searchPostProcess.SearchPostProcessFactory; |
30 |
import org.gvsig.fmap.dal.swing.searchpanel.SearchParameters; |
31 |
import org.gvsig.tools.dispose.DisposeUtils; |
32 |
import org.gvsig.tools.dynobject.DynObject; |
33 |
import org.gvsig.tools.dynobject.DynObjectValueItem; |
34 |
import org.gvsig.tools.library.impl.DefaultLibrariesInitializer; |
35 |
import org.slf4j.Logger; |
36 |
import org.slf4j.LoggerFactory; |
37 |
|
38 |
public abstract class AbstractTestDistinctOnUngrouped extends TestCase { |
39 |
|
40 |
protected static final Logger LOGGER = LoggerFactory.getLogger(AbstractTestDistinctOnUngrouped.class); |
41 |
|
42 |
protected AbstractTestUtils utils;
|
43 |
|
44 |
public AbstractTestDistinctOnUngrouped(String testName) { |
45 |
super(testName);
|
46 |
} |
47 |
|
48 |
@Override
|
49 |
protected void setUp() throws Exception { |
50 |
super.setUp();
|
51 |
new DefaultLibrariesInitializer().fullInitialize();
|
52 |
} |
53 |
|
54 |
@Override
|
55 |
protected void tearDown() throws Exception { |
56 |
super.tearDown();
|
57 |
} |
58 |
|
59 |
public AbstractTestUtils utils() {
|
60 |
if (this.utils == null) { |
61 |
this.utils = this.createUtils(); |
62 |
} |
63 |
return this.utils; |
64 |
} |
65 |
|
66 |
protected abstract AbstractTestUtils createUtils(); |
67 |
|
68 |
// TODO add test methods here. The name must begin with 'test'. For example:
|
69 |
// public void testHello() {}
|
70 |
protected void testAggregatesFirst() throws Exception { |
71 |
try {
|
72 |
if (!utils().isTheDatabaseAvailable()) {
|
73 |
return;
|
74 |
} |
75 |
String tableName = "testAggregatesFirst"; //Change for each test |
76 |
String testName = "testAggregatesFirst"; //Change for each test |
77 |
AggregateOperationFactory aggregateFunction = DistinctOn.getAggregatesOperationFactory( |
78 |
FirstAggregateOperationFactory.NAME //Change for each test
|
79 |
); |
80 |
|
81 |
FeatureStore sourceStore = utils().openCSVStore("/org/gvsig/fmap/dal/store/jdbc2/testCreateSource3.csv");
|
82 |
JDBCServerExplorer explorer = utils().openServerExplorer(testName); |
83 |
utils().initWorkspace(testName); |
84 |
|
85 |
utils().info_jdbc(explorer); |
86 |
|
87 |
utils().drop_tables(explorer, tableName); |
88 |
utils().create_table_from(explorer, tableName, sourceStore); |
89 |
utils().insert_into_from(explorer, tableName, sourceStore, FeatureStore.MODE_APPEND); |
90 |
|
91 |
JDBCHelper helper = utils().createJDBCHelper(); |
92 |
JDBCSQLBuilderBase sqlbuilder = helper.createSQLBuilder(); |
93 |
OperationsFactory operations = helper.getOperations(); |
94 |
|
95 |
TableReference table = operations.createTableReference( |
96 |
testName, |
97 |
sqlbuilder.default_schema(), |
98 |
tableName, |
99 |
null
|
100 |
); |
101 |
|
102 |
FeatureStore dbstore = utils().openStore(explorer, tableName); |
103 |
dbstore.edit(); |
104 |
FeatureType featureType = dbstore.getDefaultFeatureType(); |
105 |
EditableFeatureType eFeatureType = featureType.getEditable(); |
106 |
EditableFeatureAttributeDescriptor compu1 = eFeatureType.add("Compu1",
|
107 |
DataTypes.INTEGER, |
108 |
new DefaultFeatureAttributeEmulatorExpression(
|
109 |
eFeatureType, |
110 |
ExpressionUtils.createExpression("ID*2")
|
111 |
)); |
112 |
EditableFeatureAttributeDescriptor compu2 = eFeatureType.add("Compu2",
|
113 |
DataTypes.INTEGER, |
114 |
new DefaultFeatureAttributeEmulatorExpression(
|
115 |
eFeatureType, |
116 |
ExpressionUtils.createExpression("10000*Long+Compu1")
|
117 |
)); |
118 |
|
119 |
eFeatureType.getAttributeDescriptor("Byte").setAvailableValues(new DynObjectValueItem[]{ |
120 |
new DynObjectValueItem(null), |
121 |
new DynObjectValueItem(10), |
122 |
new DynObjectValueItem(20), |
123 |
new DynObjectValueItem(30), |
124 |
new DynObjectValueItem(40), |
125 |
new DynObjectValueItem(50), |
126 |
new DynObjectValueItem(60), |
127 |
new DynObjectValueItem(70), |
128 |
new DynObjectValueItem(80), |
129 |
new DynObjectValueItem(90) |
130 |
}); |
131 |
dbstore.update(eFeatureType); |
132 |
dbstore.finishEditing(); |
133 |
|
134 |
FeatureQuery query = dbstore.createFeatureQuery(); |
135 |
|
136 |
EditableFeatureAttributeDescriptor extraColumn1 = query.getExtraColumn().add("Extra1", DataTypes.INTEGER);
|
137 |
extraColumn1.setFeatureAttributeEmulator(new DefaultFeatureAttributeEmulatorExpression(featureType, ExpressionUtils.createExpression("Long+10"))); |
138 |
EditableFeatureAttributeDescriptor extraColumn2 = query.getExtraColumn().add("Extra2", DataTypes.INTEGER);
|
139 |
extraColumn2.setFeatureAttributeEmulator(new DefaultFeatureAttributeEmulatorExpression(featureType, ExpressionUtils.createExpression("20+Byte"))); |
140 |
|
141 |
DataSwingManager manager = DALSwingLocator.getDataSwingManager(); |
142 |
SearchParameters searchParams = manager.createFeatureStoreSearchPanel(dbstore).fetch(null);
|
143 |
|
144 |
SearchPostProcessFactory distinctOnFactory = manager.getSearchPostProcess("DistinctOn");
|
145 |
DynObject distinctOnParams = distinctOnFactory.createProcessParameters(dbstore, query, searchParams); |
146 |
|
147 |
distinctOnParams.setDynValue("field", "ID"); |
148 |
|
149 |
distinctOnParams.setDynValue("ID", getAggregateFunction(eFeatureType, query, "ID", aggregateFunction)); |
150 |
distinctOnParams.setDynValue("Byte", getAggregateFunction(eFeatureType, query, "Byte", aggregateFunction)); |
151 |
distinctOnParams.setDynValue("Bool1", getAggregateFunction(eFeatureType, query, "Bool1", aggregateFunction)); |
152 |
distinctOnParams.setDynValue("Long", getAggregateFunction(eFeatureType, query, "Long", aggregateFunction)); |
153 |
distinctOnParams.setDynValue("Timestamp", getAggregateFunction(eFeatureType, query, "Timestamp", aggregateFunction)); |
154 |
distinctOnParams.setDynValue("Date", getAggregateFunction(eFeatureType, query, "Date", aggregateFunction)); |
155 |
distinctOnParams.setDynValue("Bool2", getAggregateFunction(eFeatureType, query, "Bool2", aggregateFunction)); |
156 |
distinctOnParams.setDynValue("String", getAggregateFunction(eFeatureType, query, "String", aggregateFunction)); |
157 |
distinctOnParams.setDynValue("Bool3", getAggregateFunction(eFeatureType, query, "Bool3", aggregateFunction)); |
158 |
distinctOnParams.setDynValue("Double", getAggregateFunction(eFeatureType, query, "Double", aggregateFunction)); |
159 |
distinctOnParams.setDynValue("Bool4", getAggregateFunction(eFeatureType, query, "Bool4", aggregateFunction)); |
160 |
distinctOnParams.setDynValue("Float", getAggregateFunction(eFeatureType, query, "Float", aggregateFunction)); |
161 |
distinctOnParams.setDynValue("Decimal", getAggregateFunction(eFeatureType, query, "Decimal", aggregateFunction)); |
162 |
distinctOnParams.setDynValue("Geometry", getAggregateFunction(eFeatureType, query, "Geometry", aggregateFunction)); |
163 |
distinctOnParams.setDynValue("Compu1", getAggregateFunction(eFeatureType, query, "Compu1", aggregateFunction)); |
164 |
distinctOnParams.setDynValue("Compu2", getAggregateFunction(eFeatureType, query, "Compu2", aggregateFunction)); |
165 |
distinctOnParams.setDynValue("Extra1", getAggregateFunction(eFeatureType, query, "Extra1", aggregateFunction)); |
166 |
distinctOnParams.setDynValue("Extra2", getAggregateFunction(eFeatureType, query, "Extra2", aggregateFunction)); |
167 |
|
168 |
SearchPostProcess distinctOn = distinctOnFactory.createProcess(distinctOnFactory, dbstore, query, distinctOnParams); |
169 |
SearchPostProcess.SearchPostProcessResult result = distinctOn.execute(dbstore, query, distinctOnParams, null);
|
170 |
|
171 |
FeatureStore resultStore = result.getStore(); |
172 |
|
173 |
List<Feature> features0 = resultStore.getFeatures(query);
|
174 |
ArrayList<Feature> features = new ArrayList<>(); |
175 |
|
176 |
ArrayList<String[]> expected_values = new ArrayList<>(); |
177 |
expected_values.add(new String[]{"0","","","","","","","","","","","","","true","","","0","","",""}); |
178 |
expected_values.add(new String[]{"1","10","true"," 1000","12/29/2019 12:13:14 PM","12/29/2019","12:13:14 PM","true","Yo yo1","false","12345,543","true","123,210","true","456,123","POINT (-3.8945156972987958 42.01053743584765)","2","10000002","1010","30"}); |
179 |
expected_values.add(new String[]{"2","20","true"," 2000","11/29/2019 12:13:14 PM","11/29/2019","1:13:14 PM","true","Yo yo2","false","12100,543","true","100,210","true","456,123","POINT (-2.1079618220646115 41.983079082675474)","4","20000004","2010","40"}); |
180 |
expected_values.add(new String[]{"3","30","true"," 3000","10/29/2019 12:13:14 PM","10/29/2019","2:13:14 PM","true","Yo yo3","false","12101,543","true","101,210","true","456,123","POINT (-2.57249737803327 41.35372113353277)","6","30000006","3010","50"}); |
181 |
expected_values.add(new String[]{"4","40","true"," 4000","09/29/2019 12:13:14 PM","09/29/2019","3:13:14 PM","true","Yo yo4","false","12102,543","true","102,210","true","456,123","POINT (-4.061822048036304 41.35877680235475)","8","40000008","4010","60"}); |
182 |
expected_values.add(new String[]{"5","50","true"," 5000","08/29/2019 12:13:14 PM","08/29/2019","4:13:14 PM","true","Yo yo5","false","12103,543","true","103,210","true","456,123","POINT (-3.974317066986988 40.78701209315094)","10","50000010","5010","70"}); |
183 |
expected_values.add(new String[]{"6","60","true"," 6000","07/29/2019 12:13:14 PM","07/29/2019","5:13:14 PM","true","Yo yo6","false","12104,543","true","104,210","true","456,123","POINT (-2.510509736717547 40.69847453392384)","12","60000012","6010","80"}); |
184 |
expected_values.add(new String[]{"7","70","true"," 7000","06/29/2019 12:13:14 PM","06/29/2019","6:13:14 PM","true","Yo yo7","false","12105,543","true","105,210","true","456,123","POINT (-0.5317736981843011 40.66396082637622)","14","70000014","7010","90"}); |
185 |
expected_values.add(new String[]{"8","80","true"," 8000","05/29/2019 12:13:14 PM","05/29/2019","7:13:14 PM","true","Yo yo8","false","12106,543","true","106,210","true","456,123","POINT (-0.3626917259170671 41.13652386601604)","16","80000016","8010","100"}); |
186 |
expected_values.add(new String[]{"9","90","true"," 9000","04/29/2019 12:13:14 PM","04/29/2019","8:13:14 PM","true","Yo yo9","false","12107,543","true","107,210","true","456,123","POINT (-1.2461823078608523 41.84950010180092)","18","90000018","9010","110"}); |
187 |
|
188 |
for (int i = 0; i < features0.size(); i++) { |
189 |
Feature feature = features0.get(i); |
190 |
if( i==0 ) { |
191 |
System.out.println("Expected values:"); |
192 |
for (Object[] expected_line : expected_values) { |
193 |
for (Object cell : expected_line) { |
194 |
System.out.print(cell);
|
195 |
System.out.print(", "); |
196 |
} |
197 |
System.out.println();
|
198 |
} |
199 |
System.out.println("ID,Byte,Bool1,Long,Timestamp,Date,Time,Bool2,String,Bool3,Double,Bool4,Float,Bool5,Decimal,Geometry,Compu1,Compu2,Extra1,Extra2"); |
200 |
} |
201 |
features.add(feature.getCopy()); |
202 |
} |
203 |
System.out.println("ID,Byte,Bool1,Long,Timestamp,Date,Time,Bool2,String,Bool3,Double,Bool4,Float,Bool5,Decimal,Geometry,Compu1,Compu2,Extra1,Extra2"); |
204 |
|
205 |
features0 = null;
|
206 |
String[] header = new String[]{"ID","Byte","Bool1","Long","Timestamp","Date","Time","Bool2","String","Bool3","Double","Bool4","Float","Bool5","Decimal","Geometry","Compu1","Compu2","Extra1","Extra2"}; |
207 |
for (int i = 0; i < features.size(); i++) { |
208 |
for (int j = 0; j < header.length; j++) { |
209 |
assertEquals("feature[" + i + "][" + header[j] + "]:", expected_values.get(i)[j], features.get(i).format(header[j])); |
210 |
} |
211 |
} |
212 |
|
213 |
|
214 |
FeatureType resultType = resultStore.getDefaultFeatureType(); |
215 |
FeatureAttributeDescriptor attr = resultType.getAttributeDescriptor("ID");
|
216 |
assertEquals(DataTypes.INTEGER, attr.getType()); |
217 |
|
218 |
attr = resultType.getAttributeDescriptor("Byte");
|
219 |
assertEquals(DataTypes.BYTE, attr.getType()); |
220 |
assertNotNull(attr.getAvailableValues()); |
221 |
assertEquals("%2d", attr.getDefaultFormat());
|
222 |
|
223 |
attr = resultType.getAttributeDescriptor("Long");
|
224 |
assertEquals(DataTypes.LONG, attr.getType()); |
225 |
assertEquals("%6d", attr.getDefaultFormat());
|
226 |
|
227 |
attr = resultType.getAttributeDescriptor("Double");
|
228 |
assertEquals(DataTypes.DOUBLE, attr.getType()); |
229 |
assertEquals("%6.3f", attr.getDefaultFormat());
|
230 |
|
231 |
attr = resultType.getAttributeDescriptor("Float");
|
232 |
assertEquals(DataTypes.FLOAT, attr.getType()); |
233 |
assertEquals("%6.3f", attr.getDefaultFormat());
|
234 |
|
235 |
attr = resultType.getAttributeDescriptor("Decimal");
|
236 |
assertEquals(DataTypes.DECIMAL, attr.getType()); |
237 |
assertEquals("%6.3f", attr.getDefaultFormat());
|
238 |
|
239 |
DisposeUtils.dispose(dbstore); |
240 |
} catch (Throwable th) { |
241 |
LOGGER.warn("", th);
|
242 |
th.printStackTrace(); |
243 |
throw th;
|
244 |
} |
245 |
} |
246 |
|
247 |
protected void testAggregatesLast() throws Exception { |
248 |
try {
|
249 |
if (!utils().isTheDatabaseAvailable()) {
|
250 |
return;
|
251 |
} |
252 |
String tableName = "testAggregatesLast"; //Change for each test |
253 |
String testName = "testAggregatesLast"; //Change for each test |
254 |
AggregateOperationFactory aggregateFunction = DistinctOn.getAggregatesOperationFactory( |
255 |
LastAggregateOperationFactory.NAME //Change for each test
|
256 |
); |
257 |
|
258 |
FeatureStore sourceStore = utils().openCSVStore("/org/gvsig/fmap/dal/store/jdbc2/testCreateSource3.csv");
|
259 |
JDBCServerExplorer explorer = utils().openServerExplorer(testName); |
260 |
utils().initWorkspace(testName); |
261 |
|
262 |
utils().info_jdbc(explorer); |
263 |
|
264 |
utils().drop_tables(explorer, tableName); |
265 |
utils().create_table_from(explorer, tableName, sourceStore); |
266 |
utils().insert_into_from(explorer, tableName, sourceStore, FeatureStore.MODE_APPEND); |
267 |
|
268 |
JDBCHelper helper = utils().createJDBCHelper(); |
269 |
JDBCSQLBuilderBase sqlbuilder = helper.createSQLBuilder(); |
270 |
OperationsFactory operations = helper.getOperations(); |
271 |
|
272 |
TableReference table = operations.createTableReference( |
273 |
testName, |
274 |
sqlbuilder.default_schema(), |
275 |
tableName, |
276 |
null
|
277 |
); |
278 |
|
279 |
FeatureStore dbstore = utils().openStore(explorer, tableName); |
280 |
dbstore.edit(); |
281 |
FeatureType featureType = dbstore.getDefaultFeatureType(); |
282 |
EditableFeatureType eFeatureType = featureType.getEditable(); |
283 |
EditableFeatureAttributeDescriptor compu1 = eFeatureType.add("Compu1",
|
284 |
DataTypes.INTEGER, |
285 |
new DefaultFeatureAttributeEmulatorExpression(
|
286 |
eFeatureType, |
287 |
ExpressionUtils.createExpression("ID*2")
|
288 |
)); |
289 |
EditableFeatureAttributeDescriptor compu2 = eFeatureType.add("Compu2",
|
290 |
DataTypes.INTEGER, |
291 |
new DefaultFeatureAttributeEmulatorExpression(
|
292 |
eFeatureType, |
293 |
ExpressionUtils.createExpression("10000*Long+Compu1")
|
294 |
)); |
295 |
|
296 |
eFeatureType.getAttributeDescriptor("Byte").setAvailableValues(new DynObjectValueItem[]{ |
297 |
new DynObjectValueItem(null), |
298 |
new DynObjectValueItem(10), |
299 |
new DynObjectValueItem(20), |
300 |
new DynObjectValueItem(30), |
301 |
new DynObjectValueItem(40), |
302 |
new DynObjectValueItem(50), |
303 |
new DynObjectValueItem(60), |
304 |
new DynObjectValueItem(70), |
305 |
new DynObjectValueItem(80), |
306 |
new DynObjectValueItem(90) |
307 |
}); |
308 |
dbstore.update(eFeatureType); |
309 |
dbstore.finishEditing(); |
310 |
|
311 |
FeatureQuery query = dbstore.createFeatureQuery(); |
312 |
|
313 |
EditableFeatureAttributeDescriptor extraColumn1 = query.getExtraColumn().add("Extra1", DataTypes.INTEGER);
|
314 |
extraColumn1.setFeatureAttributeEmulator(new DefaultFeatureAttributeEmulatorExpression(featureType, ExpressionUtils.createExpression("Long+10"))); |
315 |
EditableFeatureAttributeDescriptor extraColumn2 = query.getExtraColumn().add("Extra2", DataTypes.INTEGER);
|
316 |
extraColumn2.setFeatureAttributeEmulator(new DefaultFeatureAttributeEmulatorExpression(featureType, ExpressionUtils.createExpression("20+Byte"))); |
317 |
|
318 |
DataSwingManager manager = DALSwingLocator.getDataSwingManager(); |
319 |
SearchParameters searchParams = manager.createFeatureStoreSearchPanel(dbstore).fetch(null);
|
320 |
|
321 |
SearchPostProcessFactory distinctOnFactory = manager.getSearchPostProcess("DistinctOn");
|
322 |
DynObject distinctOnParams = distinctOnFactory.createProcessParameters(dbstore, query, searchParams); |
323 |
|
324 |
distinctOnParams.setDynValue("field", "ID"); |
325 |
|
326 |
distinctOnParams.setDynValue("ID", getAggregateFunction(eFeatureType, query, "ID", aggregateFunction)); |
327 |
distinctOnParams.setDynValue("Byte", getAggregateFunction(eFeatureType, query, "Byte", aggregateFunction)); |
328 |
distinctOnParams.setDynValue("Bool1", getAggregateFunction(eFeatureType, query, "Bool1", aggregateFunction)); |
329 |
distinctOnParams.setDynValue("Long", getAggregateFunction(eFeatureType, query, "Long", aggregateFunction)); |
330 |
distinctOnParams.setDynValue("Timestamp", getAggregateFunction(eFeatureType, query, "Timestamp", aggregateFunction)); |
331 |
distinctOnParams.setDynValue("Date", getAggregateFunction(eFeatureType, query, "Date", aggregateFunction)); |
332 |
distinctOnParams.setDynValue("Bool2", getAggregateFunction(eFeatureType, query, "Bool2", aggregateFunction)); |
333 |
distinctOnParams.setDynValue("String", getAggregateFunction(eFeatureType, query, "String", aggregateFunction)); |
334 |
distinctOnParams.setDynValue("Bool3", getAggregateFunction(eFeatureType, query, "Bool3", aggregateFunction)); |
335 |
distinctOnParams.setDynValue("Double", getAggregateFunction(eFeatureType, query, "Double", aggregateFunction)); |
336 |
distinctOnParams.setDynValue("Bool4", getAggregateFunction(eFeatureType, query, "Bool4", aggregateFunction)); |
337 |
distinctOnParams.setDynValue("Float", getAggregateFunction(eFeatureType, query, "Float", aggregateFunction)); |
338 |
distinctOnParams.setDynValue("Decimal", getAggregateFunction(eFeatureType, query, "Decimal", aggregateFunction)); |
339 |
distinctOnParams.setDynValue("Geometry", getAggregateFunction(eFeatureType, query, "Geometry", aggregateFunction)); |
340 |
distinctOnParams.setDynValue("Compu1", getAggregateFunction(eFeatureType, query, "Compu1", aggregateFunction)); |
341 |
distinctOnParams.setDynValue("Compu2", getAggregateFunction(eFeatureType, query, "Compu2", aggregateFunction)); |
342 |
distinctOnParams.setDynValue("Extra1", getAggregateFunction(eFeatureType, query, "Extra1", aggregateFunction)); |
343 |
distinctOnParams.setDynValue("Extra2", getAggregateFunction(eFeatureType, query, "Extra2", aggregateFunction)); |
344 |
|
345 |
SearchPostProcess distinctOn = distinctOnFactory.createProcess(distinctOnFactory, dbstore, query, distinctOnParams); |
346 |
SearchPostProcess.SearchPostProcessResult result = distinctOn.execute(dbstore, query, distinctOnParams, null);
|
347 |
|
348 |
FeatureStore resultStore = result.getStore(); |
349 |
|
350 |
List<Feature> features0 = resultStore.getFeatures(query);
|
351 |
ArrayList<Feature> features = new ArrayList<>(); |
352 |
|
353 |
ArrayList<String[]> expected_values = new ArrayList<>(); |
354 |
expected_values.add(new String[]{"0","","","","","","","","","","","","","true","","","0","","",""}); |
355 |
expected_values.add(new String[]{"1","10","true"," 1000","12/29/2019 12:13:14 PM","12/29/2019","12:13:14 PM","true","Yo yo1","false","12345,543","true","123,210","true","456,123","POINT (-3.8945156972987958 42.01053743584765)","2","10000002","1010","30"}); |
356 |
expected_values.add(new String[]{"2","20","true"," 2000","11/29/2019 12:13:14 PM","11/29/2019","1:13:14 PM","true","Yo yo2","false","12100,543","true","100,210","true","456,123","POINT (-2.1079618220646115 41.983079082675474)","4","20000004","2010","40"}); |
357 |
expected_values.add(new String[]{"3","30","true"," 3000","10/29/2019 12:13:14 PM","10/29/2019","2:13:14 PM","true","Yo yo3","false","12101,543","true","101,210","true","456,123","POINT (-2.57249737803327 41.35372113353277)","6","30000006","3010","50"}); |
358 |
expected_values.add(new String[]{"4","40","true"," 4000","09/29/2019 12:13:14 PM","09/29/2019","3:13:14 PM","true","Yo yo4","false","12102,543","true","102,210","true","456,123","POINT (-4.061822048036304 41.35877680235475)","8","40000008","4010","60"}); |
359 |
expected_values.add(new String[]{"5","50","true"," 5000","08/29/2019 12:13:14 PM","08/29/2019","4:13:14 PM","true","Yo yo5","false","12103,543","true","103,210","true","456,123","POINT (-3.974317066986988 40.78701209315094)","10","50000010","5010","70"}); |
360 |
expected_values.add(new String[]{"6","60","true"," 6000","07/29/2019 12:13:14 PM","07/29/2019","5:13:14 PM","true","Yo yo6","false","12104,543","true","104,210","true","456,123","POINT (-2.510509736717547 40.69847453392384)","12","60000012","6010","80"}); |
361 |
expected_values.add(new String[]{"7","70","true"," 7000","06/29/2019 12:13:14 PM","06/29/2019","6:13:14 PM","true","Yo yo7","false","12105,543","true","105,210","true","456,123","POINT (-0.5317736981843011 40.66396082637622)","14","70000014","7010","90"}); |
362 |
expected_values.add(new String[]{"8","80","true"," 8000","05/29/2019 12:13:14 PM","05/29/2019","7:13:14 PM","true","Yo yo8","false","12106,543","true","106,210","true","456,123","POINT (-0.3626917259170671 41.13652386601604)","16","80000016","8010","100"}); |
363 |
expected_values.add(new String[]{"9","90","true"," 9000","04/29/2019 12:13:14 PM","04/29/2019","8:13:14 PM","true","Yo yo9","false","12107,543","true","107,210","true","456,123","POINT (-1.2461823078608523 41.84950010180092)","18","90000018","9010","110"}); |
364 |
|
365 |
for (int i = 0; i < features0.size(); i++) { |
366 |
Feature feature = features0.get(i); |
367 |
if( i==0 ) { |
368 |
System.out.println("Expected values:"); |
369 |
for (Object[] expected_line : expected_values) { |
370 |
for (Object cell : expected_line) { |
371 |
System.out.print(cell);
|
372 |
System.out.print(", "); |
373 |
} |
374 |
System.out.println();
|
375 |
} |
376 |
System.out.println("ID,Byte,Bool1,Long,Timestamp,Date,Time,Bool2,String,Bool3,Double,Bool4,Float,Bool5,Decimal,Geometry,Compu1,Compu2,Extra1,Extra2"); |
377 |
} |
378 |
features.add(feature.getCopy()); |
379 |
} |
380 |
System.out.println("ID,Byte,Bool1,Long,Timestamp,Date,Time,Bool2,String,Bool3,Double,Bool4,Float,Bool5,Decimal,Geometry,Compu1,Compu2,Extra1,Extra2"); |
381 |
|
382 |
features0 = null;
|
383 |
String[] header = new String[]{"ID","Byte","Bool1","Long","Timestamp","Date","Time","Bool2","String","Bool3","Double","Bool4","Float","Bool5","Decimal","Geometry","Compu1","Compu2","Extra1","Extra2"}; |
384 |
for (int i = 0; i < features.size(); i++) { |
385 |
for (int j = 0; j < header.length; j++) { |
386 |
assertEquals("feature[" + i + "][" + header[j] + "]:", expected_values.get(i)[j], features.get(i).format(header[j])); |
387 |
} |
388 |
} |
389 |
|
390 |
|
391 |
FeatureType resultType = resultStore.getDefaultFeatureType(); |
392 |
FeatureAttributeDescriptor attr = resultType.getAttributeDescriptor("ID");
|
393 |
assertEquals(DataTypes.INTEGER, attr.getType()); |
394 |
|
395 |
attr = resultType.getAttributeDescriptor("Byte");
|
396 |
assertEquals(DataTypes.BYTE, attr.getType()); |
397 |
assertNotNull(attr.getAvailableValues()); |
398 |
assertEquals("%2d", attr.getDefaultFormat());
|
399 |
|
400 |
attr = resultType.getAttributeDescriptor("Long");
|
401 |
assertEquals(DataTypes.LONG, attr.getType()); |
402 |
assertEquals("%6d", attr.getDefaultFormat());
|
403 |
|
404 |
attr = resultType.getAttributeDescriptor("Double");
|
405 |
assertEquals(DataTypes.DOUBLE, attr.getType()); |
406 |
assertEquals("%6.3f", attr.getDefaultFormat());
|
407 |
|
408 |
attr = resultType.getAttributeDescriptor("Float");
|
409 |
assertEquals(DataTypes.FLOAT, attr.getType()); |
410 |
assertEquals("%6.3f", attr.getDefaultFormat());
|
411 |
|
412 |
attr = resultType.getAttributeDescriptor("Decimal");
|
413 |
assertEquals(DataTypes.DECIMAL, attr.getType()); |
414 |
assertEquals("%6.3f", attr.getDefaultFormat());
|
415 |
|
416 |
DisposeUtils.dispose(dbstore); |
417 |
} catch (Throwable th) { |
418 |
LOGGER.warn("", th);
|
419 |
th.printStackTrace(); |
420 |
throw th;
|
421 |
} |
422 |
} |
423 |
|
424 |
protected void testAggregatesMin() throws Exception { |
425 |
try {
|
426 |
if (!utils().isTheDatabaseAvailable()) {
|
427 |
return;
|
428 |
} |
429 |
String tableName = "testAggregatesMin"; //Change for each test |
430 |
String testName = "testAggregatesMin"; //Change for each test |
431 |
AggregateOperationFactory aggregateFunction = DistinctOn.getAggregatesOperationFactory( |
432 |
MinAggregateOperationFactory.NAME //Change for each test
|
433 |
); |
434 |
|
435 |
FeatureStore sourceStore = utils().openCSVStore("/org/gvsig/fmap/dal/store/jdbc2/testCreateSource3.csv");
|
436 |
JDBCServerExplorer explorer = utils().openServerExplorer(testName); |
437 |
utils().initWorkspace(testName); |
438 |
|
439 |
utils().info_jdbc(explorer); |
440 |
|
441 |
utils().drop_tables(explorer, tableName); |
442 |
utils().create_table_from(explorer, tableName, sourceStore); |
443 |
utils().insert_into_from(explorer, tableName, sourceStore, FeatureStore.MODE_APPEND); |
444 |
|
445 |
JDBCHelper helper = utils().createJDBCHelper(); |
446 |
JDBCSQLBuilderBase sqlbuilder = helper.createSQLBuilder(); |
447 |
OperationsFactory operations = helper.getOperations(); |
448 |
|
449 |
TableReference table = operations.createTableReference( |
450 |
testName, |
451 |
sqlbuilder.default_schema(), |
452 |
tableName, |
453 |
null
|
454 |
); |
455 |
|
456 |
FeatureStore dbstore = utils().openStore(explorer, tableName); |
457 |
dbstore.edit(); |
458 |
FeatureType featureType = dbstore.getDefaultFeatureType(); |
459 |
EditableFeatureType eFeatureType = featureType.getEditable(); |
460 |
EditableFeatureAttributeDescriptor compu1 = eFeatureType.add("Compu1",
|
461 |
DataTypes.INTEGER, |
462 |
new DefaultFeatureAttributeEmulatorExpression(
|
463 |
eFeatureType, |
464 |
ExpressionUtils.createExpression("ID*2")
|
465 |
)); |
466 |
EditableFeatureAttributeDescriptor compu2 = eFeatureType.add("Compu2",
|
467 |
DataTypes.INTEGER, |
468 |
new DefaultFeatureAttributeEmulatorExpression(
|
469 |
eFeatureType, |
470 |
ExpressionUtils.createExpression("10000*Long+Compu1")
|
471 |
)); |
472 |
|
473 |
eFeatureType.getAttributeDescriptor("Byte").setAvailableValues(new DynObjectValueItem[]{ |
474 |
new DynObjectValueItem(null), |
475 |
new DynObjectValueItem(10), |
476 |
new DynObjectValueItem(20), |
477 |
new DynObjectValueItem(30), |
478 |
new DynObjectValueItem(40), |
479 |
new DynObjectValueItem(50), |
480 |
new DynObjectValueItem(60), |
481 |
new DynObjectValueItem(70), |
482 |
new DynObjectValueItem(80), |
483 |
new DynObjectValueItem(90) |
484 |
}); |
485 |
dbstore.update(eFeatureType); |
486 |
dbstore.finishEditing(); |
487 |
|
488 |
FeatureQuery query = dbstore.createFeatureQuery(); |
489 |
|
490 |
EditableFeatureAttributeDescriptor extraColumn1 = query.getExtraColumn().add("Extra1", DataTypes.INTEGER);
|
491 |
extraColumn1.setFeatureAttributeEmulator(new DefaultFeatureAttributeEmulatorExpression(featureType, ExpressionUtils.createExpression("Long+10"))); |
492 |
EditableFeatureAttributeDescriptor extraColumn2 = query.getExtraColumn().add("Extra2", DataTypes.INTEGER);
|
493 |
extraColumn2.setFeatureAttributeEmulator(new DefaultFeatureAttributeEmulatorExpression(featureType, ExpressionUtils.createExpression("20+Byte"))); |
494 |
|
495 |
DataSwingManager manager = DALSwingLocator.getDataSwingManager(); |
496 |
SearchParameters searchParams = manager.createFeatureStoreSearchPanel(dbstore).fetch(null);
|
497 |
|
498 |
SearchPostProcessFactory distinctOnFactory = manager.getSearchPostProcess("DistinctOn");
|
499 |
DynObject distinctOnParams = distinctOnFactory.createProcessParameters(dbstore, query, searchParams); |
500 |
|
501 |
distinctOnParams.setDynValue("field", "ID"); |
502 |
|
503 |
distinctOnParams.setDynValue("ID", getAggregateFunction(eFeatureType, query, "ID", aggregateFunction)); |
504 |
distinctOnParams.setDynValue("Byte", getAggregateFunction(eFeatureType, query, "Byte", aggregateFunction)); |
505 |
distinctOnParams.setDynValue("Bool1", getAggregateFunction(eFeatureType, query, "Bool1", aggregateFunction)); |
506 |
distinctOnParams.setDynValue("Long", getAggregateFunction(eFeatureType, query, "Long", aggregateFunction)); |
507 |
distinctOnParams.setDynValue("Timestamp", getAggregateFunction(eFeatureType, query, "Timestamp", aggregateFunction)); |
508 |
distinctOnParams.setDynValue("Date", getAggregateFunction(eFeatureType, query, "Date", aggregateFunction)); |
509 |
distinctOnParams.setDynValue("Bool2", getAggregateFunction(eFeatureType, query, "Bool2", aggregateFunction)); |
510 |
distinctOnParams.setDynValue("String", getAggregateFunction(eFeatureType, query, "String", aggregateFunction)); |
511 |
distinctOnParams.setDynValue("Bool3", getAggregateFunction(eFeatureType, query, "Bool3", aggregateFunction)); |
512 |
distinctOnParams.setDynValue("Double", getAggregateFunction(eFeatureType, query, "Double", aggregateFunction)); |
513 |
distinctOnParams.setDynValue("Bool4", getAggregateFunction(eFeatureType, query, "Bool4", aggregateFunction)); |
514 |
distinctOnParams.setDynValue("Float", getAggregateFunction(eFeatureType, query, "Float", aggregateFunction)); |
515 |
distinctOnParams.setDynValue("Decimal", getAggregateFunction(eFeatureType, query, "Decimal", aggregateFunction)); |
516 |
distinctOnParams.setDynValue("Geometry", getAggregateFunction(eFeatureType, query, "Geometry", aggregateFunction)); |
517 |
distinctOnParams.setDynValue("Compu1", getAggregateFunction(eFeatureType, query, "Compu1", aggregateFunction)); |
518 |
distinctOnParams.setDynValue("Compu2", getAggregateFunction(eFeatureType, query, "Compu2", aggregateFunction)); |
519 |
distinctOnParams.setDynValue("Extra1", getAggregateFunction(eFeatureType, query, "Extra1", aggregateFunction)); |
520 |
distinctOnParams.setDynValue("Extra2", getAggregateFunction(eFeatureType, query, "Extra2", aggregateFunction)); |
521 |
|
522 |
SearchPostProcess distinctOn = distinctOnFactory.createProcess(distinctOnFactory, dbstore, query, distinctOnParams); |
523 |
SearchPostProcess.SearchPostProcessResult result = distinctOn.execute(dbstore, query, distinctOnParams, null);
|
524 |
|
525 |
FeatureStore resultStore = result.getStore(); |
526 |
|
527 |
List<Feature> features0 = resultStore.getFeatures(query);
|
528 |
ArrayList<Feature> features = new ArrayList<>(); |
529 |
|
530 |
ArrayList<String[]> expected_values = new ArrayList<>(); |
531 |
expected_values.add(new String[]{"0","","","","","","","","","","","","","true","","","0","","",""}); |
532 |
expected_values.add(new String[]{"1","10","true"," 1000","12/29/2019 12:13:14 PM","12/29/2019","12:13:14 PM","true","Yo yo1","false","12345,543","true","123,210","true","456,123","POINT (-3.8945156972987958 42.01053743584765)","2","10000002","1010","30"}); |
533 |
expected_values.add(new String[]{"2","20","true"," 2000","11/29/2019 12:13:14 PM","11/29/2019","1:13:14 PM","true","Yo yo2","false","12100,543","true","100,210","true","456,123","POINT (-2.1079618220646115 41.983079082675474)","4","20000004","2010","40"}); |
534 |
expected_values.add(new String[]{"3","30","true"," 3000","10/29/2019 12:13:14 PM","10/29/2019","2:13:14 PM","true","Yo yo3","false","12101,543","true","101,210","true","456,123","POINT (-2.57249737803327 41.35372113353277)","6","30000006","3010","50"}); |
535 |
expected_values.add(new String[]{"4","40","true"," 4000","09/29/2019 12:13:14 PM","09/29/2019","3:13:14 PM","true","Yo yo4","false","12102,543","true","102,210","true","456,123","POINT (-4.061822048036304 41.35877680235475)","8","40000008","4010","60"}); |
536 |
expected_values.add(new String[]{"5","50","true"," 5000","08/29/2019 12:13:14 PM","08/29/2019","4:13:14 PM","true","Yo yo5","false","12103,543","true","103,210","true","456,123","POINT (-3.974317066986988 40.78701209315094)","10","50000010","5010","70"}); |
537 |
expected_values.add(new String[]{"6","60","true"," 6000","07/29/2019 12:13:14 PM","07/29/2019","5:13:14 PM","true","Yo yo6","false","12104,543","true","104,210","true","456,123","POINT (-2.510509736717547 40.69847453392384)","12","60000012","6010","80"}); |
538 |
expected_values.add(new String[]{"7","70","true"," 7000","06/29/2019 12:13:14 PM","06/29/2019","6:13:14 PM","true","Yo yo7","false","12105,543","true","105,210","true","456,123","POINT (-0.5317736981843011 40.66396082637622)","14","70000014","7010","90"}); |
539 |
expected_values.add(new String[]{"8","80","true"," 8000","05/29/2019 12:13:14 PM","05/29/2019","7:13:14 PM","true","Yo yo8","false","12106,543","true","106,210","true","456,123","POINT (-0.3626917259170671 41.13652386601604)","16","80000016","8010","100"}); |
540 |
expected_values.add(new String[]{"9","90","true"," 9000","04/29/2019 12:13:14 PM","04/29/2019","8:13:14 PM","true","Yo yo9","false","12107,543","true","107,210","true","456,123","POINT (-1.2461823078608523 41.84950010180092)","18","90000018","9010","110"}); |
541 |
|
542 |
for (int i = 0; i < features0.size(); i++) { |
543 |
Feature feature = features0.get(i); |
544 |
if( i==0 ) { |
545 |
System.out.println("Expected values:"); |
546 |
for (Object[] expected_line : expected_values) { |
547 |
for (Object cell : expected_line) { |
548 |
System.out.print(cell);
|
549 |
System.out.print(", "); |
550 |
} |
551 |
System.out.println();
|
552 |
} |
553 |
System.out.println("ID,Byte,Bool1,Long,Timestamp,Date,Time,Bool2,String,Bool3,Double,Bool4,Float,Bool5,Decimal,Geometry,Compu1,Compu2,Extra1,Extra2"); |
554 |
} |
555 |
features.add(feature.getCopy()); |
556 |
} |
557 |
System.out.println("ID,Byte,Bool1,Long,Timestamp,Date,Time,Bool2,String,Bool3,Double,Bool4,Float,Bool5,Decimal,Geometry,Compu1,Compu2,Extra1,Extra2"); |
558 |
|
559 |
features0 = null;
|
560 |
String[] header = new String[]{"ID","Byte","Bool1","Long","Timestamp","Date","Time","Bool2","String","Bool3","Double","Bool4","Float","Bool5","Decimal","Geometry","Compu1","Compu2","Extra1","Extra2"}; |
561 |
for (int i = 0; i < features.size(); i++) { |
562 |
for (int j = 0; j < header.length; j++) { |
563 |
assertEquals("feature[" + i + "][" + header[j] + "]:", expected_values.get(i)[j], features.get(i).format(header[j])); |
564 |
} |
565 |
} |
566 |
|
567 |
|
568 |
FeatureType resultType = resultStore.getDefaultFeatureType(); |
569 |
FeatureAttributeDescriptor attr = resultType.getAttributeDescriptor("ID");
|
570 |
assertEquals(DataTypes.INTEGER, attr.getType()); |
571 |
|
572 |
attr = resultType.getAttributeDescriptor("Byte");
|
573 |
assertEquals(DataTypes.BYTE, attr.getType()); |
574 |
assertNotNull(attr.getAvailableValues()); |
575 |
assertEquals("%2d", attr.getDefaultFormat());
|
576 |
|
577 |
attr = resultType.getAttributeDescriptor("Long");
|
578 |
assertEquals(DataTypes.LONG, attr.getType()); |
579 |
assertEquals("%6d", attr.getDefaultFormat());
|
580 |
|
581 |
attr = resultType.getAttributeDescriptor("Double");
|
582 |
assertEquals(DataTypes.DOUBLE, attr.getType()); |
583 |
assertEquals("%6.3f", attr.getDefaultFormat());
|
584 |
|
585 |
attr = resultType.getAttributeDescriptor("Float");
|
586 |
assertEquals(DataTypes.FLOAT, attr.getType()); |
587 |
assertEquals("%6.3f", attr.getDefaultFormat());
|
588 |
|
589 |
attr = resultType.getAttributeDescriptor("Decimal");
|
590 |
assertEquals(DataTypes.DECIMAL, attr.getType()); |
591 |
assertEquals("%6.3f", attr.getDefaultFormat());
|
592 |
|
593 |
DisposeUtils.dispose(dbstore); |
594 |
} catch (Throwable th) { |
595 |
LOGGER.warn("", th);
|
596 |
th.printStackTrace(); |
597 |
throw th;
|
598 |
} |
599 |
} |
600 |
|
601 |
protected void testAggregatesMax() throws Exception { |
602 |
try {
|
603 |
if (!utils().isTheDatabaseAvailable()) {
|
604 |
return;
|
605 |
} |
606 |
String tableName = "testAggregatesMax"; //Change for each test |
607 |
String testName = "testAggregatesMax"; //Change for each test |
608 |
AggregateOperationFactory aggregateFunction = DistinctOn.getAggregatesOperationFactory( |
609 |
MaxAggregateOperationFactory.NAME //Change for each test
|
610 |
); |
611 |
|
612 |
FeatureStore sourceStore = utils().openCSVStore("/org/gvsig/fmap/dal/store/jdbc2/testCreateSource3.csv");
|
613 |
JDBCServerExplorer explorer = utils().openServerExplorer(testName); |
614 |
utils().initWorkspace(testName); |
615 |
|
616 |
utils().info_jdbc(explorer); |
617 |
|
618 |
utils().drop_tables(explorer, tableName); |
619 |
utils().create_table_from(explorer, tableName, sourceStore); |
620 |
utils().insert_into_from(explorer, tableName, sourceStore, FeatureStore.MODE_APPEND); |
621 |
|
622 |
JDBCHelper helper = utils().createJDBCHelper(); |
623 |
JDBCSQLBuilderBase sqlbuilder = helper.createSQLBuilder(); |
624 |
OperationsFactory operations = helper.getOperations(); |
625 |
|
626 |
TableReference table = operations.createTableReference( |
627 |
testName, |
628 |
sqlbuilder.default_schema(), |
629 |
tableName, |
630 |
null
|
631 |
); |
632 |
|
633 |
FeatureStore dbstore = utils().openStore(explorer, tableName); |
634 |
dbstore.edit(); |
635 |
FeatureType featureType = dbstore.getDefaultFeatureType(); |
636 |
EditableFeatureType eFeatureType = featureType.getEditable(); |
637 |
EditableFeatureAttributeDescriptor compu1 = eFeatureType.add("Compu1",
|
638 |
DataTypes.INTEGER, |
639 |
new DefaultFeatureAttributeEmulatorExpression(
|
640 |
eFeatureType, |
641 |
ExpressionUtils.createExpression("ID*2")
|
642 |
)); |
643 |
EditableFeatureAttributeDescriptor compu2 = eFeatureType.add("Compu2",
|
644 |
DataTypes.INTEGER, |
645 |
new DefaultFeatureAttributeEmulatorExpression(
|
646 |
eFeatureType, |
647 |
ExpressionUtils.createExpression("10000*Long+Compu1")
|
648 |
)); |
649 |
|
650 |
eFeatureType.getAttributeDescriptor("Byte").setAvailableValues(new DynObjectValueItem[]{ |
651 |
new DynObjectValueItem(null), |
652 |
new DynObjectValueItem(10), |
653 |
new DynObjectValueItem(20), |
654 |
new DynObjectValueItem(30), |
655 |
new DynObjectValueItem(40), |
656 |
new DynObjectValueItem(50), |
657 |
new DynObjectValueItem(60), |
658 |
new DynObjectValueItem(70), |
659 |
new DynObjectValueItem(80), |
660 |
new DynObjectValueItem(90) |
661 |
}); |
662 |
dbstore.update(eFeatureType); |
663 |
dbstore.finishEditing(); |
664 |
|
665 |
FeatureQuery query = dbstore.createFeatureQuery(); |
666 |
|
667 |
EditableFeatureAttributeDescriptor extraColumn1 = query.getExtraColumn().add("Extra1", DataTypes.INTEGER);
|
668 |
extraColumn1.setFeatureAttributeEmulator(new DefaultFeatureAttributeEmulatorExpression(featureType, ExpressionUtils.createExpression("Long+10"))); |
669 |
EditableFeatureAttributeDescriptor extraColumn2 = query.getExtraColumn().add("Extra2", DataTypes.INTEGER);
|
670 |
extraColumn2.setFeatureAttributeEmulator(new DefaultFeatureAttributeEmulatorExpression(featureType, ExpressionUtils.createExpression("20+Byte"))); |
671 |
|
672 |
DataSwingManager manager = DALSwingLocator.getDataSwingManager(); |
673 |
SearchParameters searchParams = manager.createFeatureStoreSearchPanel(dbstore).fetch(null);
|
674 |
|
675 |
SearchPostProcessFactory distinctOnFactory = manager.getSearchPostProcess("DistinctOn");
|
676 |
DynObject distinctOnParams = distinctOnFactory.createProcessParameters(dbstore, query, searchParams); |
677 |
|
678 |
distinctOnParams.setDynValue("field", "ID"); |
679 |
|
680 |
distinctOnParams.setDynValue("ID", getAggregateFunction(eFeatureType, query, "ID", aggregateFunction)); |
681 |
distinctOnParams.setDynValue("Byte", getAggregateFunction(eFeatureType, query, "Byte", aggregateFunction)); |
682 |
distinctOnParams.setDynValue("Bool1", getAggregateFunction(eFeatureType, query, "Bool1", aggregateFunction)); |
683 |
distinctOnParams.setDynValue("Long", getAggregateFunction(eFeatureType, query, "Long", aggregateFunction)); |
684 |
distinctOnParams.setDynValue("Timestamp", getAggregateFunction(eFeatureType, query, "Timestamp", aggregateFunction)); |
685 |
distinctOnParams.setDynValue("Date", getAggregateFunction(eFeatureType, query, "Date", aggregateFunction)); |
686 |
distinctOnParams.setDynValue("Bool2", getAggregateFunction(eFeatureType, query, "Bool2", aggregateFunction)); |
687 |
distinctOnParams.setDynValue("String", getAggregateFunction(eFeatureType, query, "String", aggregateFunction)); |
688 |
distinctOnParams.setDynValue("Bool3", getAggregateFunction(eFeatureType, query, "Bool3", aggregateFunction)); |
689 |
distinctOnParams.setDynValue("Double", getAggregateFunction(eFeatureType, query, "Double", aggregateFunction)); |
690 |
distinctOnParams.setDynValue("Bool4", getAggregateFunction(eFeatureType, query, "Bool4", aggregateFunction)); |
691 |
distinctOnParams.setDynValue("Float", getAggregateFunction(eFeatureType, query, "Float", aggregateFunction)); |
692 |
distinctOnParams.setDynValue("Decimal", getAggregateFunction(eFeatureType, query, "Decimal", aggregateFunction)); |
693 |
distinctOnParams.setDynValue("Geometry", getAggregateFunction(eFeatureType, query, "Geometry", aggregateFunction)); |
694 |
distinctOnParams.setDynValue("Compu1", getAggregateFunction(eFeatureType, query, "Compu1", aggregateFunction)); |
695 |
distinctOnParams.setDynValue("Compu2", getAggregateFunction(eFeatureType, query, "Compu2", aggregateFunction)); |
696 |
distinctOnParams.setDynValue("Extra1", getAggregateFunction(eFeatureType, query, "Extra1", aggregateFunction)); |
697 |
distinctOnParams.setDynValue("Extra2", getAggregateFunction(eFeatureType, query, "Extra2", aggregateFunction)); |
698 |
|
699 |
SearchPostProcess distinctOn = distinctOnFactory.createProcess(distinctOnFactory, dbstore, query, distinctOnParams); |
700 |
SearchPostProcess.SearchPostProcessResult result = distinctOn.execute(dbstore, query, distinctOnParams, null);
|
701 |
|
702 |
FeatureStore resultStore = result.getStore(); |
703 |
|
704 |
List<Feature> features0 = resultStore.getFeatures(query);
|
705 |
ArrayList<Feature> features = new ArrayList<>(); |
706 |
|
707 |
ArrayList<String[]> expected_values = new ArrayList<>(); |
708 |
expected_values.add(new String[]{"0","","","","","","","","","","","","","true","","","0","","",""}); |
709 |
expected_values.add(new String[]{"1","10","true"," 1000","12/29/2019 12:13:14 PM","12/29/2019","12:13:14 PM","true","Yo yo1","false","12345,543","true","123,210","true","456,123","POINT (-3.8945156972987958 42.01053743584765)","2","10000002","1010","30"}); |
710 |
expected_values.add(new String[]{"2","20","true"," 2000","11/29/2019 12:13:14 PM","11/29/2019","1:13:14 PM","true","Yo yo2","false","12100,543","true","100,210","true","456,123","POINT (-2.1079618220646115 41.983079082675474)","4","20000004","2010","40"}); |
711 |
expected_values.add(new String[]{"3","30","true"," 3000","10/29/2019 12:13:14 PM","10/29/2019","2:13:14 PM","true","Yo yo3","false","12101,543","true","101,210","true","456,123","POINT (-2.57249737803327 41.35372113353277)","6","30000006","3010","50"}); |
712 |
expected_values.add(new String[]{"4","40","true"," 4000","09/29/2019 12:13:14 PM","09/29/2019","3:13:14 PM","true","Yo yo4","false","12102,543","true","102,210","true","456,123","POINT (-4.061822048036304 41.35877680235475)","8","40000008","4010","60"}); |
713 |
expected_values.add(new String[]{"5","50","true"," 5000","08/29/2019 12:13:14 PM","08/29/2019","4:13:14 PM","true","Yo yo5","false","12103,543","true","103,210","true","456,123","POINT (-3.974317066986988 40.78701209315094)","10","50000010","5010","70"}); |
714 |
expected_values.add(new String[]{"6","60","true"," 6000","07/29/2019 12:13:14 PM","07/29/2019","5:13:14 PM","true","Yo yo6","false","12104,543","true","104,210","true","456,123","POINT (-2.510509736717547 40.69847453392384)","12","60000012","6010","80"}); |
715 |
expected_values.add(new String[]{"7","70","true"," 7000","06/29/2019 12:13:14 PM","06/29/2019","6:13:14 PM","true","Yo yo7","false","12105,543","true","105,210","true","456,123","POINT (-0.5317736981843011 40.66396082637622)","14","70000014","7010","90"}); |
716 |
expected_values.add(new String[]{"8","80","true"," 8000","05/29/2019 12:13:14 PM","05/29/2019","7:13:14 PM","true","Yo yo8","false","12106,543","true","106,210","true","456,123","POINT (-0.3626917259170671 41.13652386601604)","16","80000016","8010","100"}); |
717 |
expected_values.add(new String[]{"9","90","true"," 9000","04/29/2019 12:13:14 PM","04/29/2019","8:13:14 PM","true","Yo yo9","false","12107,543","true","107,210","true","456,123","POINT (-1.2461823078608523 41.84950010180092)","18","90000018","9010","110"}); |
718 |
|
719 |
for (int i = 0; i < features0.size(); i++) { |
720 |
Feature feature = features0.get(i); |
721 |
if( i==0 ) { |
722 |
System.out.println("Expected values:"); |
723 |
for (Object[] expected_line : expected_values) { |
724 |
for (Object cell : expected_line) { |
725 |
System.out.print(cell);
|
726 |
System.out.print(", "); |
727 |
} |
728 |
System.out.println();
|
729 |
} |
730 |
System.out.println("ID,Byte,Bool1,Long,Timestamp,Date,Time,Bool2,String,Bool3,Double,Bool4,Float,Bool5,Decimal,Geometry,Compu1,Compu2,Extra1,Extra2"); |
731 |
} |
732 |
features.add(feature.getCopy()); |
733 |
} |
734 |
System.out.println("ID,Byte,Bool1,Long,Timestamp,Date,Time,Bool2,String,Bool3,Double,Bool4,Float,Bool5,Decimal,Geometry,Compu1,Compu2,Extra1,Extra2"); |
735 |
|
736 |
features0 = null;
|
737 |
String[] header = new String[]{"ID","Byte","Bool1","Long","Timestamp","Date","Time","Bool2","String","Bool3","Double","Bool4","Float","Bool5","Decimal","Geometry","Compu1","Compu2","Extra1","Extra2"}; |
738 |
for (int i = 0; i < features.size(); i++) { |
739 |
for (int j = 0; j < header.length; j++) { |
740 |
assertEquals("feature[" + i + "][" + header[j] + "]:", expected_values.get(i)[j], features.get(i).format(header[j])); |
741 |
} |
742 |
} |
743 |
|
744 |
|
745 |
FeatureType resultType = resultStore.getDefaultFeatureType(); |
746 |
FeatureAttributeDescriptor attr = resultType.getAttributeDescriptor("ID");
|
747 |
assertEquals(DataTypes.INTEGER, attr.getType()); |
748 |
|
749 |
attr = resultType.getAttributeDescriptor("Byte");
|
750 |
assertEquals(DataTypes.BYTE, attr.getType()); |
751 |
assertNotNull(attr.getAvailableValues()); |
752 |
assertEquals("%2d", attr.getDefaultFormat());
|
753 |
|
754 |
attr = resultType.getAttributeDescriptor("Long");
|
755 |
assertEquals(DataTypes.LONG, attr.getType()); |
756 |
assertEquals("%6d", attr.getDefaultFormat());
|
757 |
|
758 |
attr = resultType.getAttributeDescriptor("Double");
|
759 |
assertEquals(DataTypes.DOUBLE, attr.getType()); |
760 |
assertEquals("%6.3f", attr.getDefaultFormat());
|
761 |
|
762 |
attr = resultType.getAttributeDescriptor("Float");
|
763 |
assertEquals(DataTypes.FLOAT, attr.getType()); |
764 |
assertEquals("%6.3f", attr.getDefaultFormat());
|
765 |
|
766 |
attr = resultType.getAttributeDescriptor("Decimal");
|
767 |
assertEquals(DataTypes.DECIMAL, attr.getType()); |
768 |
assertEquals("%6.3f", attr.getDefaultFormat());
|
769 |
|
770 |
DisposeUtils.dispose(dbstore); |
771 |
} catch (Throwable th) { |
772 |
LOGGER.warn("", th);
|
773 |
th.printStackTrace(); |
774 |
throw th;
|
775 |
} |
776 |
} |
777 |
|
778 |
protected void testAggregatesSum() throws Exception { |
779 |
try {
|
780 |
if (!utils().isTheDatabaseAvailable()) {
|
781 |
return;
|
782 |
} |
783 |
String tableName = "testAggregatesSum"; //Change for each test |
784 |
String testName = "testAggregatesSum"; //Change for each test |
785 |
AggregateOperationFactory aggregateFunction = DistinctOn.getAggregatesOperationFactory( |
786 |
SumAggregateOperationFactory.NAME //Change for each test
|
787 |
); |
788 |
|
789 |
FeatureStore sourceStore = utils().openCSVStore("/org/gvsig/fmap/dal/store/jdbc2/testCreateSource3.csv");
|
790 |
JDBCServerExplorer explorer = utils().openServerExplorer(testName); |
791 |
utils().initWorkspace(testName); |
792 |
|
793 |
utils().info_jdbc(explorer); |
794 |
|
795 |
utils().drop_tables(explorer, tableName); |
796 |
utils().create_table_from(explorer, tableName, sourceStore); |
797 |
utils().insert_into_from(explorer, tableName, sourceStore, FeatureStore.MODE_APPEND); |
798 |
|
799 |
JDBCHelper helper = utils().createJDBCHelper(); |
800 |
JDBCSQLBuilderBase sqlbuilder = helper.createSQLBuilder(); |
801 |
OperationsFactory operations = helper.getOperations(); |
802 |
|
803 |
TableReference table = operations.createTableReference( |
804 |
testName, |
805 |
sqlbuilder.default_schema(), |
806 |
tableName, |
807 |
null
|
808 |
); |
809 |
|
810 |
FeatureStore dbstore = utils().openStore(explorer, tableName); |
811 |
dbstore.edit(); |
812 |
FeatureType featureType = dbstore.getDefaultFeatureType(); |
813 |
EditableFeatureType eFeatureType = featureType.getEditable(); |
814 |
EditableFeatureAttributeDescriptor compu1 = eFeatureType.add("Compu1",
|
815 |
DataTypes.INTEGER, |
816 |
new DefaultFeatureAttributeEmulatorExpression(
|
817 |
eFeatureType, |
818 |
ExpressionUtils.createExpression("ID*2")
|
819 |
)); |
820 |
EditableFeatureAttributeDescriptor compu2 = eFeatureType.add("Compu2",
|
821 |
DataTypes.INTEGER, |
822 |
new DefaultFeatureAttributeEmulatorExpression(
|
823 |
eFeatureType, |
824 |
ExpressionUtils.createExpression("10000*Long+Compu1")
|
825 |
)); |
826 |
|
827 |
eFeatureType.getAttributeDescriptor("Byte").setAvailableValues(new DynObjectValueItem[]{ |
828 |
new DynObjectValueItem(null), |
829 |
new DynObjectValueItem(10), |
830 |
new DynObjectValueItem(20), |
831 |
new DynObjectValueItem(30), |
832 |
new DynObjectValueItem(40), |
833 |
new DynObjectValueItem(50), |
834 |
new DynObjectValueItem(60), |
835 |
new DynObjectValueItem(70), |
836 |
new DynObjectValueItem(80), |
837 |
new DynObjectValueItem(90) |
838 |
}); |
839 |
dbstore.update(eFeatureType); |
840 |
dbstore.finishEditing(); |
841 |
|
842 |
FeatureQuery query = dbstore.createFeatureQuery(); |
843 |
|
844 |
EditableFeatureAttributeDescriptor extraColumn1 = query.getExtraColumn().add("Extra1", DataTypes.INTEGER);
|
845 |
extraColumn1.setFeatureAttributeEmulator(new DefaultFeatureAttributeEmulatorExpression(featureType, ExpressionUtils.createExpression("Long+10"))); |
846 |
EditableFeatureAttributeDescriptor extraColumn2 = query.getExtraColumn().add("Extra2", DataTypes.INTEGER);
|
847 |
extraColumn2.setFeatureAttributeEmulator(new DefaultFeatureAttributeEmulatorExpression(featureType, ExpressionUtils.createExpression("20+Byte"))); |
848 |
|
849 |
DataSwingManager manager = DALSwingLocator.getDataSwingManager(); |
850 |
SearchParameters searchParams = manager.createFeatureStoreSearchPanel(dbstore).fetch(null);
|
851 |
|
852 |
SearchPostProcessFactory distinctOnFactory = manager.getSearchPostProcess("DistinctOn");
|
853 |
DynObject distinctOnParams = distinctOnFactory.createProcessParameters(dbstore, query, searchParams); |
854 |
|
855 |
distinctOnParams.setDynValue("field", "ID"); |
856 |
|
857 |
distinctOnParams.setDynValue("ID", getAggregateFunction(eFeatureType, query, "ID", aggregateFunction)); |
858 |
distinctOnParams.setDynValue("Byte", getAggregateFunction(eFeatureType, query, "Byte", aggregateFunction)); |
859 |
distinctOnParams.setDynValue("Bool1", getAggregateFunction(eFeatureType, query, "Bool1", aggregateFunction)); |
860 |
distinctOnParams.setDynValue("Long", getAggregateFunction(eFeatureType, query, "Long", aggregateFunction)); |
861 |
distinctOnParams.setDynValue("Timestamp", getAggregateFunction(eFeatureType, query, "Timestamp", aggregateFunction)); |
862 |
distinctOnParams.setDynValue("Date", getAggregateFunction(eFeatureType, query, "Date", aggregateFunction)); |
863 |
distinctOnParams.setDynValue("Bool2", getAggregateFunction(eFeatureType, query, "Bool2", aggregateFunction)); |
864 |
distinctOnParams.setDynValue("String", getAggregateFunction(eFeatureType, query, "String", aggregateFunction)); |
865 |
distinctOnParams.setDynValue("Bool3", getAggregateFunction(eFeatureType, query, "Bool3", aggregateFunction)); |
866 |
distinctOnParams.setDynValue("Double", getAggregateFunction(eFeatureType, query, "Double", aggregateFunction)); |
867 |
distinctOnParams.setDynValue("Bool4", getAggregateFunction(eFeatureType, query, "Bool4", aggregateFunction)); |
868 |
distinctOnParams.setDynValue("Float", getAggregateFunction(eFeatureType, query, "Float", aggregateFunction)); |
869 |
distinctOnParams.setDynValue("Decimal", getAggregateFunction(eFeatureType, query, "Decimal", aggregateFunction)); |
870 |
distinctOnParams.setDynValue("Geometry", getAggregateFunction(eFeatureType, query, "Geometry", aggregateFunction)); |
871 |
distinctOnParams.setDynValue("Compu1", getAggregateFunction(eFeatureType, query, "Compu1", aggregateFunction)); |
872 |
distinctOnParams.setDynValue("Compu2", getAggregateFunction(eFeatureType, query, "Compu2", aggregateFunction)); |
873 |
distinctOnParams.setDynValue("Extra1", getAggregateFunction(eFeatureType, query, "Extra1", aggregateFunction)); |
874 |
distinctOnParams.setDynValue("Extra2", getAggregateFunction(eFeatureType, query, "Extra2", aggregateFunction)); |
875 |
|
876 |
SearchPostProcess distinctOn = distinctOnFactory.createProcess(distinctOnFactory, dbstore, query, distinctOnParams); |
877 |
SearchPostProcess.SearchPostProcessResult result = distinctOn.execute(dbstore, query, distinctOnParams, null);
|
878 |
|
879 |
FeatureStore resultStore = result.getStore(); |
880 |
|
881 |
List<Feature> features0 = resultStore.getFeatures(query);
|
882 |
ArrayList<Feature> features = new ArrayList<>(); |
883 |
|
884 |
ArrayList<String[]> expected_values = new ArrayList<>(); |
885 |
expected_values.add(new String[]{"0", "0", "", "0", "", "", "", "", "", "", "0,000000", "","0,000000","true","0,000000", "","0", "0", "0", "0"}); |
886 |
expected_values.add(new String[]{"1","10","true","1000","12/29/2019 12:13:14 PM","12/29/2019","12:13:14 PM","true","Yo yo1","false","12345,543210","true","123,209999","true","456,123000","POINT (-3.8945156972987958 42.01053743584765)" ,"2","10000002","1010","30"}); |
887 |
expected_values.add(new String[]{"2","20","true","2000","11/29/2019 12:13:14 PM","11/29/2019","1:13:14 PM" ,"true","Yo yo2","false","12100,543210","true","100,209999","true","456,123000","POINT (-2.1079618220646115 41.983079082675474)" ,"4","20000004","2010","40"}); |
888 |
expected_values.add(new String[]{"3","30","true","3000","10/29/2019 12:13:14 PM","10/29/2019","2:13:14 PM" ,"true","Yo yo3","false","12101,543210","true","101,209999","true","456,123000","POINT (-2.57249737803327 41.35372113353277)" ,"6","30000006","3010","50"}); |
889 |
expected_values.add(new String[]{"4","40","true","4000","09/29/2019 12:13:14 PM","09/29/2019","3:13:14 PM" ,"true","Yo yo4","false","12102,543210","true","102,209999","true","456,123000","POINT (-4.061822048036304 41.35877680235475)" ,"8","40000008","4010","60"}); |
890 |
expected_values.add(new String[]{"5","50","true","5000","08/29/2019 12:13:14 PM","08/29/2019","4:13:14 PM" ,"true","Yo yo5","false","12103,543210","true","103,209999","true","456,123000","POINT (-3.974317066986988 40.78701209315094)" ,"10","50000010","5010","70"}); |
891 |
expected_values.add(new String[]{"6","60","true","6000","07/29/2019 12:13:14 PM","07/29/2019","5:13:14 PM" ,"true","Yo yo6","false","12104,543210","true","104,209999","true","456,123000","POINT (-2.510509736717547 40.69847453392384)" ,"12","60000012","6010","80"}); |
892 |
expected_values.add(new String[]{"7","70","true","7000","06/29/2019 12:13:14 PM","06/29/2019","6:13:14 PM" ,"true","Yo yo7","false","12105,543210","true","105,209999","true","456,123000","POINT (-0.5317736981843011 40.66396082637622)" ,"14","70000014","7010","90"}); |
893 |
expected_values.add(new String[]{"8","80","true","8000","05/29/2019 12:13:14 PM","05/29/2019","7:13:14 PM" ,"true","Yo yo8","false","12106,543210","true","106,209999","true","456,123000","POINT (-0.3626917259170671 41.13652386601604)" ,"16","80000016","8010","100"}); |
894 |
expected_values.add(new String[]{"9","90","true","9000","04/29/2019 12:13:14 PM","04/29/2019","8:13:14 PM" ,"true","Yo yo9","false","12107,543210","true","107,209999","true","456,123000","POINT (-1.2461823078608523 41.84950010180092)" ,"18","90000018","9010","110"}); |
895 |
|
896 |
for (int i = 0; i < features0.size(); i++) { |
897 |
Feature feature = features0.get(i); |
898 |
if( i==0 ) { |
899 |
System.out.println("Expected values:"); |
900 |
for (Object[] expected_line : expected_values) { |
901 |
for (Object cell : expected_line) { |
902 |
System.out.print(cell);
|
903 |
System.out.print(", "); |
904 |
} |
905 |
System.out.println();
|
906 |
} |
907 |
System.out.println("ID,Byte,Bool1,Long,Timestamp,Date,Time,Bool2,String,Bool3,Double,Bool4,Float,Bool5,Decimal,Geometry,Compu1,Compu2,Extra1,Extra2"); |
908 |
} |
909 |
features.add(feature.getCopy()); |
910 |
} |
911 |
System.out.println("ID,Byte,Bool1,Long,Timestamp,Date,Time,Bool2,String,Bool3,Double,Bool4,Float,Bool5,Decimal,Geometry,Compu1,Compu2,Extra1,Extra2"); |
912 |
|
913 |
features0 = null;
|
914 |
String[] header = new String[]{"ID","Byte","Bool1","Long","Timestamp","Date","Time","Bool2","String","Bool3","Double","Bool4","Float","Bool5","Decimal","Geometry","Compu1","Compu2","Extra1","Extra2"}; |
915 |
for (int i = 0; i < features.size(); i++) { |
916 |
for (int j = 0; j < header.length; j++) { |
917 |
assertEquals("feature[" + i + "][" + header[j] + "]:", expected_values.get(i)[j], features.get(i).format(header[j])); |
918 |
} |
919 |
} |
920 |
|
921 |
|
922 |
FeatureType resultType = resultStore.getDefaultFeatureType(); |
923 |
FeatureAttributeDescriptor attr = resultType.getAttributeDescriptor("ID");
|
924 |
assertEquals(DataTypes.LONG, attr.getType()); |
925 |
|
926 |
attr = resultType.getAttributeDescriptor("Byte");
|
927 |
assertEquals(DataTypes.LONG, attr.getType()); |
928 |
assertNull(attr.getAvailableValues()); |
929 |
assertEquals("%d", attr.getDefaultFormat());
|
930 |
|
931 |
attr = resultType.getAttributeDescriptor("Long");
|
932 |
assertEquals(DataTypes.LONG, attr.getType()); |
933 |
assertEquals("%d", attr.getDefaultFormat());
|
934 |
|
935 |
attr = resultType.getAttributeDescriptor("Double");
|
936 |
assertEquals(DataTypes.DOUBLE, attr.getType()); |
937 |
assertEquals("%f", attr.getDefaultFormat());
|
938 |
|
939 |
attr = resultType.getAttributeDescriptor("Float");
|
940 |
assertEquals(DataTypes.DOUBLE, attr.getType()); |
941 |
assertEquals("%f", attr.getDefaultFormat());
|
942 |
|
943 |
attr = resultType.getAttributeDescriptor("Decimal");
|
944 |
assertEquals(DataTypes.DOUBLE, attr.getType()); |
945 |
assertEquals("%f", attr.getDefaultFormat());
|
946 |
|
947 |
DisposeUtils.dispose(dbstore); |
948 |
} catch (Throwable th) { |
949 |
LOGGER.warn("", th);
|
950 |
th.printStackTrace(); |
951 |
throw th;
|
952 |
} |
953 |
} |
954 |
|
955 |
private String getAggregateFunction(FeatureType type, FeatureQuery query, String attrName, AggregateOperationFactory aggregate){ |
956 |
|
957 |
FeatureAttributeDescriptor attr = type.getAttributeDescriptor(attrName); |
958 |
if(attr == null){ |
959 |
attr = query.getExtraColumns().get(attrName); |
960 |
} |
961 |
LOGGER.info(attrName); |
962 |
if(aggregate.isApplicable(attr.getObjectClass())){
|
963 |
LOGGER.info(attrName+", "+ aggregate.getName());
|
964 |
return aggregate.getName();
|
965 |
} else {
|
966 |
LOGGER.info(attrName+", "+ FirstAggregateOperationFactory.NAME);
|
967 |
return FirstAggregateOperationFactory.NAME;
|
968 |
} |
969 |
|
970 |
|
971 |
|
972 |
} |
973 |
|
974 |
} |