ACS-1425 Get stores at start of query (#421)

* ACS-1425 Get stores at start of query

* ACS-1425 Get stores at start of query

* ACS-1425 Get stores at start of accelerated query

* ACS-1425 Tidy up
This commit is contained in:
Sara
2021-04-29 10:25:41 +01:00
committed by GitHub
parent e5770ddfda
commit 96ef362d6d

View File

@@ -35,6 +35,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import javax.annotation.concurrent.NotThreadSafe;
@@ -112,6 +113,8 @@ public class DBQueryEngine implements QueryEngine
private long maxPermissionCheckTimeMillis;
protected EntityLookupCache<Long, Node, NodeRef> nodesCache;
private List<Pair<Long, StoreRef>> stores;
AclCrudDAO aclCrudDAO;
@@ -314,6 +317,9 @@ public class DBQueryEngine implements QueryEngine
FilteringResultSet acceleratedNodeSelection(QueryOptions options, DBQuery dbQuery, NodePermissionAssessor permissionAssessor)
{
// get list of stores from database
stores = nodeDAO.getStores();
List<Node> nodes = new ArrayList<>();
int requiredNodes = computeRequiredNodesCount(options);
@@ -464,10 +470,9 @@ public class DBQueryEngine implements QueryEngine
{
StoreEntity storeEntity = node.getStore();
logger.debug("Adding store info for store id " + storeEntity.getId());
List<Pair<Long, StoreRef>> stores = nodeDAO.getStores();
for (Pair<Long, StoreRef> storeRefPair : stores)
{
if (storeEntity.getId() == storeRefPair.getFirst())
if (Objects.equals(storeEntity.getId(), storeRefPair.getFirst()))
{
StoreRef storeRef = storeRefPair.getSecond();
storeEntity.setIdentifier(storeRef.getIdentifier());
@@ -477,4 +482,4 @@ public class DBQueryEngine implements QueryEngine
}
}
}
}
}