diff --git a/chpl/chpl-api/src/main/java/gov/healthit/chpl/web/controller/QuestionableUrlReportController.java b/chpl/chpl-api/src/main/java/gov/healthit/chpl/web/controller/QuestionableUrlReportController.java index 78771ca06f..9b686184be 100644 --- a/chpl/chpl-api/src/main/java/gov/healthit/chpl/web/controller/QuestionableUrlReportController.java +++ b/chpl/chpl-api/src/main/java/gov/healthit/chpl/web/controller/QuestionableUrlReportController.java @@ -40,7 +40,7 @@ public QuestionableUrlReportController(ReportDataManager reportDataManager) { return reportDataManager.getQuestionableUrlService().getQuestionableUrlReports(); } - @Operation(summary = "Retrieves the data used to generate the Questionable URL Listings report.", + @Operation(summary = "Retrieves the data used to generate the Questionable URL Detailed report.", security = { @SecurityRequirement(name = SwaggerSecurityRequirement.API_KEY) }) diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/dao/DeveloperDAO.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/dao/DeveloperDAO.java index 0a438da945..9691aa76db 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/dao/DeveloperDAO.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/dao/DeveloperDAO.java @@ -63,7 +63,7 @@ public class DeveloperDAO extends BaseDAOImpl { private DeveloperStatusDAO statusDao; private AttestationDAO attestationDAO; private ErrorMessageUtil msgUtil; - private String unformattedDeveloperDetalisUrl; + private String unformattedDeveloperDetailsUrl; @Autowired public DeveloperDAO(AddressDAO addressDao, @@ -78,7 +78,7 @@ public DeveloperDAO(AddressDAO addressDao, this.statusDao = statusDao; this.attestationDAO = attestationDAO; this.msgUtil = msgUtil; - this.unformattedDeveloperDetalisUrl = chplUrlBegin + developerUrlPart; + this.unformattedDeveloperDetailsUrl = chplUrlBegin + developerUrlPart; } public Long create(Developer developer) throws EntityCreationException { @@ -200,7 +200,7 @@ public List getAllSearchResults() { LOGGER.info("Got all developers from db. Converting to Domain.."); return entities.stream() .map(entity -> entity.toDomain()) - .peek(dev -> dev.setDeveloperDetailsUrl(String.format(unformattedDeveloperDetalisUrl, dev.getId()))) + .peek(dev -> dev.setDeveloperDetailsUrl(String.format(unformattedDeveloperDetailsUrl, dev.getId()))) .collect(Collectors.toList()); } diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/CodeSetListingReport.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/CodeSetListingReport.java index 6f6f445ec6..23c13ad863 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/CodeSetListingReport.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/CodeSetListingReport.java @@ -9,6 +9,7 @@ @Builder public class CodeSetListingReport { private String chplProductNumber; + private String listingDetailsUrl; private CertificationCriterion criterion; private CodeSet codeSet; } diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/CodeSetReportDao.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/CodeSetReportDao.java index aa45e9f603..c588c7aa59 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/CodeSetReportDao.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/CodeSetReportDao.java @@ -2,6 +2,8 @@ import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Repository; import gov.healthit.chpl.certificationCriteria.CertificationCriterionEntity; @@ -11,6 +13,14 @@ @Repository public class CodeSetReportDao extends BaseDAOImpl { + private String unformattedListingDetailsUrl; + + @Autowired + public CodeSetReportDao(@Value("${chplUrlBegin}") String chplUrlBegin, + @Value("${listingDetailsUrlPart}") String listingDetailsUrlPart) { + this.unformattedListingDetailsUrl = chplUrlBegin + listingDetailsUrlPart; + } + public List getCodeSetReports() { String hql = "SELECT cc, cs, count(*) as codeSetCount " + "FROM CertificationCriterionEntity cc, " @@ -44,7 +54,7 @@ public List getCodeSetReports() { } public List getCodeSetListingReports() { - String hql = "SELECT cc, cs, cpd.chplProductNumber " + String hql = "SELECT cc, cs, cpd.id, cpd.chplProductNumber " + "FROM CertificationCriterionEntity cc, " + "CertificationResultEntity cr, " + "CertifiedProductDetailsEntity cpd, " @@ -68,7 +78,8 @@ public List getCodeSetListingReports() { .map(result -> CodeSetListingReport.builder() .criterion(((CertificationCriterionEntity) result[0]).toDomain()) .codeSet(((CodeSetEntity) result[1]).toDomain()) - .chplProductNumber((String) result[2]) + .listingDetailsUrl(String.format(unformattedListingDetailsUrl, (Long) result[2])) + .chplProductNumber((String) result[3]) .build()) .toList(); } diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/ConformanceMethodListingReport.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/ConformanceMethodListingReport.java index 671ba122d4..39e22db0fc 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/ConformanceMethodListingReport.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/ConformanceMethodListingReport.java @@ -9,6 +9,7 @@ @Builder public class ConformanceMethodListingReport { private String chplProductNumber; + private String listingDetailsUrl; private CertificationCriterion criterion; private ConformanceMethod conformanceMethod; } diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/ConformanceMethodReportDao.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/ConformanceMethodReportDao.java index b50242653b..eb7d1772f4 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/ConformanceMethodReportDao.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/ConformanceMethodReportDao.java @@ -2,6 +2,8 @@ import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Repository; import gov.healthit.chpl.certificationCriteria.CertificationCriterionEntity; @@ -11,6 +13,14 @@ @Repository public class ConformanceMethodReportDao extends BaseDAOImpl { + private String unformattedListingDetailsUrl; + + @Autowired + public ConformanceMethodReportDao(@Value("${chplUrlBegin}") String chplUrlBegin, + @Value("${listingDetailsUrlPart}") String listingDetailsUrlPart) { + this.unformattedListingDetailsUrl = chplUrlBegin + listingDetailsUrlPart; + } + public List getConformanceMethodReports() { String hql = "SELECT cc, cm, count(*) as conrmfanceMethodCount " + "FROM CertificationCriterionEntity cc, " @@ -44,7 +54,7 @@ public List getConformanceMethodReports() { } public List getConformanceMethodListingReports() { - String hql = "SELECT cc, cm, cpd.chplProductNumber " + String hql = "SELECT cc, cm, cpd.id, cpd.chplProductNumber " + "FROM CertificationCriterionEntity cc, " + "CertificationResultEntity cr, " + "CertifiedProductDetailsEntity cpd, " @@ -68,7 +78,8 @@ public List getConformanceMethodListingReports() .map(result -> ConformanceMethodListingReport.builder() .criterion(((CertificationCriterionEntity) result[0]).toDomain()) .conformanceMethod(((ConformanceMethodEntity) result[1]).toDomain()) - .chplProductNumber((String) result[2]) + .listingDetailsUrl(String.format(unformattedListingDetailsUrl, (Long) result[2])) + .chplProductNumber((String) result[3]) .build()) .toList(); } diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/FunctionalityTestedListingReport.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/FunctionalityTestedListingReport.java index a55c84a6cb..0ecfe2f9f9 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/FunctionalityTestedListingReport.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/FunctionalityTestedListingReport.java @@ -9,6 +9,7 @@ @Builder public class FunctionalityTestedListingReport { private String chplProductNumber; + private String listingDetailsUrl; private CertificationCriterion criterion; private FunctionalityTested functionalityTested; } diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/FunctionalityTestedReportDao.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/FunctionalityTestedReportDao.java index ddcf7c223d..48b20cbeab 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/FunctionalityTestedReportDao.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/FunctionalityTestedReportDao.java @@ -2,6 +2,8 @@ import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Repository; import gov.healthit.chpl.certificationCriteria.CertificationCriterionEntity; @@ -11,6 +13,15 @@ @Repository public class FunctionalityTestedReportDao extends BaseDAOImpl { + + private String unformattedListingDetailsUrl; + + @Autowired + public FunctionalityTestedReportDao(@Value("${chplUrlBegin}") String chplUrlBegin, + @Value("${listingDetailsUrlPart}") String listingDetailsUrlPart) { + this.unformattedListingDetailsUrl = chplUrlBegin + listingDetailsUrlPart; + } + public List getFunctionalityTestedReports() { String hql = "SELECT cc, ft, count(*) as functionalityTestedCount " + "FROM CertificationCriterionEntity cc, " @@ -44,7 +55,7 @@ public List getFunctionalityTestedReports() { } public List getFunctionalityTestedListingReports() { - String hql = "SELECT cc, ft, cpd.chplProductNumber " + String hql = "SELECT cc, ft, cpd.id, cpd.chplProductNumber " + "FROM CertificationCriterionEntity cc, " + "CertificationResultEntity cr, " + "CertifiedProductDetailsEntity cpd, " @@ -68,7 +79,8 @@ public List getFunctionalityTestedListingRepor .map(result -> FunctionalityTestedListingReport.builder() .criterion(((CertificationCriterionEntity) result[0]).toDomain()) .functionalityTested(((FunctionalityTestedEntity) result[1]).toDomain()) - .chplProductNumber((String) result[2]) + .listingDetailsUrl(String.format(unformattedListingDetailsUrl, (Long) result[2])) + .chplProductNumber((String) result[3]) .build()) .toList(); } diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/OptionalStandardListingReport.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/OptionalStandardListingReport.java index 327a94218b..6d216bfacf 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/OptionalStandardListingReport.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/OptionalStandardListingReport.java @@ -9,6 +9,7 @@ @Builder public class OptionalStandardListingReport { private String chplProductNumber; + private String listingDetailsUrl; private CertificationCriterion criterion; private OptionalStandard optionalStandard; } diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/OptionalStandardReportDao.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/OptionalStandardReportDao.java index 2dbf2c36d8..40c2bf7b7a 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/OptionalStandardReportDao.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/OptionalStandardReportDao.java @@ -2,6 +2,8 @@ import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Repository; import gov.healthit.chpl.certificationCriteria.CertificationCriterionEntity; @@ -11,6 +13,15 @@ @Repository public class OptionalStandardReportDao extends BaseDAOImpl { + + private String unformattedListingDetailsUrl; + + @Autowired + public OptionalStandardReportDao(@Value("${chplUrlBegin}") String chplUrlBegin, + @Value("${listingDetailsUrlPart}") String listingDetailsUrlPart) { + this.unformattedListingDetailsUrl = chplUrlBegin + listingDetailsUrlPart; + } + public List getOptionalStandardReports() { String hql = "SELECT cc, os, count(*) as optionalStandardCount " + "FROM CertificationCriterionEntity cc, " @@ -44,7 +55,7 @@ public List getOptionalStandardReports() { } public List getOptionalStandardListingReports() { - String hql = "SELECT cc, os, cpd.chplProductNumber " + String hql = "SELECT cc, os, cpd.id, cpd.chplProductNumber " + "FROM CertificationCriterionEntity cc, " + "CertificationResultEntity cr, " + "CertifiedProductDetailsEntity cpd, " @@ -68,7 +79,8 @@ public List getOptionalStandardListingReports() { .map(result -> OptionalStandardListingReport.builder() .criterion(((CertificationCriterionEntity) result[0]).toDomain()) .optionalStandard(((OptionalStandardEntity) result[1]).toDomain()) - .chplProductNumber((String) result[2]) + .listingDetailsUrl(String.format(unformattedListingDetailsUrl, (Long) result[2])) + .chplProductNumber((String) result[3]) .build()) .toList(); } diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/PrivacyAndSecurityFrameworkListingReport.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/PrivacyAndSecurityFrameworkListingReport.java index 7a3b24553b..a906c526e6 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/PrivacyAndSecurityFrameworkListingReport.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/PrivacyAndSecurityFrameworkListingReport.java @@ -8,6 +8,7 @@ @Builder public class PrivacyAndSecurityFrameworkListingReport { private String chplProductNumber; + private String listingDetailsUrl; private CertificationCriterion criterion; private String privacyAndSecurityFramework; } diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/PrivacyAndSecurityFrameworkReportDao.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/PrivacyAndSecurityFrameworkReportDao.java index 924f232300..b7fa19c088 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/PrivacyAndSecurityFrameworkReportDao.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/PrivacyAndSecurityFrameworkReportDao.java @@ -2,6 +2,8 @@ import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Repository; import gov.healthit.chpl.certificationCriteria.CertificationCriterionEntity; @@ -10,6 +12,15 @@ @Repository public class PrivacyAndSecurityFrameworkReportDao extends BaseDAOImpl { + + private String unformattedListingDetailsUrl; + + @Autowired + public PrivacyAndSecurityFrameworkReportDao(@Value("${chplUrlBegin}") String chplUrlBegin, + @Value("${listingDetailsUrlPart}") String listingDetailsUrlPart) { + this.unformattedListingDetailsUrl = chplUrlBegin + listingDetailsUrlPart; + } + public List getPrivacyAndSecurityFrameworkReports() { String hql = "SELECT cc, cr.privacySecurityFramework, count(*) as privacyAndSecurityFrameworkCount " + "FROM CertificationCriterionEntity cc, " @@ -39,7 +50,7 @@ public List getPrivacyAndSecurityFrameworkRep } public List getPrivacyAndSecurityFrameworkListingReports() { - String hql = "SELECT cc, cr.privacySecurityFramework, cpd.chplProductNumber " + String hql = "SELECT cc, cr.privacySecurityFramework, cpd.id, cpd.chplProductNumber " + "FROM CertificationCriterionEntity cc, " + "CertificationResultEntity cr, " + "CertifiedProductDetailsEntity cpd " @@ -58,7 +69,8 @@ public List getPrivacyAndSecurityFrame .map(result -> PrivacyAndSecurityFrameworkListingReport.builder() .criterion(((CertificationCriterionEntity) result[0]).toDomain()) .privacyAndSecurityFramework((String) result[1]) - .chplProductNumber((String) result[2]) + .listingDetailsUrl(String.format(unformattedListingDetailsUrl, (Long) result[2])) + .chplProductNumber((String) result[3]) .build()) .toList(); } diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/StandardListingReport.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/StandardListingReport.java index c37b9fd3e4..0a33ed62b8 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/StandardListingReport.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/StandardListingReport.java @@ -9,6 +9,7 @@ @Builder public class StandardListingReport { private String chplProductNumber; + private String listingDetailsUrl; private CertificationCriterion criterion; private Standard standard; } diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/StandardReportDao.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/StandardReportDao.java index 59fc6fd771..20f5aa778a 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/StandardReportDao.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/StandardReportDao.java @@ -2,6 +2,8 @@ import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Repository; import gov.healthit.chpl.certificationCriteria.CertificationCriterionEntity; @@ -14,6 +16,14 @@ @Repository public class StandardReportDao extends BaseDAOImpl { + private String unformattedListingDetailsUrl; + + @Autowired + public StandardReportDao(@Value("${chplUrlBegin}") String chplUrlBegin, + @Value("${listingDetailsUrlPart}") String listingDetailsUrlPart) { + this.unformattedListingDetailsUrl = chplUrlBegin + listingDetailsUrlPart; + } + public List getStandardReports() { String hql = "SELECT cc, s, count(*) as standardCount " + "FROM CertificationCriterionEntity cc, " @@ -47,7 +57,7 @@ public List getStandardReports() { } public List getStandardListingReports() { - String hql = "SELECT cc, s, cpd.chplProductNumber " + String hql = "SELECT cc, s, cpd.id, cpd.chplProductNumber " + "FROM CertificationCriterionEntity cc, " + "CertificationResultEntity cr, " + "CertifiedProductDetailsEntity cpd, " @@ -70,7 +80,8 @@ public List getStandardListingReports() { .map(result -> StandardListingReport.builder() .criterion(((CertificationCriterionEntity) result[0]).toDomain()) .standard(((StandardEntity) result[1]).toDomain()) - .chplProductNumber((String) result[2]) + .listingDetailsUrl(String.format(unformattedListingDetailsUrl, (Long) result[2])) + .chplProductNumber((String) result[3]) .build()) .toList(); } diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/TestDataListingReport.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/TestDataListingReport.java index a75753ad11..b50f7395e0 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/TestDataListingReport.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/TestDataListingReport.java @@ -9,6 +9,7 @@ @Builder public class TestDataListingReport { private String chplProductNumber; + private String listingDetailsUrl; private CertificationCriterion criterion; private TestData testData; } diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/TestDataReportDao.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/TestDataReportDao.java index d6bb85ec25..6055ad224e 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/TestDataReportDao.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/TestDataReportDao.java @@ -2,6 +2,8 @@ import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Repository; import gov.healthit.chpl.certificationCriteria.CertificationCriterionEntity; @@ -12,6 +14,14 @@ @Repository public class TestDataReportDao extends BaseDAOImpl { + private String unformattedListingDetailsUrl; + + @Autowired + public TestDataReportDao(@Value("${chplUrlBegin}") String chplUrlBegin, + @Value("${listingDetailsUrlPart}") String listingDetailsUrlPart) { + this.unformattedListingDetailsUrl = chplUrlBegin + listingDetailsUrlPart; + } + public List getTestDataReports() { String hql = "SELECT cc, td, count(*) as testDataCount " + "FROM CertificationCriterionEntity cc, " @@ -45,7 +55,7 @@ public List getTestDataReports() { } public List getTestDataListingReports() { - String hql = "SELECT cc, td, cpd.chplProductNumber " + String hql = "SELECT cc, td, cpd.id, cpd.chplProductNumber " + "FROM CertificationCriterionEntity cc, " + "CertificationResultEntity cr, " + "CertifiedProductDetailsEntity cpd, " @@ -70,7 +80,8 @@ public List getTestDataListingReports() { .map(result -> TestDataListingReport.builder() .criterion(((CertificationCriterionEntity) result[0]).toDomain()) .testData(((TestDataEntity) result[1]).toDomain()) - .chplProductNumber((String) result[2]) + .listingDetailsUrl(String.format(unformattedListingDetailsUrl, (Long) result[2])) + .chplProductNumber((String) result[3]) .build()) .toList(); } diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/TestToolListingReport.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/TestToolListingReport.java index 6beb42061a..3f18402ea5 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/TestToolListingReport.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/TestToolListingReport.java @@ -9,6 +9,7 @@ @Builder public class TestToolListingReport { private String chplProductNumber; + private String listingDetailsUrl; private CertificationCriterion criterion; private TestTool testTool; } diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/TestToolReportDao.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/TestToolReportDao.java index a983e4ba89..701ae47e32 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/TestToolReportDao.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriaattribute/TestToolReportDao.java @@ -2,6 +2,8 @@ import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Repository; import gov.healthit.chpl.certificationCriteria.CertificationCriterionEntity; @@ -14,6 +16,14 @@ @Repository public class TestToolReportDao extends BaseDAOImpl { + private String unformattedListingDetailsUrl; + + @Autowired + public TestToolReportDao(@Value("${chplUrlBegin}") String chplUrlBegin, + @Value("${listingDetailsUrlPart}") String listingDetailsUrlPart) { + this.unformattedListingDetailsUrl = chplUrlBegin + listingDetailsUrlPart; + } + public List getTestToolReports() { String hql = "SELECT cc, tt, count(*) as testToolCount " + "FROM CertificationCriterionEntity cc, " @@ -47,7 +57,7 @@ public List getTestToolReports() { } public List getTestToolListingReports() { - String hql = "SELECT cc, tt, cpd.chplProductNumber " + String hql = "SELECT cc, tt, cpd.id, cpd.chplProductNumber " + "FROM CertificationCriterionEntity cc, " + "CertificationResultEntity cr, " + "CertifiedProductDetailsEntity cpd, " @@ -70,7 +80,8 @@ public List getTestToolListingReports() { .map(result -> TestToolListingReport.builder() .criterion(((CertificationCriterionEntity) result[0]).toDomain()) .testTool(((TestToolEntity) result[1]).toDomain()) - .chplProductNumber((String) result[2]) + .listingDetailsUrl(String.format(unformattedListingDetailsUrl, (Long) result[2])) + .chplProductNumber((String) result[3]) .build()) .toList(); } diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriauptodate/CriteriaUpToDateReportService.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriauptodate/CriteriaUpToDateReportService.java index a81b0f543d..ecce97c275 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriauptodate/CriteriaUpToDateReportService.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriauptodate/CriteriaUpToDateReportService.java @@ -9,6 +9,7 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.tuple.Pair; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -35,18 +36,23 @@ public class CriteriaUpToDateReportService { private UpdatedCriterionStatusReportDao updatedCriteriaStatusReportDao; private SummaryStatisticsDAO summaryStatisticsDao; private List allCertificationStatuses; + private String unformattedListingDetailsUrl; @Autowired public CriteriaUpToDateReportService(CriteriaUpToDateStatusReportDateService reportDateService, CertificationCriteriaManager criteriaManager, UpdatedCriterionStatusReportDao updatedCriteriaStatusReportDao, SummaryStatisticsDAO summaryStatisticsDao, - CertificationStatusDAO certificationStatusDao) { + CertificationStatusDAO certificationStatusDao, + @Value("${chplUrlBegin}") String chplUrlBegin, + @Value("${listingDetailsUrlPart}") String listingDetailsUrlPart) { this.reportDateService = reportDateService; this.criteriaManager = criteriaManager; this.updatedCriteriaStatusReportDao = updatedCriteriaStatusReportDao; this.summaryStatisticsDao = summaryStatisticsDao; this.allCertificationStatuses = certificationStatusDao.findAll(); + this.unformattedListingDetailsUrl = chplUrlBegin + listingDetailsUrlPart; + } @Transactional(readOnly = true) @@ -103,6 +109,7 @@ public List getAllListingNotUpToDateReports() { .criterion(report.getCertificationCriterion()) .chplProductNumber(report.getChplProductNumber()) .certifiedProductId(report.getCertifiedProductId()) + .listingDetailsUrl(String.format(unformattedListingDetailsUrl, report.getCertifiedProductId())) .build()) .collect(Collectors.toSet()); return results.stream().collect(Collectors.toList()); diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriauptodate/ListingNotUpToDateReport.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriauptodate/ListingNotUpToDateReport.java index 443f82540d..ce547d48b3 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriauptodate/ListingNotUpToDateReport.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/criteriauptodate/ListingNotUpToDateReport.java @@ -12,5 +12,6 @@ public class ListingNotUpToDateReport { private CertificationCriterion criterion; private Long certifiedProductId; + private String listingDetailsUrl; private String chplProductNumber; } diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/questionableurl/QuestionableUrlDetailEntity.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/questionableurl/QuestionableUrlDetailEntity.java index 07c9461e79..43660c398d 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/questionableurl/QuestionableUrlDetailEntity.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/questionableurl/QuestionableUrlDetailEntity.java @@ -57,6 +57,7 @@ public QuestionableUrlDetailReport toDomain() { return QuestionableUrlDetailReport.builder() .lastChecked(lastChecked) .relatedItem(itemName) + .relatedItemId(itemId) .responseCode(responseCode) .responseMessage(responseMessage) .url(url) diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/questionableurl/QuestionableUrlDetailReport.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/questionableurl/QuestionableUrlDetailReport.java index 07d7c769c6..05c7c8c354 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/questionableurl/QuestionableUrlDetailReport.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/questionableurl/QuestionableUrlDetailReport.java @@ -18,4 +18,6 @@ public class QuestionableUrlDetailReport { * The CHPL Product Number, developer name, ONC-ACB name, etc depending on the "type" of the url */ private String relatedItem; + private Long relatedItemId; + private String relatedItemUrl; } diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/questionableurl/QuestionableUrlReportDao.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/questionableurl/QuestionableUrlReportDao.java index 200c6aff4d..aa27deab1b 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/questionableurl/QuestionableUrlReportDao.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/report/questionableurl/QuestionableUrlReportDao.java @@ -2,13 +2,26 @@ import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Repository; import gov.healthit.chpl.dao.impl.BaseDAOImpl; +import gov.healthit.chpl.scheduler.job.urlStatus.data.UrlType; import jakarta.persistence.Query; @Repository public class QuestionableUrlReportDao extends BaseDAOImpl { + private String unformattedListingDetailsUrl; + private String unformattedDeveloperDetailsUrl; + + @Autowired + public QuestionableUrlReportDao(@Value("${chplUrlBegin}") String chplUrlBegin, + @Value("${listingDetailsUrlPart}") String listingDetailsUrlPart, + @Value("${developerUrlPart}") String developerUrlPart) { + this.unformattedListingDetailsUrl = chplUrlBegin + listingDetailsUrlPart; + this.unformattedDeveloperDetailsUrl = chplUrlBegin + developerUrlPart; + } public List getQuestionableUrlReports() { //add all url types to the response @@ -32,8 +45,32 @@ public List getQuestionableUrlDetails() { Query query = entityManager.createQuery(hql); List results = query.getResultList(); - return results.stream() + List reports = results.stream() .map(result -> result.toDomain()) .toList(); + + //add the URL for any appropriate types + reports.stream() + .filter(report -> report.getUrlType().equals(UrlType.DEVELOPER.getName())) + .forEach(developerReport -> developerReport.setRelatedItemUrl(String.format(unformattedDeveloperDetailsUrl, developerReport.getRelatedItemId()))); + reports.stream() + .filter(report -> isForListingUrl(report)) + .forEach(listingReport -> listingReport.setRelatedItemUrl(String.format(unformattedListingDetailsUrl, listingReport.getRelatedItemId()))); + + return reports; + } + + private boolean isForListingUrl(QuestionableUrlDetailReport report) { + return report.getUrlType().equals(UrlType.API_DOCUMENTATION.getName()) + || report.getUrlType().equals(UrlType.DOCUMENTATION.getName()) + || report.getUrlType().equals(UrlType.EXPORT_DOCUMENTATION.getName()) + || report.getUrlType().equals(UrlType.FULL_USABILITY_REPORT.getName()) + || report.getUrlType().equals(UrlType.MANDATORY_DISCLOSURE.getName()) + || report.getUrlType().equals(UrlType.REAL_WORLD_TESTING_PLANS.getName()) + || report.getUrlType().equals(UrlType.REAL_WORLD_TESTING_RESULTS.getName()) + || report.getUrlType().equals(UrlType.RISK_MANAGEMENT_SUMMARY_INFORMATION.getName()) + || report.getUrlType().equals(UrlType.SERVICE_BASE_URL_LIST.getName()) + || report.getUrlType().equals(UrlType.STANDARDS_VERSION_ADVANCEMENT_PROCESS_NOTICE.getName()) + || report.getUrlType().equals(UrlType.USE_CASES.getName()); } } diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/search/dao/ListingSearchDao.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/search/dao/ListingSearchDao.java index db39926e15..d5f20b7059 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/search/dao/ListingSearchDao.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/search/dao/ListingSearchDao.java @@ -1,4 +1,5 @@ package gov.healthit.chpl.search.dao; + import static gov.healthit.chpl.util.LambdaExceptionUtil.rethrowFunction; import java.time.LocalDate; @@ -14,6 +15,8 @@ import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Repository; import gov.healthit.chpl.dao.impl.BaseDAOImpl; @@ -44,11 +47,20 @@ public class ListingSearchDao extends BaseDAOImpl { private static final int STATUS_EVENT_FIELD_COUNT = 3; private static final int DATE_RANGE_MIN_FIELD_COUNT = 1; private static final int DATE_RANGE_FIELD_COUNT = 2; + private String unformattedListingDetailsUrl; + private String unformattedDeveloperDetailsUrl; + + @Autowired + public ListingSearchDao(@Value("${chplUrlBegin}") String chplUrlBegin, + @Value("${listingDetailsUrlPart}") String listingDetailsUrlPart, + @Value("${developerUrlPart}") String developerUrlPart) { + this.unformattedListingDetailsUrl = chplUrlBegin + listingDetailsUrlPart; + this.unformattedDeveloperDetailsUrl = chplUrlBegin + developerUrlPart; + } public List getListingSearchResults() { LOGGER.info("Starting listing search query."); - Query query = entityManager.createQuery("SELECT listings " - + "FROM ListingSearchEntity listings ", + Query query = entityManager.createQuery("SELECT listings " + "FROM ListingSearchEntity listings ", ListingSearchEntity.class); Date startDate = new Date(); @@ -66,78 +78,65 @@ public List getListingSearchResults() { } private List convertToListingSearchResults(List entities) - throws EntityRetrievalException, DateTimeParseException, NumberFormatException { - return entities.stream() - .map(rethrowFunction(entity -> buildListingSearchResult(entity))) + throws EntityRetrievalException, DateTimeParseException, NumberFormatException { + return entities.stream().map(rethrowFunction(entity -> buildListingSearchResult(entity))) .collect(Collectors.toList()); } private ListingSearchResult buildListingSearchResult(ListingSearchEntity entity) throws EntityRetrievalException, DateTimeParseException, NumberFormatException { - return ListingSearchResult.builder() - .id(entity.getId()) - .chplProductNumber(entity.getChplProductNumber()) - .edition(buildEdition(entity)) - .curesUpdate(entity.getCuresUpdate()) - .certificationBody(IdNamePair.builder() - .id(entity.getCertificationBodyId()) - .name(entity.getCertificationBodyName()) - .build()) + return ListingSearchResult.builder().id(entity.getId()).chplProductNumber(entity.getChplProductNumber()) + .listingDetailsUrl(String.format(unformattedListingDetailsUrl, entity.getId())) + .edition(buildEdition(entity)).curesUpdate(entity.getCuresUpdate()) + .certificationBody(IdNamePair.builder().id(entity.getCertificationBodyId()) + .name(entity.getCertificationBodyName()).build()) .acbCertificationId(entity.getAcbCertificationId()) .practiceType(entity.getPracticeTypeId() != null - ? IdNamePair.builder() - .id(entity.getPracticeTypeId()) - .name(entity.getPracticeTypeName()) - .build() + ? IdNamePair.builder().id(entity.getPracticeTypeId()).name(entity.getPracticeTypeName()).build() : null) .developer(DeveloperSearchResult.builder() .id(entity.getDeveloperId()) .name(entity.getDeveloper()) .status(entity.getDeveloperStatusId() == null ? null - : IdNamePair.builder() - .id(entity.getDeveloperStatusId()) - .name(entity.getDeveloperStatus()) - .build()) - .build()) - .product(IdNamePair.builder() - .id(entity.getProductId()) - .name(entity.getProduct()) + : IdNamePair.builder().id(entity.getDeveloperStatusId()) + .name(entity.getDeveloperStatus()).build()) + .developerDetailsUrl(String.format(unformattedDeveloperDetailsUrl, entity.getDeveloperId())) .build()) - .version(IdNamePair.builder() - .id(entity.getVersionId()) - .name(entity.getVersion()) - .build()) - .promotingInteroperability(convertToPromotingInteroperability(entity.getPromotingInteroperabilityUserCount(), - entity.getPromotingInteroperabilityUserCountDate())) - .decertificationDate(entity.getDecertificationDate() == null ? null : - DateUtil.toLocalDate(entity.getDecertificationDate().getTime())) + .product(IdNamePair.builder().id(entity.getProductId()).name(entity.getProduct()).build()) + .version(IdNamePair.builder().id(entity.getVersionId()).name(entity.getVersion()).build()) + .promotingInteroperability( + convertToPromotingInteroperability(entity.getPromotingInteroperabilityUserCount(), + entity.getPromotingInteroperabilityUserCountDate())) + .decertificationDate(entity.getDecertificationDate() == null ? null + : DateUtil.toLocalDate(entity.getDecertificationDate().getTime())) .certificationDate(DateUtil.toLocalDate(entity.getCertificationDate().getTime())) - .certificationStatus(IdNamePair.builder() - .id(entity.getCertificationStatusId()) - .name(entity.getCertificationStatus()) - .build()) - .mandatoryDisclosures(entity.getMandatoryDisclosures()) - .surveillanceCount(entity.getSurveillanceCount()) + .certificationStatus(IdNamePair.builder().id(entity.getCertificationStatusId()) + .name(entity.getCertificationStatus()).build()) + .mandatoryDisclosures(entity.getMandatoryDisclosures()).surveillanceCount(entity.getSurveillanceCount()) .openSurveillanceCount(entity.getOpenSurveillanceCount()) .closedSurveillanceCount(entity.getClosedSurveillanceCount()) .openSurveillanceNonConformityCount(entity.getOpenSurveillanceNonConformityCount()) .closedSurveillanceNonConformityCount(entity.getClosedSurveillanceNonConformityCount()) - .openCapCount(entity.getOpenCapCount()) - .closedCapCount(entity.getClosedCapCount()) - .rwtPlansUrl(entity.getRwtPlansUrl()) - .rwtResultsUrl(entity.getRwtResultsUrl()) + .openCapCount(entity.getOpenCapCount()).closedCapCount(entity.getClosedCapCount()) + .rwtPlansUrl(entity.getRwtPlansUrl()).rwtResultsUrl(entity.getRwtResultsUrl()) .svapNoticeUrl(entity.getSvapNoticeUrl()) - .surveillanceDateRanges(convertToSetOfDateRangesWithDelimiter(entity.getSurveillanceDates(), STANDARD_VALUE_SPLIT_CHAR)) + .surveillanceDateRanges( + convertToSetOfDateRangesWithDelimiter(entity.getSurveillanceDates(), STANDARD_VALUE_SPLIT_CHAR)) .statusEvents(convertToSetOfStatusEvents(entity.getStatusEvents(), STANDARD_VALUE_SPLIT_CHAR)) .criteriaMet(convertToSetOfCriteria(entity.getCertificationCriteriaMet(), STANDARD_VALUE_SPLIT_CHAR)) .cqmsMet(convertToSetOfCqms(entity.getCqmsMet(), STANDARD_VALUE_SPLIT_CHAR)) - .previousChplProductNumbers(convertToSetOfStrings(entity.getPreviousChplProductNumbers(), entity.getChplProductNumber(), STANDARD_VALUE_SPLIT_CHAR)) - .previousDevelopers(convertToSetOfProductOwners(entity.getPreviousDevelopers(), ListingSearchEntity.SMILEY_SPLIT_CHAR)) - .apiDocumentation(convertToSetOfCriteriaWithStringFields(entity.getCriteriaWithApiDocumentation(), ListingSearchEntity.SMILEY_SPLIT_CHAR)) + .previousChplProductNumbers(convertToSetOfStrings(entity.getPreviousChplProductNumbers(), + entity.getChplProductNumber(), STANDARD_VALUE_SPLIT_CHAR)) + .previousDevelopers(convertToSetOfProductOwners(entity.getPreviousDevelopers(), + ListingSearchEntity.SMILEY_SPLIT_CHAR)) + .apiDocumentation(convertToSetOfCriteriaWithStringFields(entity.getCriteriaWithApiDocumentation(), + ListingSearchEntity.SMILEY_SPLIT_CHAR)) .serviceBaseUrlList(convertToCriterionWithStringField(entity.getCriteriaWithServiceBaseUrlList())) .standardsMet(convertToSetOfLongs(entity.getStandardsMet(), STANDARD_VALUE_SPLIT_CHAR)) - .svaps(convertToSetOfCriteriaWithLongFields(entity.getCriteriaWithSvap(), ListingSearchEntity.SMILEY_SPLIT_CHAR)) - .riskManagementSummaryInformation(convertToCriterionWithStringField(entity.getCriteriaWithRiskManagementSummaryInformation())) + .svaps(convertToSetOfCriteriaWithLongFields(entity.getCriteriaWithSvap(), + ListingSearchEntity.SMILEY_SPLIT_CHAR)) + .riskManagementSummaryInformation( + convertToCriterionWithStringField(entity.getCriteriaWithRiskManagementSummaryInformation())) .build(); } @@ -145,21 +144,17 @@ private IdNamePair buildEdition(ListingSearchEntity entity) { if (entity.getCertificationEditionId() == null) { return null; } - return IdNamePair.builder() - .id(entity.getCertificationEditionId()) - .name(entity.getCertificationEditionYear()) + return IdNamePair.builder().id(entity.getCertificationEditionId()).name(entity.getCertificationEditionYear()) .build(); } - private PromotingInteroperabilitySearchResult convertToPromotingInteroperability(Long userCount, LocalDate userDate) { + private PromotingInteroperabilitySearchResult convertToPromotingInteroperability(Long userCount, + LocalDate userDate) { if (userCount == null && userDate == null) { return null; } - return PromotingInteroperabilitySearchResult.builder() - .userCount(userCount) - .userDate(userDate) - .build(); + return PromotingInteroperabilitySearchResult.builder().userCount(userCount).userDate(userDate).build(); } private Set convertToSetOfStrings(String delimitedString, String valueToIgnore, String delimeter) @@ -169,9 +164,7 @@ private Set convertToSetOfStrings(String delimitedString, String valueTo } String[] splitStrings = delimitedString.split(delimeter); - return Stream.of(splitStrings) - .filter(str -> !str.equals(valueToIgnore)) - .collect(Collectors.toSet()); + return Stream.of(splitStrings).filter(str -> !str.equals(valueToIgnore)).collect(Collectors.toSet()); } private Set convertToSetOfLongs(String delimitedString, String delimeter) @@ -181,14 +174,12 @@ private Set convertToSetOfLongs(String delimitedString, String delimeter) } String[] splitStrings = delimitedString.split(delimeter); - return Stream.of(splitStrings) - .filter(str -> NumberUtils.isParsable(str)) - .map(str -> Long.valueOf(str)) + return Stream.of(splitStrings).filter(str -> NumberUtils.isParsable(str)).map(str -> Long.valueOf(str)) .collect(Collectors.toSet()); } - private Set convertToSetOfDateRangesWithDelimiter(String delimitedDateRangeString, String delimeter) - throws EntityRetrievalException, DateTimeParseException, NumberFormatException { + private Set convertToSetOfDateRangesWithDelimiter(String delimitedDateRangeString, + String delimeter) throws EntityRetrievalException, DateTimeParseException, NumberFormatException { if (ObjectUtils.isEmpty(delimitedDateRangeString)) { return new LinkedHashSet(); } @@ -203,12 +194,12 @@ private DateRangeSearchResult convertToDateRange(String aggregatedDateRangeStrin throws EntityRetrievalException, DateTimeParseException, NumberFormatException { String[] dateRangeFields = aggregatedDateRangeString.split(STANDARD_FIELD_SPLIT_CHAR); if (dateRangeFields == null || dateRangeFields.length < DATE_RANGE_MIN_FIELD_COUNT) { - throw new EntityRetrievalException("Unable to parse date range fields from '" + aggregatedDateRangeString + "'."); + throw new EntityRetrievalException( + "Unable to parse date range fields from '" + aggregatedDateRangeString + "'."); } - return DateRangeSearchResult.builder() - .start(DateUtil.toLocalDate(Long.parseLong(dateRangeFields[0]))) - .end(dateRangeFields.length < DATE_RANGE_FIELD_COUNT || StringUtils.isEmpty(dateRangeFields[1]) - ? null : DateUtil.toLocalDate(Long.parseLong(dateRangeFields[1]))) + return DateRangeSearchResult.builder().start(DateUtil.toLocalDate(Long.parseLong(dateRangeFields[0]))) + .end(dateRangeFields.length < DATE_RANGE_FIELD_COUNT || StringUtils.isEmpty(dateRangeFields[1]) ? null + : DateUtil.toLocalDate(Long.parseLong(dateRangeFields[1]))) .build(); } @@ -228,19 +219,16 @@ private StatusEventSearchResult convertToStatusEvent(String aggregatedStatusEven throws EntityRetrievalException, DateTimeParseException, NumberFormatException { String[] statusEventFields = aggregatedStatusEventString.split(STANDARD_FIELD_SPLIT_CHAR); if (statusEventFields == null || statusEventFields.length != STATUS_EVENT_FIELD_COUNT) { - throw new EntityRetrievalException("Unable to parse status event fields from '" + aggregatedStatusEventString + "'."); + throw new EntityRetrievalException( + "Unable to parse status event fields from '" + aggregatedStatusEventString + "'."); } - return StatusEventSearchResult.builder() - .status(IdNamePair.builder() - .id(Long.parseLong(statusEventFields[0])) - .name(statusEventFields[1]) - .build()) - .statusStart(LocalDate.parse(statusEventFields[2])) - .build(); + return StatusEventSearchResult.builder().status( + IdNamePair.builder().id(Long.parseLong(statusEventFields[0])).name(statusEventFields[1]).build()) + .statusStart(LocalDate.parse(statusEventFields[2])).build(); } - private Set convertToSetOfCriteria(String delimitedCriteriaString, String delimeter) - throws EntityRetrievalException, NumberFormatException { + private Set convertToSetOfCriteria(String delimitedCriteriaString, + String delimeter) throws EntityRetrievalException, NumberFormatException { if (ObjectUtils.isEmpty(delimitedCriteriaString)) { return new LinkedHashSet(); } @@ -255,13 +243,11 @@ private CertificationCriterionSearchResult convertToCriterion(String aggregatedC throws EntityRetrievalException, NumberFormatException { String[] criterionFields = aggregatedCriterionString.split(STANDARD_FIELD_SPLIT_CHAR); if (criterionFields == null || criterionFields.length != CRITERIA_FIELD_COUNT) { - throw new EntityRetrievalException("Unable to parse criteria fields from '" + aggregatedCriterionString + "'."); + throw new EntityRetrievalException( + "Unable to parse criteria fields from '" + aggregatedCriterionString + "'."); } - return CertificationCriterionSearchResult.builder() - .id(Long.parseLong(criterionFields[0])) - .number(criterionFields[1]) - .title(criterionFields[2]) - .build(); + return CertificationCriterionSearchResult.builder().id(Long.parseLong(criterionFields[0])) + .number(criterionFields[1]).title(criterionFields[2]).build(); } private Set convertToSetOfCqms(String delimitedCqmString, String delimeter) @@ -271,8 +257,7 @@ private Set convertToSetOfCqms(String delimitedCqmString, Strin } String[] cqms = delimitedCqmString.split(delimeter); - return Stream.of(cqms) - .map(rethrowFunction(aggregatedCqmString -> convertToCqm(aggregatedCqmString))) + return Stream.of(cqms).map(rethrowFunction(aggregatedCqmString -> convertToCqm(aggregatedCqmString))) .collect(Collectors.toSet()); } @@ -282,13 +267,11 @@ private CQMSearchResult convertToCqm(String aggregatedCqmString) if (cqmFields == null || cqmFields.length != CQM_FIELD_COUNT) { throw new EntityRetrievalException("Unable to parse CQM fields from '" + aggregatedCqmString + "'."); } - return CQMSearchResult.builder() - .id(Long.parseLong(cqmFields[0])) - .number(cqmFields[1]) - .build(); + return CQMSearchResult.builder().id(Long.parseLong(cqmFields[0])).number(cqmFields[1]).build(); } - private Set convertToSetOfCriteriaWithStringFields(String delimitedCriteriaWithValueString, String delimeter) + private Set convertToSetOfCriteriaWithStringFields( + String delimitedCriteriaWithValueString, String delimeter) throws EntityRetrievalException, NumberFormatException { if (ObjectUtils.isEmpty(delimitedCriteriaWithValueString)) { return new LinkedHashSet(); @@ -297,8 +280,7 @@ private Set convertToSetOfCri String[] criteriaWithStringFields = delimitedCriteriaWithValueString.split(delimeter); return Stream.of(criteriaWithStringFields) .map(rethrowFunction(criterionWithValue -> convertToCriterionWithStringField(criterionWithValue))) - .filter(convertedValue -> convertedValue != null) - .collect(Collectors.toSet()); + .filter(convertedValue -> convertedValue != null).collect(Collectors.toSet()); } private CertificationCriterionSearchResultWithStringField convertToCriterionWithStringField(String value) @@ -311,19 +293,19 @@ private CertificationCriterionSearchResultWithStringField convertToCriterionWith if (criteriaSplitFromStringData == null || criteriaSplitFromStringData.length == 0) { throw new EntityRetrievalException("Unable to parse criteria with string value from '" + value + "'."); } - String aggregatedCriterionFields = criteriaSplitFromStringData.length >= 1 ? criteriaSplitFromStringData[0] : null; + String aggregatedCriterionFields = criteriaSplitFromStringData.length >= 1 ? criteriaSplitFromStringData[0] + : null; String fieldValue = criteriaSplitFromStringData.length >= 2 ? criteriaSplitFromStringData[1] : null; if (StringUtils.isEmpty(aggregatedCriterionFields) || StringUtils.isEmpty(fieldValue)) { return null; } return CertificationCriterionSearchResultWithStringField.builder() - .criterion(convertToCriterion(aggregatedCriterionFields)) - .value(fieldValue) - .build(); + .criterion(convertToCriterion(aggregatedCriterionFields)).value(fieldValue).build(); } - private Set convertToSetOfCriteriaWithLongFields(String delimitedCriteriaWithLongValue, String delimeter) + private Set convertToSetOfCriteriaWithLongFields( + String delimitedCriteriaWithLongValue, String delimeter) throws EntityRetrievalException, NumberFormatException { if (ObjectUtils.isEmpty(delimitedCriteriaWithLongValue)) { return new LinkedHashSet(); @@ -332,8 +314,8 @@ private Set convertToSetOfCrit String[] criteriaWithLongFields = delimitedCriteriaWithLongValue.split(delimeter); Stream.of(criteriaWithLongFields) - .map(rethrowFunction(criterionWithValue -> convertToCriterionWithLongField(criterionWithValue))) - .forEach(criterionWithLongField -> addToResult(criterionWithLongField, result)); + .map(rethrowFunction(criterionWithValue -> convertToCriterionWithLongField(criterionWithValue))) + .forEach(criterionWithLongField -> addToResult(criterionWithLongField, result)); return result; } @@ -361,13 +343,13 @@ private CertificationCriterionSearchResultWithLongFields convertToCriterionWithL values.add(fieldValue); return CertificationCriterionSearchResultWithLongFields.builder() - .criterion(convertToCriterion(aggregatedCriterionFields)) - .values(values) - .build(); + .criterion(convertToCriterion(aggregatedCriterionFields)).values(values).build(); } - private void addToResult(CertificationCriterionSearchResultWithLongFields item, Set results) { - CertificationCriterionSearchResultWithLongFields resultWithCriterion = getResultWithCriterion(item.getCriterion(), results); + private void addToResult(CertificationCriterionSearchResultWithLongFields item, + Set results) { + CertificationCriterionSearchResultWithLongFields resultWithCriterion = getResultWithCriterion( + item.getCriterion(), results); if (resultWithCriterion != null) { resultWithCriterion.getValues().addAll(item.getValues()); } else { @@ -375,11 +357,12 @@ private void addToResult(CertificationCriterionSearchResultWithLongFields item, } } - private CertificationCriterionSearchResultWithLongFields getResultWithCriterion(CertificationCriterionSearchResult criterion, Set results) { + private CertificationCriterionSearchResultWithLongFields getResultWithCriterion( + CertificationCriterionSearchResult criterion, + Set results) { CertificationCriterionSearchResultWithLongFields resultWithCriterion = null; Optional resultWithCriterionOpt = results.stream() - .filter(result -> result.getCriterion().getId().equals(criterion.getId())) - .findAny(); + .filter(result -> result.getCriterion().getId().equals(criterion.getId())).findAny(); if (resultWithCriterionOpt.isPresent()) { resultWithCriterion = resultWithCriterionOpt.get(); } @@ -394,7 +377,8 @@ private Set convertToSetOfProductOwners(String delimitedProductOwner String[] productOwners = delimitedProductOwnerString.split(delimeter); return Stream.of(productOwners) - .map(rethrowFunction(aggregatedProductOwnerString -> convertToProductOwner(aggregatedProductOwnerString))) + .map(rethrowFunction( + aggregatedProductOwnerString -> convertToProductOwner(aggregatedProductOwnerString))) .collect(Collectors.toSet()); } @@ -402,11 +386,9 @@ private IdNamePair convertToProductOwner(String aggregatedProductOwnerString) throws EntityRetrievalException, NumberFormatException { String[] productOwnerFields = aggregatedProductOwnerString.split(ListingSearchEntity.FROWNEY_SPLIT_CHAR); if (productOwnerFields == null || productOwnerFields.length != PRODUCT_OWNER_FIELD_COUNT) { - throw new EntityRetrievalException("Unable to parse product owner fields from '" + aggregatedProductOwnerString + "'."); + throw new EntityRetrievalException( + "Unable to parse product owner fields from '" + aggregatedProductOwnerString + "'."); } - return IdNamePair.builder() - .id(Long.parseLong(productOwnerFields[0])) - .name(productOwnerFields[1]) - .build(); + return IdNamePair.builder().id(Long.parseLong(productOwnerFields[0])).name(productOwnerFields[1]).build(); } } diff --git a/chpl/chpl-service/src/main/java/gov/healthit/chpl/search/domain/ListingSearchResult.java b/chpl/chpl-service/src/main/java/gov/healthit/chpl/search/domain/ListingSearchResult.java index 4464558c39..49c2a274e5 100644 --- a/chpl/chpl-service/src/main/java/gov/healthit/chpl/search/domain/ListingSearchResult.java +++ b/chpl/chpl-service/src/main/java/gov/healthit/chpl/search/domain/ListingSearchResult.java @@ -12,8 +12,6 @@ import org.apache.commons.lang3.StringUtils; import com.fasterxml.jackson.annotation.JsonIgnore; -import tools.jackson.databind.annotation.JsonDeserialize; -import tools.jackson.databind.annotation.JsonSerialize; import gov.healthit.chpl.domain.CertificationEdition; import gov.healthit.chpl.domain.IdNamePair; @@ -26,6 +24,8 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; +import tools.jackson.databind.annotation.JsonDeserialize; +import tools.jackson.databind.annotation.JsonSerialize; @Getter @Setter @@ -39,6 +39,7 @@ public class ListingSearchResult implements Serializable { private Long id; private String chplProductNumber; + private String listingDetailsUrl; private Set previousChplProductNumbers; private IdNamePair edition; private IdNamePair certificationBody; @@ -145,6 +146,7 @@ public static class DeveloperSearchResult implements Serializable { private Long id; private String name; private IdNamePair status; + private String developerDetailsUrl; } @Getter