@Override public PrefetchTreeNode newMessage() { return new PrefetchTreeNode(); }
/** * Adds a joint prefetch. * * @since 4.0 */ void mergePrefetch(PrefetchTreeNode node) { if (prefetchTree == null) { prefetchTree = new PrefetchTreeNode(); } prefetchTree.merge(node); }
/** * Merges prefetch into the query prefetch tree. * * @return this object */ public SelectById<T> prefetch(PrefetchTreeNode prefetch) { if (prefetch == null) { return this; } if (prefetches == null) { prefetches = new PrefetchTreeNode(); } prefetches.merge(prefetch); return this; }
/** * Merges prefetch into the query prefetch tree. * * @return this object */ public ColumnSelect<T> prefetch(PrefetchTreeNode prefetch) { if (prefetch == null) { return this; } if (prefetches == null) { prefetches = new PrefetchTreeNode(); } prefetches.merge(prefetch); replacementQuery = null; return this; }
/** * Merges prefetch into the query prefetch tree. * * @return this object */ public ObjectSelect<T> prefetch(PrefetchTreeNode prefetch) { if (prefetch == null) { return this; } if (prefetches == null) { prefetches = new PrefetchTreeNode(); } prefetches.merge(prefetch); replacementQuery = null; return this; }
/** * Adds a "path" with specified semantics to this prefetch node. All yet * non-existent nodes in the created path will be marked as phantom. * * @return the last segment in the created path. */ public PrefetchTreeNode addPath(String path) { if (Util.isEmptyString(path)) { throw new IllegalArgumentException("Empty path: " + path); } PrefetchTreeNode node = this; StringTokenizer toks = new StringTokenizer(path, Entity.PATH_SEPARATOR); while (toks.hasMoreTokens()) { String segment = toks.nextToken(); PrefetchTreeNode child = node.getChild(segment); if (child == null) { child = new PrefetchTreeNode(node, segment); node.addChild(child); } node = child; } return node; }
/** * Merges a prefetch path with specified semantics into the query prefetch * tree. * * @return this object */ public ColumnSelect<T> prefetch(String path, int semantics) { if (path == null) { return this; } if (prefetches == null) { prefetches = new PrefetchTreeNode(); } prefetches.addPath(path).setSemantics(semantics); replacementQuery = null; return this; }
/** * Merges a prefetch path with specified semantics into the query prefetch * tree. * * @return this object */ public SelectById<T> prefetch(String path, int semantics) { if (path == null) { return this; } if (prefetches == null) { prefetches = new PrefetchTreeNode(); } prefetches.addPath(path).setSemantics(semantics); return this; }
/** * Merges a prefetch path with specified semantics into the query prefetch * tree. * * @return this object */ public ObjectSelect<T> prefetch(String path, int semantics) { if (path == null) { return this; } if (prefetches == null) { prefetches = new PrefetchTreeNode(); } prefetches.addPath(path).setSemantics(semantics); replacementQuery = null; return this; }
/** * Adds a "path" with specified semantics to this prefetch node. All yet non-existent * nodes in the created path will be marked as phantom. * * @return the last segment in the created path. */ public PrefetchTreeNode addPath(String path) { if (Util.isEmptyString(path)) { throw new IllegalArgumentException("Empty path: " + path); } PrefetchTreeNode node = this; StringTokenizer toks = new StringTokenizer(path, Entity.PATH_SEPARATOR); while (toks.hasMoreTokens()) { String segment = toks.nextToken(); PrefetchTreeNode child = node.getChild(segment); if (child == null) { child = new PrefetchTreeNode(node, segment); node.addChild(child); } node = child; } return node; }
/** * Creates and returns a prefetch tree spanning a single path. The tree is * made of phantom nodes, up to the leaf node, which is non-phantom and has * specified semantics. * * @since 4.0 */ public static PrefetchTreeNode withPath(String path, int semantics) { PrefetchTreeNode root = new PrefetchTreeNode(); PrefetchTreeNode node = root.addPath(path); node.setPhantom(false); node.setSemantics(semantics); return root; }
/** * Adds a joint prefetch. * * @since 1.2 */ PrefetchTreeNode addPrefetch(String path, int semantics) { if (prefetchTree == null) { prefetchTree = new PrefetchTreeNode(); } PrefetchTreeNode node = prefetchTree.addPath(path); node.setSemantics(semantics); node.setPhantom(false); return node; }
/** * Adds a joint prefetch. * * @since 1.2 */ PrefetchTreeNode addPrefetch(String path, int semantics) { if (prefetchTree == null) { prefetchTree = new PrefetchTreeNode(); } PrefetchTreeNode node = prefetchTree.addPath(path); node.setSemantics(semantics); node.setPhantom(false); return node; }
protected PrefetchProcessorNode toResultsTree(ClassDescriptor descriptor, PrefetchTreeNode prefetchTree, List<Object[]> rows, int position) { List<DataRow> rowsColumn = new ArrayList<>(rows.size()); for (Object[] row : rows) { rowsColumn.add((DataRow) row[position]); } if (prefetchTree != null) { PrefetchTreeNode prefetchTreeNode = null; for (PrefetchTreeNode prefetch : prefetchTree.getChildren()) { if (descriptor.getEntity().getName().equals(prefetch.getEntityName())) { if (prefetchTreeNode == null) { prefetchTreeNode = new PrefetchTreeNode(); } PrefetchTreeNode addPath = prefetchTreeNode.addPath(prefetch.getPath()); addPath.setSemantics(prefetch.getSemantics()); addPath.setPhantom(false); } } prefetchTree = prefetchTreeNode; } if (prefetchTree == null) { return new ObjectResolver(context, descriptor, metadata.isRefreshingObjects()) .synchronizedRootResultNodeFromDataRows(rowsColumn); } else { HierarchicalObjectResolver resolver = new HierarchicalObjectResolver(context, metadata, descriptor, true); return resolver.synchronizedRootResultNodeFromDataRows(prefetchTree, rowsColumn, prefetchResultsByPath); } }
private PrefetchTreeNode cloneJointSubtree(PrefetchTreeNode parent) { PrefetchTreeNode cloned = new PrefetchTreeNode(parent, getName()); if (parent != null) { cloned.setSemantics(getSemantics()); cloned.setPhantom(isPhantom()); } if (children != null) { for (PrefetchTreeNode child : children) { if (child.isJointPrefetch()) { cloned.addChild(child.cloneJointSubtree(cloned)); } } } return cloned; }
private void prepareFetchJoin(EJBQLJoin join) { if (prefetchTree == null) { prefetchTree = new PrefetchTreeNode(); } EJBQLPath fetchJoin = (EJBQLPath) join.getChild(0); addPath(fetchJoin); PrefetchTreeNode node = prefetchTree.addPath(fetchJoin.getRelativePath()); node.setSemantics(PrefetchTreeNode.JOINT_PREFETCH_SEMANTICS); node.setPhantom(false); node.setEjbqlPathEntityId(fetchJoin.getChild(0).getText()); }
private PrefetchTreeNode deepClone(PrefetchTreeNode source, PrefetchTreeNode targetParent) { PrefetchTreeNode target = new PrefetchTreeNode(targetParent, source.getName()); target.setEjbqlPathEntityId(source.getEjbqlPathEntityId()); target.setEntityName(source.getEntityName()); target.setPhantom(source.isPhantom()); target.setSemantics(source.getSemantics()); for (PrefetchTreeNode child : source.getChildren()) { target.addChild(deepClone(child, target)); } return target; }
PrefetchTreeNode prefetchTree = new PrefetchTreeNode();
PrefetchTreeNode root = new PrefetchTreeNode();