Skip to content

Commit

Permalink
#3124: Report searcher to use query state
Browse files Browse the repository at this point in the history
  • Loading branch information
VassilIordanov authored and gjvoosten committed Aug 5, 2020
1 parent 548bdf2 commit 59fe405
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/mil/dds/anet/search/AbstractReportSearcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import mil.dds.anet.beans.Report.ReportCancelledReason;
import mil.dds.anet.beans.Report.ReportState;
import mil.dds.anet.beans.Task;
import mil.dds.anet.beans.WithStatus;
import mil.dds.anet.beans.lists.AnetBeanList;
import mil.dds.anet.beans.search.AbstractBatchParams;
import mil.dds.anet.beans.search.ISearchQuery.RecurseStrategy;
Expand Down Expand Up @@ -95,6 +96,12 @@ protected void buildQuery(Set<String> subFields, ReportSearchQuery query) {
addBatchClause(query);
}

// We do not store status in reports as we consider them all ACTIVE. Hence, we want to return
// no results when querying for INACTIVE reports
if (query.getStatus() == WithStatus.Status.INACTIVE) {
qb.addWhereClause("0 = 1");
}

qb.addEqualsClause("authorUuid", "reports.\"authorUuid\"", query.getAuthorUuid());
qb.addDateRangeClause("startDate", "reports.\"engagementDate\"", Comparison.AFTER,
query.getEngagementDateStart(), "endDate", "reports.\"engagementDate\"", Comparison.BEFORE,
Expand Down

0 comments on commit 59fe405

Please sign in to comment.