|
62 | 62 | /**
|
63 | 63 | * This class is the main access point to saved searches. It loads
|
64 | 64 | * saved searches from the db, and keeps them in a weak cache.
|
| 65 | + * |
| 66 | + * We only provide the basics to implement saved search functionality |
| 67 | + * at this level. The functionality must be enabled at the higher |
| 68 | + * layer, REST or embedded application layers. |
| 69 | + * |
| 70 | + * The implementation should: |
| 71 | + * <ul> |
| 72 | + * <li>Instantiate a singleton instance of the SavedSearchCache. This |
| 73 | + * should be shared among all threads.</li> |
| 74 | + * <li>Determine the name of the saved search, the entity, and its version. |
| 75 | + * The saved search name is meaningful only with its associated entity<li?. |
| 76 | + * <li>Retrieve the saved search document using SavedSearchCache.getSavedSearch</li> |
| 77 | + * <li>Collect the query parameters, and fill in defaults using FindRequestBuilder.fillDefaults</li> |
| 78 | + * <li>Prepare a FindRequest using FindRequestBuilder.buildRequest.</li> |
| 79 | + * <li>Call find()</li> |
| 80 | + * </ul> |
65 | 81 | */
|
66 | 82 | public class SavedSearchCache {
|
67 | 83 | private static final Logger LOGGER = LoggerFactory.getLogger(SavedSearchCache.class);
|
@@ -166,11 +182,11 @@ private void initializeCache(String spec) {
|
166 | 182 | * In case of retrieval error, a RetrievalError is thrown
|
167 | 183 | * containing the errors.
|
168 | 184 | */
|
169 |
| - public JsonNode retrieveFromDB(Mediator m, |
170 |
| - ClientIdentification clid, |
171 |
| - String searchName, |
172 |
| - String entity, |
173 |
| - String version) { |
| 185 | + public JsonNode getSavedSearchFromDB(Mediator m, |
| 186 | + ClientIdentification clid, |
| 187 | + String searchName, |
| 188 | + String entity, |
| 189 | + String version) { |
174 | 190 |
|
175 | 191 | FindRequest findRequest=new FindRequest();
|
176 | 192 | findRequest.setEntityVersion(new EntityVersion(savedSearchEntity,savedSearchVersion));
|
@@ -246,7 +262,7 @@ public JsonNode getSavedSearch(Mediator m,
|
246 | 262 | }
|
247 | 263 | if(doc==null) {
|
248 | 264 | LOGGER.debug("Loading {} from DB",searchName);
|
249 |
| - JsonNode node=retrieveFromDB(m,clid,searchName,entity,loadVersion); |
| 265 | + JsonNode node=getSavedSearchFromDB(m,clid,searchName,entity,loadVersion); |
250 | 266 | if(node instanceof ObjectNode) {
|
251 | 267 | LOGGER.debug("Loaded a single search");
|
252 | 268 | doc=(ObjectNode)node;
|
|
0 commit comments