private List<XSQLBluePrintNode> tablesInQuery = new ArrayList<XSQLBluePrintNode>();
private Map<String, XSQLBluePrintNode> tablesInQueryMap = new ConcurrentHashMap<String, XSQLBluePrintNode>();
private List<XSQLColumn> fieldsInQuery = new ArrayList<XSQLColumn>();
- private transient LinkedList<Map> records = new LinkedList<Map>();
- private transient Map currentRecord = null;
+ private transient LinkedList<Map<String, Object>> records = new LinkedList<>();
+ private transient Map<String, Object> currentRecord = null;
private boolean finished = false;
private int id = 0;
private static Integer nextID = new Integer(0);
}
}
- public int isObjectFitCriteria(Map objValues, String tableName) {
+ public int isObjectFitCriteria(Map<String, Object> objValues, String tableName) {
Map<XSQLColumn, List<XSQLCriteria>> tblCriteria = criteria
.get(tableName);
if (tblCriteria == null) {
return this.records.size();
}
- public void addRecord(Map r) {
+ public void addRecord(Map<String, Object> r) {
synchronized (this) {
if (records == null) {
- records = new LinkedList<Map>();
+ records = new LinkedList<>();
}
records.add(r);
this.notifyAll();
}
public void addRecord(ArrayList<?> hierarchy) {
- Map rec = new HashMap();
+ Map<String, Object> rec = new HashMap<>();
for (int i = hierarchy.size() - 1; i >= 0; i--) {
Object element = hierarchy.get(i);
for (XSQLColumn c : fieldsInQuery) {
public boolean next() {
this.currentRecord = null;
if (records == null) {
- records = new LinkedList<Map>();
+ records = new LinkedList<>();
}
while (!finished || records.size() > 0) {
synchronized (this) {
return false;
}
- public Map getCurrent() {
+ public Map<String, Object> getCurrent() {
return this.currentRecord;
}
private void createRecord(Object data, XSQLBluePrintNode node) {
- Map rec = new HashMap();
+ Map<String, Object> rec = new HashMap<>();
for (XSQLColumn c : this.fieldsInQuery) {
if (c.getTableName().equals(node.getBluePrintNodeName())) {
try {
}
public static class Record {
- public Map data = new HashMap();
+ public Map<String, Object> data = new HashMap<>();
public Object element = null;
- public Map getRecord() {
+ public Map<String, Object> getRecord() {
return this.data;
}
}
- private Map collectColumnValues(Object node, XSQLBluePrintNode bpn) {
- Map subChildren = XSQLODLUtils.getChildren(node);
- Map result = new HashMap();
+ private Map<String, Object> collectColumnValues(Object node, XSQLBluePrintNode bpn) {
+ Map<?, ?> subChildren = XSQLODLUtils.getChildren(node);
+ Map<String, Object> result = new HashMap<>();
for (Object stc : subChildren.values()) {
if (stc.getClass().getName().endsWith("ImmutableAugmentationNode")) {
- Map values = XSQLODLUtils.getChildren(stc);
+ Map<?, ?> values = XSQLODLUtils.getChildren(stc);
for (Object key : values.keySet()) {
Object val = values.get(key);
if (val.getClass().getName().endsWith("ImmutableLeafNode")) {
}
private void addToData(Record rec, XSQLBluePrintNode bpn,
- XSQLBluePrint bluePrint, Map fullRecord) {
+ XSQLBluePrint bluePrint, Map<String, Object> fullRecord) {
XSQLBluePrintNode eNodes[] = bluePrint
.getBluePrintNodeByODLTableName(XSQLODLUtils
.getNodeIdentiofier(rec.element));
.getBluePrintNodeName());
if (this.criteria.containsKey(bluePrintNode.getBluePrintNodeName())
|| bpn != null) {
- Map<?, ?> allKeyValues = collectColumnValues(element, bpn);
+ Map<String, Object> allKeyValues = collectColumnValues(element, bpn);
if (!(isObjectFitCriteria(allKeyValues,
bpn.getBluePrintNodeName()) == 1)) {
return EMPTY_RESULT;
}
boolean isObjectInCriteria = true;
if (bpn != null) {
- Map allKeyValues = collectColumnValues(rec.element, bpn);
+ Map<String, Object> allKeyValues = collectColumnValues(rec.element, bpn);
if ((isObjectFitCriteria(allKeyValues,
bpn.getBluePrintNodeName()) == 1)) {
addToData(rec, bpn, bluePrint, allKeyValues);
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.concurrent.ConcurrentHashMap;
-
import org.opendaylight.controller.md.sal.dom.xsql.XSQLAdapter;
import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrint;
import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrintNode;
}
rs.getFields().addAll(entry.getValue().getFields());
while (entry.getValue().next()) {
- Map rec = entry.getValue().getCurrent();
- Map newRec = new HashMap();
+ Map<String, Object> rec = entry.getValue().getCurrent();
+ Map<String, Object> newRec = new HashMap<>();
newRec.putAll(rec);
rs.addRecord(newRec);
}
rs.getFields().addAll(columnOrder);
for (Map.Entry<String, JDBCResultSet> entry : rs.getSubQueries().entrySet()) {
while (entry.getValue().next()) {
- Map rec = entry.getValue().getCurrent();
- Map newRec = new HashMap();
- for (Iterator<?> iter = rec.entrySet().iterator(); iter.hasNext();) {
- Map.Entry e = (Map.Entry) iter.next();
- String key = (String) e.getKey();
+ Map<String, Object> rec = entry.getValue().getCurrent();
+ Map<String, Object> newRec = new HashMap<>();
+ for (Map.Entry<String, Object> e : rec.entrySet()) {
Object value = e.getValue();
- String logicalKey = origNameToName.get(key);
+ String logicalKey = origNameToName.get(e.getKey());
if (value != null && logicalKey != null) {
newRec.put(logicalKey, value);
}