Line 27... |
Line 27... |
27 |
import org.openconcerto.sql.model.SQLSelectJoin;
|
27 |
import org.openconcerto.sql.model.SQLSelectJoin;
|
28 |
import org.openconcerto.sql.model.SQLTable;
|
28 |
import org.openconcerto.sql.model.SQLTable;
|
29 |
import org.openconcerto.sql.model.Where;
|
29 |
import org.openconcerto.sql.model.Where;
|
30 |
import org.openconcerto.utils.CompareUtils;
|
30 |
import org.openconcerto.utils.CompareUtils;
|
31 |
import org.openconcerto.utils.ListMap;
|
31 |
import org.openconcerto.utils.ListMap;
|
- |
|
32 |
import org.openconcerto.utils.Tuple2;
|
32 |
import org.openconcerto.utils.cc.ITransformer;
|
33 |
import org.openconcerto.utils.cc.ITransformer;
|
33 |
|
34 |
|
34 |
import java.math.BigDecimal;
|
35 |
import java.math.BigDecimal;
|
35 |
import java.util.ArrayList;
|
36 |
import java.util.ArrayList;
|
36 |
import java.util.Collections;
|
37 |
import java.util.Collections;
|
37 |
import java.util.Comparator;
|
38 |
import java.util.Comparator;
|
38 |
import java.util.HashMap;
|
39 |
import java.util.HashMap;
|
39 |
import java.util.List;
|
40 |
import java.util.List;
|
40 |
import java.util.Map;
|
41 |
import java.util.Map;
|
41 |
|
42 |
|
- |
|
43 |
import org.jdom2.Element;
|
- |
|
44 |
|
42 |
public class OOXMLCache {
|
45 |
public class OOXMLCache {
|
43 |
|
46 |
|
44 |
private ITransformer<List<SQLRowAccessor>, List<SQLRowAccessor>> postProcess = null;
|
47 |
private ITransformer<List<SQLRowAccessor>, List<SQLRowAccessor>> postProcess = null;
|
45 |
private Map<SQLRowAccessor, Map<SQLTable, List<SQLRowAccessor>>> cacheReferent = new HashMap<SQLRowAccessor, Map<SQLTable, List<SQLRowAccessor>>>();
|
48 |
private Map<SQLRowAccessor, Map<SQLTable, List<SQLRowAccessor>>> cacheReferent = new HashMap<SQLRowAccessor, Map<SQLTable, List<SQLRowAccessor>>>();
|
46 |
private Map<String, Map<Integer, SQLRowAccessor>> cacheForeign = new HashMap<String, Map<Integer, SQLRowAccessor>>();
|
49 |
private Map<String, Map<Integer, SQLRowAccessor>> cacheForeign = new HashMap<String, Map<Integer, SQLRowAccessor>>();
|
- |
|
50 |
private Map<Tuple2<String, SQLRowAccessor>, OOXMLTableImage> cacheImg = new HashMap<>();
|
47 |
|
51 |
|
48 |
public void setPostProcess(ITransformer<List<SQLRowAccessor>, List<SQLRowAccessor>> postProcess) {
|
52 |
public void setPostProcess(ITransformer<List<SQLRowAccessor>, List<SQLRowAccessor>> postProcess) {
|
49 |
this.postProcess = postProcess;
|
53 |
this.postProcess = postProcess;
|
50 |
}
|
54 |
}
|
51 |
|
55 |
|
- |
|
56 |
public OOXMLTableImage getOOXMLTableImage(OOXMLElement x, Element e, SQLRowAccessor r) {
|
- |
|
57 |
Tuple2<String, SQLRowAccessor> key = Tuple2.create(e.getAttributeValue("fieldPathEDM"), r);
|
- |
|
58 |
if (this.cacheImg.containsKey(key)) {
|
- |
|
59 |
return this.cacheImg.get(key);
|
- |
|
60 |
} else {
|
- |
|
61 |
OOXMLTableImage img = new OOXMLTableImage(x, e, r);
|
- |
|
62 |
this.cacheImg.put(key, img);
|
- |
|
63 |
return img;
|
- |
|
64 |
}
|
- |
|
65 |
}
|
- |
|
66 |
|
52 |
protected SQLRowAccessor getForeignRow(SQLRowAccessor row, SQLField field) {
|
67 |
protected SQLRowAccessor getForeignRow(SQLRowAccessor row, SQLField field) {
|
53 |
Map<Integer, SQLRowAccessor> c = cacheForeign.get(field.getName());
|
68 |
Map<Integer, SQLRowAccessor> c = cacheForeign.get(field.getName());
|
54 |
|
69 |
|
55 |
if (row.getObject(field.getName()) == null) {
|
70 |
if (row.getObject(field.getName()) == null) {
|
56 |
return null;
|
71 |
return null;
|