#1738 - Refactor tidy internals - DLoadContext

This commit is contained in:
rob bygrave
2019-06-28 21:20:42 +12:00
parent a932d61a94
commit 270369bd65
@@ -49,7 +49,7 @@ public class DLoadContext implements LoadContext {
private final boolean disableLazyLoading;
private final boolean disableReadAudit;
private final boolean includeSoftDeletes;
protected final boolean useDocStore;
final boolean useDocStore;
/**
* The path relative to the root of the object graph.
@@ -137,7 +137,7 @@ public class DLoadContext implements LoadContext {
/**
* Return the query plan label of the origin query.
*/
public String getPlanLabel() {
String getPlanLabel() {
return planLabel;
}
@@ -180,7 +180,7 @@ public class DLoadContext implements LoadContext {
registerSecondaryNode(many, props);
}
protected boolean isBeanCacheGet() {
boolean isBeanCacheGet() {
return useBeanCache.isGet();
}
@@ -247,7 +247,7 @@ public class DLoadContext implements LoadContext {
return new ObjectGraphNode(origin, path);
}
protected String getFullPath(String path) {
String getFullPath(String path) {
if (relativePath == null) {
return path;
} else {
@@ -295,12 +295,11 @@ public class DLoadContext implements LoadContext {
getManyContext(path).register(bc);
}
protected DLoadBeanContext getBeanContext(String path) {
DLoadBeanContext getBeanContext(String path) {
if (path == null) {
return rootBeanContext;
}
DLoadBeanContext beanContext = beanMap.computeIfAbsent(path, p -> createBeanContext(p, defaultBatchSize, null));
return beanContext;
return beanMap.computeIfAbsent(path, p -> createBeanContext(p, defaultBatchSize, null));
}
private void registerSecondaryNode(boolean many, OrmQueryProperties props) {
@@ -321,27 +320,23 @@ public class DLoadContext implements LoadContext {
}
}
protected DLoadManyContext getManyContext(String path) {
DLoadManyContext getManyContext(String path) {
if (path == null) {
throw new RuntimeException("path is null?");
}
DLoadManyContext ctx = manyMap.computeIfAbsent(path, p -> createManyContext(p, defaultBatchSize, null));
return ctx;
return manyMap.computeIfAbsent(path, p -> createManyContext(p, defaultBatchSize, null));
}
private DLoadManyContext createManyContext(String path, int batchSize, OrmQueryProperties queryProps) {
BeanPropertyAssocMany<?> p = (BeanPropertyAssocMany<?>) getBeanProperty(rootDescriptor, path);
return new DLoadManyContext(this, p, path, batchSize, queryProps);
}
private DLoadBeanContext createBeanContext(String path, int batchSize, OrmQueryProperties queryProps) {
BeanPropertyAssoc<?> p = (BeanPropertyAssoc<?>) getBeanProperty(rootDescriptor, path);
BeanDescriptor<?> targetDescriptor = p.getTargetDescriptor();
return new DLoadBeanContext(this, targetDescriptor, path, batchSize, queryProps);
return new DLoadBeanContext(this, p.getTargetDescriptor(), path, batchSize, queryProps);
}
private BeanProperty getBeanProperty(BeanDescriptor<?> desc, String path) {
@@ -351,7 +346,7 @@ public class DLoadContext implements LoadContext {
/**
* Propagate the original query settings (draft, asOf etc) to the secondary queries.
*/
public void propagateQueryState(SpiQuery<?> query, boolean docStoreMapped) {
void propagateQueryState(SpiQuery<?> query, boolean docStoreMapped) {
if (useDocStore && docStoreMapped) {
query.setUseDocStore(true);
}