/// full scan private ArrayList<JsonObject> FullScan(FilterExpression expression) { ArrayList<JsonObject> list = new ArrayList<JsonObject>(); String globalName = Utils.TableNameToGlobalsName( TableName + SchemaManager.Instance().GetProjectPrefix(ProjectId)); NodeReference node = ConnectionManager.Instance().getConnection().createNodeReference(globalName); Long key = (long) 0; while (true) { String strKey = node.nextSubscript(key); if (strKey.equals("")) break; key = Long.parseLong(strKey); String nodeValue = node.getObject(key, "JSON").toString(); JsonObject obj = new JsonParser().parse(nodeValue).getAsJsonObject(); if (expression == null) { list.add(obj); } else { if (expression.IsValid(obj)) { list.add(obj); } } } return list; }
/// filter sub set private ArrayList<JsonObject> ScanSet(FilterExpression expression, ArrayList<Long> setToScan) { ArrayList<JsonObject> list = new ArrayList<JsonObject>(); String globalName = Utils.TableNameToGlobalsName( TableName + SchemaManager.Instance().GetProjectPrefix(ProjectId)); NodeReference node = ConnectionManager.Instance().getConnection().createNodeReference(globalName); for (int i = 0; i < setToScan.size(); i++) { String nodeValue = node.getObject(setToScan.get(i), "JSON").toString(); JsonObject obj = new JsonParser().parse(nodeValue).getAsJsonObject(); if (expression == null) { list.add(obj); } else { if (expression.IsValid(obj)) { list.add(obj); } } } return list; }