Commit 94a23c5a authored by Georgi's avatar Georgi

Changed the return value of method findUniqueSubjects from returning a simple...

Changed the return value of method findUniqueSubjects from returning a simple number of the #unique subjects in th Evidence DB, to an array of all unique subjects as hat list can be used for other things (like making csv files ect.)
parent aee298bb
Pipeline #2461 passed with stages
in 9 minutes and 49 seconds
......@@ -476,8 +476,9 @@ public class RequestHandler implements ServerInterface {
* @param doc doc containing the aggregation value.
* @return int, number of unique subjects
*/
public final int findUniqueSubjects(final Document doc) {
public final Subject[] findUniqueSubjects(final Document doc) {
int unique_subjects = 0;
List<Subject> entries = new ArrayList<>();
Document query = new Document("$group",
new Document("_id", doc));
AggregateIterable<Document> db_output = mongodb
......@@ -486,8 +487,10 @@ public class RequestHandler implements ServerInterface {
for (Document db_document : db_output) {
unique_subjects += 1;
entries.add(adapter.readFromMongo(db_document
.get("_id", Document.class)));
}
return unique_subjects;
return entries.toArray(new Subject[entries.size()]);
}
public final String[] findDistinctEntries(final String field) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment