public void setParentQuery(Query query) { this.query=query; super.setParentQuery(query); }
/** * Invoked during deep cloning of the parent query. */ public void setParentQuery(Query query) { if (chained() != null) chained().setParentQuery(query); } }
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. }
private void init(Map<String, String> requestMap, CompiledQueryProfile queryProfile) { startTime = System.currentTimeMillis(); if (queryProfile != null) { // Move all request parameters to the query profile just to validate that the parameter settings are legal Properties queryProfileProperties = new QueryProfileProperties(queryProfile); properties().chain(queryProfileProperties); // TODO: Just checking legality rather than actually setting would be faster setPropertiesFromRequestMap(requestMap, properties()); // Adds errors to the query for illegal set attempts // Create the full chain properties().chain(new QueryProperties(this, queryProfile.getRegistry())). chain(new ModelObjectMap()). chain(new RequestContextProperties(requestMap)). chain(queryProfileProperties). chain(new DefaultProperties()); // Pass the values from the query profile which maps through a field in the Query object model // through the property chain to cause those values to be set in the Query object model setFieldsFrom(queryProfileProperties, requestMap); } else { // bypass these complications if there is no query profile to get values from and validate against properties(). chain(new QueryProperties(this, CompiledQueryProfileRegistry.empty)). chain(new PropertyMap()). chain(new DefaultProperties()); setPropertiesFromRequestMap(requestMap, properties()); } properties().setParentQuery(this); traceProperties(); }