use of org.xel.TaggedData in project elastic-core-maven by OrdinaryDude.
the class GetAllTaggedData method processRequest.
@Override
protected JSONStreamAware processRequest(HttpServletRequest req) throws NxtException {
int firstIndex = ParameterParser.getFirstIndex(req);
int lastIndex = ParameterParser.getLastIndex(req);
boolean includeData = "true".equalsIgnoreCase(req.getParameter("includeData"));
JSONObject response = new JSONObject();
JSONArray jsonArray = new JSONArray();
response.put("data", jsonArray);
try (DbIterator<TaggedData> data = TaggedData.getAll(firstIndex, lastIndex)) {
while (data.hasNext()) {
jsonArray.add(JSONData.taggedData(data.next(), includeData));
}
}
return response;
}
use of org.xel.TaggedData in project elastic-core-maven by OrdinaryDude.
the class SearchTaggedData method processRequest.
@Override
protected JSONStreamAware processRequest(HttpServletRequest req) throws NxtException {
long accountId = ParameterParser.getAccountId(req, "account", false);
String query = ParameterParser.getSearchQuery(req);
String channel = Convert.emptyToNull(req.getParameter("channel"));
int firstIndex = ParameterParser.getFirstIndex(req);
int lastIndex = ParameterParser.getLastIndex(req);
boolean includeData = "true".equalsIgnoreCase(req.getParameter("includeData"));
JSONObject response = new JSONObject();
JSONArray jsonArray = new JSONArray();
response.put("data", jsonArray);
try (DbIterator<TaggedData> data = TaggedData.searchData(query, channel, accountId, firstIndex, lastIndex)) {
while (data.hasNext()) {
jsonArray.add(JSONData.taggedData(data.next(), includeData));
}
}
return response;
}
Aggregations