Skip to content

Commit

Permalink
feat: move synchronization locks to ReportDataManager
Browse files Browse the repository at this point in the history
OCD-4688
  • Loading branch information
tmy1313 committed Nov 7, 2024
1 parent b6241bb commit e5b0be5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
import gov.healthit.chpl.report.surveillance.SurveillanceReportsService;
import gov.healthit.chpl.scheduler.job.summarystatistics.data.CertificationBodyStatistic;
import gov.healthit.chpl.search.domain.ListingSearchResult;
import lombok.Synchronized;
import lombok.extern.log4j.Log4j2;

@Log4j2
@Component
public class ReportDataManager {
private final Object lock = new Object();

private CriteriaMigrationReportService criteriaMigrationReportService;
private SurveillanceReportsService surveillanceReportsService;
Expand All @@ -39,82 +41,102 @@ public ReportDataManager(CriteriaMigrationReportService criteriaMigrationReportS
this.testToolReportService = testToolReportService;
}

@Synchronized("lock")
public List<CriteriaMigrationReportDenormalized> getHti1CriteriaMigrationReport() {
return criteriaMigrationReportService.getHtiReportData(CriteriaMigrationReportService.HTI1_REPORT_ID);
}

@Synchronized("lock")
public SurveillanceActivityCounts getSurveillanceActivityCounts() {
return surveillanceReportsService.getSurveiilanceActivityCounts();
}

@Synchronized("lock")
public List<CertificationBodyStatistic> getOpenSurveillanceActivityCountsByAcb() {
return surveillanceReportsService.getOpenSurveillanceActivityCountsByAcb();
}

@Synchronized("lock")
public List<ListingSearchResult> getListingsWithOpenSurveillance() {
return surveillanceReportsService.getListingsWithOpenSurveillance();
}

@Synchronized("lock")
public NonconformityCounts getNonconformityCounts() {
return surveillanceReportsService.getNonconformityCounts();
}

@Synchronized("lock")
public List<CertificationBodyStatistic> getOpenNonconformityCountsByAcb() {
return surveillanceReportsService.getOpenNonconformityCountsByAcb();
}

@Synchronized("lock")
public List<ListingSearchResult> getListingsWithOpenNonconformity() {
return surveillanceReportsService.getListingsWithOpenNonconformity();
}

@Synchronized("lock")
public List<CertificationBodyStatistic> getOpenCapCountsByAcb() {
return surveillanceReportsService.getOpenCapCountsByAcb();
}

@Synchronized("lock")
public List<CertificationBodyStatistic> getClosedCapCountsByAcb() {
return surveillanceReportsService.getClosedCapCountsByAcb();
}

@Synchronized("lock")
public List<ListingSearchResult> getListingsWithOpenCap() {
return surveillanceReportsService.getListingsWithOpenCap();
}

@Synchronized("lock")
public List<ListingSearchResult> getListingsWithClosedCap() {
return surveillanceReportsService.getListingsWithClosedCap();
}

@Synchronized("lock")
public CapCounts getCapCounts() {
return surveillanceReportsService.getCapCounts();
}

@Synchronized("lock")
public UniqueDeveloperCount getUniqueDeveloperCount() {
return developerReportsService.getUniqueDeveloperCount();
}

@Synchronized("lock")
public List<CertificationBodyStatistic> getDeveloperCountsWithActiveListingsByAcb() {
return developerReportsService.getDeveloperCountsWithActiveListingsByAcb();
}

@Synchronized("lock")
public List<CertificationBodyStatistic> getDeveloperCountsWithWithdrawnListingsByAcb() {
return developerReportsService.getDeveloperCountsWithWithdrawnListingsByAcb();
}

@Synchronized("lock")
public List<DeveloperSearchResult> getDevelopersWithWithdrawnListingsByAcb() {
return developerReportsService.getDevelopersWithWithdrawnListingsByAcb();
}

@Synchronized("lock")
public List<CertificationBodyStatistic> getDeveloperCountsWithSuspendedListingsByAcb() {
return developerReportsService.getDeveloperCountsWithSuspendedListingsByAcb();
}

@Synchronized("lock")
public List<DeveloperSearchResult> getDevelopersWithSuspendedListingsByAcb() {
return developerReportsService.getDevelopersWithSuspendedListingsByAcb();
}

@Synchronized("lock")
public List<TestToolReport> getTestToolReports() {
return testToolReportService.getTestToolReports();
}

@Synchronized("lock")
public List<TestToolListingReport> getTestToolListingReports() {
return testToolReportService.getTestToolListingReports();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@
import gov.healthit.chpl.search.domain.ListingSearchResult;
import gov.healthit.chpl.search.domain.NonConformitySearchOptions;
import gov.healthit.chpl.search.domain.SearchRequest;
import lombok.Synchronized;
import lombok.extern.log4j.Log4j2;

@Log4j2
@Component
public class SurveillanceReportsService {
private final Object lock = new Object();

private SummaryStatisticsDAO summaryStatisticsDAO;
private ListingSearchService listingSearchService;
Expand All @@ -37,7 +35,6 @@ public SurveillanceReportsService(SummaryStatisticsDAO summaryStatisticsDAO, Lis
this.listingSearchService = listingSearchService;
}

@Synchronized("lock")
public SurveillanceActivityCounts getSurveiilanceActivityCounts() {
StatisticsSnapshot stats = getStatistics();
return SurveillanceActivityCounts.builder()
Expand All @@ -50,12 +47,10 @@ public SurveillanceActivityCounts getSurveiilanceActivityCounts() {
.build();
}

@Synchronized("lock")
public List<CertificationBodyStatistic> getOpenSurveillanceActivityCountsByAcb() {
return getStatistics().getSurveillanceOpenStatus().getAcbStatistics();
}

@Synchronized("lock")
public List<ListingSearchResult> getListingsWithOpenSurveillance() {
try {
return listingSearchService.getAllPagesOfSearchResults(
Expand All @@ -73,7 +68,6 @@ public List<ListingSearchResult> getListingsWithOpenSurveillance() {
}
}

@Synchronized("lock")
public NonconformityCounts getNonconformityCounts() {
StatisticsSnapshot stats = getStatistics();
return NonconformityCounts.builder()
Expand All @@ -89,12 +83,10 @@ public NonconformityCounts getNonconformityCounts() {
.build();
}

@Synchronized("lock")
public List<CertificationBodyStatistic> getOpenNonconformityCountsByAcb() {
return getStatistics().getNonConfStatusOpen().getAcbStatistics();
}

@Synchronized("lock")
public List<ListingSearchResult> getListingsWithOpenNonconformity() {
try {
return listingSearchService.getAllPagesOfSearchResults(
Expand All @@ -112,7 +104,6 @@ public List<ListingSearchResult> getListingsWithOpenNonconformity() {
}
}

@Synchronized("lock")
public CapCounts getCapCounts() {
StatisticsSnapshot stats = getStatistics();
Long openCaps = stats.getNonConfCAPStatusOpen().stream().collect(Collectors.summingLong(s -> s.getCount()));
Expand All @@ -124,17 +115,14 @@ public CapCounts getCapCounts() {
.build();
}

@Synchronized("lock")
public List<CertificationBodyStatistic> getOpenCapCountsByAcb() {
return getStatistics().getNonConfCAPStatusOpen();
}

@Synchronized("lock")
public List<CertificationBodyStatistic> getClosedCapCountsByAcb() {
return getStatistics().getNonConfCAPStatusClosed();
}

@Synchronized("lock")
public List<ListingSearchResult> getListingsWithOpenCap() {
try {
return listingSearchService.getAllPagesOfSearchResults(
Expand All @@ -160,7 +148,6 @@ public List<ListingSearchResult> getListingsWithOpenCap() {
}
}

@Synchronized("lock")
public List<ListingSearchResult> getListingsWithClosedCap() {
try {
return listingSearchService.getAllPagesOfSearchResults(
Expand Down

0 comments on commit e5b0be5

Please sign in to comment.