/** The query owning this property object. * Only guaranteed to work if this instance is accessible as query.properties() */ public Query getParentQuery() { if (chained() == null) { throw new RuntimeException("getParentQuery should only be called on a properties instance accessible as query.properties()"); } else { return chained().getParentQuery(); } }
private void copyPropertiesTo(Query clone) { clone.model = model.cloneFor(clone); clone.select = select.cloneFor(clone); clone.ranking = (Ranking) ranking.clone(); clone.presentation = (Presentation) presentation.clone(); clone.context = getContext(true).cloneFor(clone); // Correct the Query instance in properties clone.properties().setParentQuery(clone); assert (clone.properties().getParentQuery() == clone); clone.setTraceLevel(getTraceLevel()); clone.setHits(getHits()); clone.setOffset(getOffset()); clone.setNoCache(getNoCache()); clone.setGroupingSessionCache(getGroupingSessionCache()); clone.requestId = null; // Each clone should have their own requestId. }