Skip to content

Commit 728ac85

Browse files
author
Burak Serdar
committed
Tweaks and documentation after review
1 parent b6ae2fb commit 728ac85

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

misc/src/main/java/com/redhat/lightblue/savedsearch/SavedSearchCache.java

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,22 @@
6262
/**
6363
* This class is the main access point to saved searches. It loads
6464
* 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>
6581
*/
6682
public class SavedSearchCache {
6783
private static final Logger LOGGER = LoggerFactory.getLogger(SavedSearchCache.class);
@@ -166,11 +182,11 @@ private void initializeCache(String spec) {
166182
* In case of retrieval error, a RetrievalError is thrown
167183
* containing the errors.
168184
*/
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) {
174190

175191
FindRequest findRequest=new FindRequest();
176192
findRequest.setEntityVersion(new EntityVersion(savedSearchEntity,savedSearchVersion));
@@ -246,7 +262,7 @@ public JsonNode getSavedSearch(Mediator m,
246262
}
247263
if(doc==null) {
248264
LOGGER.debug("Loading {} from DB",searchName);
249-
JsonNode node=retrieveFromDB(m,clid,searchName,entity,loadVersion);
265+
JsonNode node=getSavedSearchFromDB(m,clid,searchName,entity,loadVersion);
250266
if(node instanceof ObjectNode) {
251267
LOGGER.debug("Loaded a single search");
252268
doc=(ObjectNode)node;

misc/src/main/metadata/lb-saved-search.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
"constraints":{
143143
"required":true
144144
},
145-
"description":"The query. Bound parameters are given as ${parameter}. This could be a strig, or json "
145+
"description":"The query. Bound parameters are given as ${parameter}. This could be a string, or json "
146146
},
147147
"projection":{
148148
"type":"any"

0 commit comments

Comments
 (0)