summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
93c9708)
This adds the proper types to map, removing some casts and improving
efficiency slightly. Fixes quite a few of eclipse warnings.
Change-Id: Ia8cc61961a1898dd17e4e5d0e6e7a247475a007a
Signed-off-by: Robert Varga <rovarga@cisco.com>
}
return result;
} else if (Map.class.isAssignableFrom(o.getClass())) {
}
return result;
} else if (Map.class.isAssignableFrom(o.getClass())) {
+ Map<?, ?> map = (Map<?, ?>) o;
for (Object oo : map.values()) {
addToResult(result, execute(oo));
}
for (Object oo : map.values()) {
addToResult(result, execute(oo));
}
result.add(oo);
}
} else if (Map.class.isAssignableFrom(o.getClass())) {
result.add(oo);
}
} else if (Map.class.isAssignableFrom(o.getClass())) {
+ Map<?, ?> map = (Map<?, ?>) o;
for (Object oo : map.values()) {
result.add(oo);
}
for (Object oo : map.values()) {
result.add(oo);
}
public static final int TYPE_METADATA_REPLY = 7;
private JDBCResultSet rs = null;
public static final int TYPE_METADATA_REPLY = 7;
private JDBCResultSet rs = null;
- private Map record = null;
+ private Map<String, Object> record = null;
private int rsID = -1;
private Exception err = null;
private XSQLBluePrint bluePrint = null;
private int rsID = -1;
private Exception err = null;
private XSQLBluePrint bluePrint = null;
this.rsID = rs.getID();
}
this.rsID = rs.getID();
}
- public JDBCCommand(Map _record, int _rsID) {
+ public JDBCCommand(Map<String, Object> _record, int _rsID) {
this.record = _record;
this.rsID = _rsID;
this.type = TYPE_QUERY_RECORD;
this.record = _record;
this.rsID = _rsID;
this.type = TYPE_QUERY_RECORD;
- public Map getRecord() {
+ public Map<String, Object> getRecord() {
private List<XSQLBluePrintNode> tablesInQuery = new ArrayList<XSQLBluePrintNode>();
private Map<String, XSQLBluePrintNode> tablesInQueryMap = new ConcurrentHashMap<String, XSQLBluePrintNode>();
private List<XSQLColumn> fieldsInQuery = new ArrayList<XSQLColumn>();
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);
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) {
Map<XSQLColumn, List<XSQLCriteria>> tblCriteria = criteria
.get(tableName);
if (tblCriteria == null) {
return this.records.size();
}
return this.records.size();
}
- public void addRecord(Map r) {
+ public void addRecord(Map<String, Object> r) {
synchronized (this) {
if (records == null) {
synchronized (this) {
if (records == null) {
- records = new LinkedList<Map>();
+ records = new LinkedList<>();
}
records.add(r);
this.notifyAll();
}
records.add(r);
this.notifyAll();
}
public void addRecord(ArrayList<?> hierarchy) {
}
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) {
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) {
public boolean next() {
this.currentRecord = null;
if (records == null) {
- records = new LinkedList<Map>();
+ records = new LinkedList<>();
}
while (!finished || records.size() > 0) {
synchronized (this) {
}
while (!finished || records.size() > 0) {
synchronized (this) {
- public Map getCurrent() {
+ public Map<String, Object> getCurrent() {
return this.currentRecord;
}
private void createRecord(Object data, XSQLBluePrintNode node) {
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 {
for (XSQLColumn c : this.fieldsInQuery) {
if (c.getTableName().equals(node.getBluePrintNodeName())) {
try {
}
public static class Record {
}
public static class Record {
- public Map data = new HashMap();
+ public Map<String, Object> data = new HashMap<>();
public Object element = null;
public Object element = null;
- public Map getRecord() {
+ public Map<String, Object> getRecord() {
- 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")) {
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")) {
for (Object key : values.keySet()) {
Object val = values.get(key);
if (val.getClass().getName().endsWith("ImmutableLeafNode")) {
}
private void addToData(Record rec, XSQLBluePrintNode bpn,
}
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));
XSQLBluePrintNode eNodes[] = bluePrint
.getBluePrintNodeByODLTableName(XSQLODLUtils
.getNodeIdentiofier(rec.element));
.getBluePrintNodeName());
if (this.criteria.containsKey(bluePrintNode.getBluePrintNodeName())
|| bpn != null) {
.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;
if (!(isObjectFitCriteria(allKeyValues,
bpn.getBluePrintNodeName()) == 1)) {
return EMPTY_RESULT;
}
boolean isObjectInCriteria = true;
if (bpn != null) {
}
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);
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.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 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;
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()) {
}
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);
}
newRec.putAll(rec);
rs.addRecord(newRec);
}
rs.getFields().addAll(columnOrder);
for (Map.Entry<String, JDBCResultSet> entry : rs.getSubQueries().entrySet()) {
while (entry.getValue().next()) {
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();
Object value = e.getValue();
- String logicalKey = origNameToName.get(key);
+ String logicalKey = origNameToName.get(e.getKey());
if (value != null && logicalKey != null) {
newRec.put(logicalKey, value);
}
if (value != null && logicalKey != null) {
newRec.put(logicalKey, value);
}