/** * Returns the set of properties set for the source or provider given in the query (if any). * * If the query has not set sourceName or providerName, null will be returned */ public static Properties getSourceProperties(Query query) { String sourceName = query.properties().getString(SOURCENAME); String providerName = query.properties().getString(PROVIDERNAME); if (sourceName == null || providerName == null) return null; Properties sourceProperties = new SubProperties("source." + sourceName, query.properties()); Properties providerProperties = new SubProperties("provider." + providerName, query.properties()); sourceProperties.chain(providerProperties); return sourceProperties; }
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(); }