From 6329609412ea140556c8c066a1f8e932854c1a1e Mon Sep 17 00:00:00 2001 From: mherman22 Date: Fri, 19 Jan 2024 21:06:59 +0300 Subject: [PATCH] fix syntax --- .../FhirMedicationDispenseDaoImpl_2_6.java | 6 +- .../module/fhir2/api/dao/impl/BaseDao.java | 56 +++++++++---------- .../fhir2/api/dao/impl/BaseEncounterDao.java | 16 +++--- .../fhir2/api/dao/impl/BaseFhirDao.java | 19 ++++--- .../fhir2/api/dao/impl/BasePersonDao.java | 10 ++-- .../api/dao/impl/BasePractitionerDao.java | 4 +- .../impl/FhirAllergyIntoleranceDaoImpl.java | 12 ++-- .../api/dao/impl/FhirConceptDaoImpl.java | 14 ++--- .../dao/impl/FhirConceptSourceDaoImpl.java | 8 +-- .../api/dao/impl/FhirConditionDaoImpl.java | 12 ++-- .../dao/impl/FhirContactPointMapDaoImpl.java | 10 ++-- .../dao/impl/FhirDiagnosticReportDaoImpl.java | 8 +-- .../api/dao/impl/FhirEncounterDaoImpl.java | 16 +++--- .../dao/impl/FhirGlobalPropertyDaoImpl.java | 10 ++-- .../fhir2/api/dao/impl/FhirGroupDaoImpl.java | 4 +- .../api/dao/impl/FhirLocationDaoImpl.java | 29 ++++------ .../api/dao/impl/FhirMedicationDaoImpl.java | 8 +-- .../impl/FhirMedicationRequestDaoImpl.java | 14 ++--- .../api/dao/impl/FhirObservationDaoImpl.java | 14 ++--- .../api/dao/impl/FhirPatientDaoImpl.java | 8 +-- .../FhirPatientIdentifierSystemDaoImpl.java | 4 +- .../fhir2/api/dao/impl/FhirPersonDaoImpl.java | 6 +- .../api/dao/impl/FhirPractitionerDaoImpl.java | 6 +- .../dao/impl/FhirRelatedPersonDaoImpl.java | 8 +-- .../dao/impl/FhirServiceRequestDaoImpl.java | 6 +- .../fhir2/api/dao/impl/FhirTaskDaoImpl.java | 6 +- .../fhir2/api/dao/impl/FhirUserDaoImpl.java | 4 +- .../fhir2/api/dao/impl/FhirVisitDaoImpl.java | 8 +-- 28 files changed, 158 insertions(+), 168 deletions(-) diff --git a/api-2.6/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirMedicationDispenseDaoImpl_2_6.java b/api-2.6/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirMedicationDispenseDaoImpl_2_6.java index 009a2a201..2942cd057 100644 --- a/api-2.6/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirMedicationDispenseDaoImpl_2_6.java +++ b/api-2.6/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirMedicationDispenseDaoImpl_2_6.java @@ -62,7 +62,7 @@ public List getSearchResults(@Nonnull SearchParameterMap the } @Override - protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { + protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { theParams.getParameters().forEach(entry -> { switch (entry.getKey()) { case FhirConstants.PATIENT_REFERENCE_SEARCH_HANDLER: @@ -92,12 +92,12 @@ protected void setupSearchParams(OpenmrsFhirCriteriaContext } @Override - protected Optional handleLastUpdated(OpenmrsFhirCriteriaContext criteriaContext, DateRangeParam param) { + protected Optional handleLastUpdated(OpenmrsFhirCriteriaContext criteriaContext, DateRangeParam param) { return super.handleLastUpdatedImmutable(criteriaContext,param); } @Override - protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, @NonNull String param) { + protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, @NonNull String param) { return super.paramToProp(criteriaContext, param); } } diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/BaseDao.java b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/BaseDao.java index 2a82f1fcf..557ba4eed 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/BaseDao.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/BaseDao.java @@ -558,7 +558,7 @@ protected Optional handleGender(OpenmrsFhirCriteriaContext Optional handleLocationReference(OpenmrsFhirCriteriaContext criteriaContext, + protected Optional handleLocationReference(OpenmrsFhirCriteriaContext criteriaContext, @Nonnull String locationAlias, ReferenceAndListParam locationReference) { if (locationReference == null) { @@ -593,7 +593,7 @@ protected Optional handleLocationReference(OpenmrsFhirCriteriaCon }); } - protected void handleParticipantReference(OpenmrsFhirCriteriaContext criteriaContext, + protected void handleParticipantReference(OpenmrsFhirCriteriaContext criteriaContext, ReferenceAndListParam participantReference) { if (participantReference != null) { Optional> encounterProvider = criteriaContext.getJoin("ep"); @@ -666,7 +666,7 @@ protected void handleParticipantReference(OpenmrsFhirCriteriaContext crit } //Added this method to allow handling classes with provider instead of encounterProvider - protected void handleProviderReference(OpenmrsFhirCriteriaContext criteriaContext, + protected void handleProviderReference(OpenmrsFhirCriteriaContext criteriaContext, ReferenceAndListParam providerReference) { if (providerReference != null) { Join orderer = criteriaContext.addJoin("orderer", "ord"); @@ -716,7 +716,7 @@ protected void handleProviderReference(OpenmrsFhirCriteriaContext criteri } } - protected Optional handleCodeableConcept(OpenmrsFhirCriteriaContext criteriaContext, + protected Optional handleCodeableConcept(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam concepts, @Nonnull String conceptAlias, @Nonnull String conceptMapAlias, @Nonnull String conceptReferenceTermAlias) { if (concepts == null) { @@ -750,12 +750,12 @@ protected Optional handleCodeableConcept(OpenmrsFhirCriteriaConte } - protected void handleNames(OpenmrsFhirCriteriaContext criteriaContext, StringAndListParam name, + protected void handleNames(OpenmrsFhirCriteriaContext criteriaContext, StringAndListParam name, StringAndListParam given, StringAndListParam family) { handleNames(criteriaContext, name, given, family, criteriaContext.getRoot()); } - protected void handleNames(OpenmrsFhirCriteriaContext criteriaContext, StringAndListParam name, + protected void handleNames(OpenmrsFhirCriteriaContext criteriaContext, StringAndListParam name, StringAndListParam given, StringAndListParam family, From person) { if (name == null && given == null && family == null) { @@ -793,12 +793,12 @@ protected void handleNames(OpenmrsFhirCriteriaContext criteriaContext, St } } - protected void handlePatientReference(OpenmrsFhirCriteriaContext criteriaContext, + protected void handlePatientReference(OpenmrsFhirCriteriaContext criteriaContext, ReferenceAndListParam patientReference) { handlePatientReference(criteriaContext, patientReference, "patient"); } - protected void handlePatientReference(OpenmrsFhirCriteriaContext criteriaContext, + protected void handlePatientReference(OpenmrsFhirCriteriaContext criteriaContext, ReferenceAndListParam patientReference, String associationPath) { if (patientReference != null) { Join associationPathJoin = criteriaContext.addJoin(associationPath, "p"); @@ -806,27 +806,23 @@ protected void handlePatientReference(OpenmrsFhirCriteriaContext criteria if (patientToken.getChain() != null) { switch (patientToken.getChain()) { case Patient.SP_IDENTIFIER: - @SuppressWarnings("unchecked") Join associationPathIdentifiersJoin = criteriaContext.addJoin(associationPathJoin, "identifiers", "pi"); return Optional.of(criteriaContext.getCriteriaBuilder() .like(associationPathIdentifiersJoin.get("identifier"), patientToken.getValue())); case Patient.SP_GIVEN: { - @SuppressWarnings("unchecked") Join associationPathNamesJoin = criteriaContext.addJoin(associationPathJoin, "names", "pn"); return Optional.of(criteriaContext.getCriteriaBuilder() .like(associationPathNamesJoin.get("givenName"), patientToken.getValue())); } case Patient.SP_FAMILY: { - @SuppressWarnings("unchecked") Join associationPathNamesJoin = criteriaContext.addJoin(associationPathJoin, "names", "pn"); return Optional.of(criteriaContext.getCriteriaBuilder() .like(associationPathNamesJoin.get("familyName"), patientToken.getValue())); } case Patient.SP_NAME: - @SuppressWarnings("unchecked") Join associationPathNamesJoin = criteriaContext.addJoin(associationPathJoin, "names", "pn"); @@ -912,7 +908,7 @@ protected Optional handlePersonAddress(OpenmrsFhirCriteriaCont return Optional.of(criteriaContext.getCriteriaBuilder().and(toCriteriaArray(predicateList.stream()))); } - protected Optional handleMedicationReference(OpenmrsFhirCriteriaContext criteriaContext, + protected Optional handleMedicationReference(OpenmrsFhirCriteriaContext criteriaContext, @Nonnull String medicationAlias, ReferenceAndListParam medicationReference) { if (medicationReference == null) { return Optional.empty(); @@ -923,7 +919,7 @@ protected Optional handleMedicationReference(OpenmrsFhirCriteriaC .equal(getRootOrJoin(criteriaContext, medicationAlias).get("uuid"), token.getIdPart()))); } - protected Optional handleMedicationRequestReference(OpenmrsFhirCriteriaContext criteriaContext, + protected Optional handleMedicationRequestReference(OpenmrsFhirCriteriaContext criteriaContext, @Nonnull String drugOrderAlias, ReferenceAndListParam drugOrderReference) { if (drugOrderReference == null) { return Optional.empty(); @@ -943,14 +939,14 @@ protected Optional handleMedicationRequestReference(OpenmrsFhirCr * @param criteriaContext The {@link OpenmrsFhirCriteriaContext} for the current query * @param sort the {@link SortSpec} which defines the sorting to be translated */ - protected void handleSort(OpenmrsFhirCriteriaContext criteriaContext, SortSpec sort) { + protected void handleSort(OpenmrsFhirCriteriaContext criteriaContext, SortSpec sort) { handleSort(criteriaContext, sort, this::paramToProps) .ifPresent(l -> l.forEach(criteriaContext.getCriteriaQuery()::orderBy)); } - protected Optional> handleSort(OpenmrsFhirCriteriaContext criteriaContext, + protected Optional> handleSort(OpenmrsFhirCriteriaContext criteriaContext, SortSpec sort, - BiFunction, SortState, Collection> paramToProp) { + BiFunction, SortState, Collection> paramToProp) { List orderings = new ArrayList<>(); SortSpec sortSpec = sort; while (sortSpec != null) { @@ -973,7 +969,7 @@ protected Optional> handleSort(Openmr } @SuppressWarnings("unchecked") - protected Predicate generateSystemQuery(OpenmrsFhirCriteriaContext criteriaContext, String system, + protected Predicate generateSystemQuery(OpenmrsFhirCriteriaContext criteriaContext, String system, List codes, String conceptReferenceTermAlias) { //detached criteria Specification spec = (root, query, @@ -999,7 +995,7 @@ protected Predicate generateSystemQuery(OpenmrsFhirCriteriaContext criter } } - protected Predicate generateActiveOrderQuery(OpenmrsFhirCriteriaContext criteriaContext, String path, + protected Predicate generateActiveOrderQuery(OpenmrsFhirCriteriaContext criteriaContext, String path, Date onDate) { // ACTIVE = date activated null or less than or equal to current datetime, date stopped null or in the future, auto expire date null or in the future return criteriaContext.getCriteriaBuilder().and( @@ -1017,23 +1013,23 @@ protected Predicate generateActiveOrderQuery(OpenmrsFhirCriteriaContext c onDate))); } - protected Predicate generateActiveOrderQuery(OpenmrsFhirCriteriaContext criteriaContext, String path) { + protected Predicate generateActiveOrderQuery(OpenmrsFhirCriteriaContext criteriaContext, String path) { return generateActiveOrderQuery(criteriaContext, path, new Date()); } - protected Predicate generateActiveOrderQuery(OpenmrsFhirCriteriaContext criteriaContext, Date onDate) { + protected Predicate generateActiveOrderQuery(OpenmrsFhirCriteriaContext criteriaContext, Date onDate) { return generateActiveOrderQuery(criteriaContext, "", onDate); } - protected Predicate generateActiveOrderQuery(OpenmrsFhirCriteriaContext criteriaContext) { + protected Predicate generateActiveOrderQuery(OpenmrsFhirCriteriaContext criteriaContext) { return generateActiveOrderQuery(criteriaContext, new Date()); } - protected Predicate generateNotCancelledOrderQuery(OpenmrsFhirCriteriaContext criteriaContext) { + protected Predicate generateNotCancelledOrderQuery(OpenmrsFhirCriteriaContext criteriaContext) { return generateNotCancelledOrderQuery(criteriaContext, ""); } - protected Predicate generateNotCancelledOrderQuery(OpenmrsFhirCriteriaContext criteriaContext, String path) { + protected Predicate generateNotCancelledOrderQuery(OpenmrsFhirCriteriaContext criteriaContext, String path) { Date now = new Date(); return criteriaContext.getCriteriaBuilder().or( @@ -1075,7 +1071,7 @@ protected TokenAndListParam convertStringStatusToBoolean(TokenAndListParam statu * @param sortState a {@link SortState} object describing the current sort state * @return the corresponding ordering(s) needed for this property */ - protected Collection paramToProps(OpenmrsFhirCriteriaContext criteriaContext, + protected Collection paramToProps(OpenmrsFhirCriteriaContext criteriaContext, @Nonnull SortState sortState) { Collection prop = paramToProps(criteriaContext, sortState.getParameter()); if (prop != null) { @@ -1100,7 +1096,7 @@ protected Collection paramToProps(OpenmrsFhirCriteriaContext crite * @param param the FHIR parameter to map * @return the name of the corresponding property from the current query */ - protected Collection paramToProps(OpenmrsFhirCriteriaContext criteriaContext, @Nonnull String param) { + protected Collection paramToProps(OpenmrsFhirCriteriaContext criteriaContext, @Nonnull String param) { String prop = paramToProp(criteriaContext, param); if (prop != null) { @@ -1117,11 +1113,11 @@ protected Collection paramToProps(OpenmrsFhirCriteriaContext crit * @param param the FHIR parameter to map * @return the name of the corresponding property from the current query */ - protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, @Nonnull String param) { + protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, @Nonnull String param) { return null; } - protected Optional propertyLike(OpenmrsFhirCriteriaContext criteriaContext, From from, + protected Optional propertyLike(OpenmrsFhirCriteriaContext criteriaContext, From from, @Nonnull String propertyName, String value) { if (value == null) { return Optional.empty(); @@ -1130,7 +1126,7 @@ protected Optional propertyLike(OpenmrsFhirCriteriaContext cri return propertyLike(criteriaContext, from, propertyName, new StringParam(value)); } - protected Optional propertyLike(OpenmrsFhirCriteriaContext criteriaContext, From from, + protected Optional propertyLike(OpenmrsFhirCriteriaContext criteriaContext, From from, @Nonnull String propertyName, StringParam param) { if (param == null) { return Optional.empty(); @@ -1198,7 +1194,7 @@ public static final class SortState { private String parameter; } - protected Optional handleAgeByDateProperty(OpenmrsFhirCriteriaContext criteriaContext, + protected Optional handleAgeByDateProperty(OpenmrsFhirCriteriaContext criteriaContext, @Nonnull String datePropertyName, @Nonnull QuantityParam age) { BigDecimal value = age.getValue(); if (value == null) { diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/BaseEncounterDao.java b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/BaseEncounterDao.java index a2ba9c371..50194c28a 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/BaseEncounterDao.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/BaseEncounterDao.java @@ -37,7 +37,7 @@ public abstract class BaseEncounterDao extends BaseFhirDao { @Override - protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { + protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { theParams.getParameters().forEach(entry -> { switch (entry.getKey()) { case FhirConstants.DATE_RANGE_SEARCH_HANDLER: @@ -82,7 +82,7 @@ protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, * dependent resources */ @SuppressWarnings("UnstableApiUsage") - protected void handleHasAndListParam(OpenmrsFhirCriteriaContext criteriaContext, HasAndListParam hasAndListParam) { + protected void handleHasAndListParam(OpenmrsFhirCriteriaContext criteriaContext, HasAndListParam hasAndListParam) { if (hasAndListParam != null) { log.debug("Handling hasAndListParam"); hasAndListParam.getValuesAsQueryTokens().forEach(hasOrListParam -> { @@ -177,26 +177,26 @@ protected void handleHasAndListParam(OpenmrsFhirCriteriaContext criteriaConte } } - protected abstract void handleDate(OpenmrsFhirCriteriaContext criteriaContext, DateRangeParam dateRangeParam); + protected abstract void handleDate(OpenmrsFhirCriteriaContext criteriaContext, DateRangeParam dateRangeParam); - protected abstract void handleEncounterType(OpenmrsFhirCriteriaContext criteriaContext, + protected abstract void handleEncounterType(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam tokenAndListParam); - protected abstract void handleParticipant(OpenmrsFhirCriteriaContext criteriaContext, + protected abstract void handleParticipant(OpenmrsFhirCriteriaContext criteriaContext, ReferenceAndListParam referenceAndListParam); - protected Predicate generateNotCompletedOrderQuery(OpenmrsFhirCriteriaContext criteriaContext, String path) { + protected Predicate generateNotCompletedOrderQuery(OpenmrsFhirCriteriaContext criteriaContext, String path) { // not implemented in Core until 2.2; see override in FhirEncounterDaoImpl_2_2 return null; } - protected Predicate generateFulfillerStatusRestriction(OpenmrsFhirCriteriaContext criteriaContext, String path, + protected Predicate generateFulfillerStatusRestriction(OpenmrsFhirCriteriaContext criteriaContext, String path, String fulfillerStatus) { // not implemented in Core until 2.2; see override in FhirEncounterDaoImpl_2_2 return null; } - protected Predicate generateNotFulfillerStatusRestriction(OpenmrsFhirCriteriaContext criteriaContext, String path, + protected Predicate generateNotFulfillerStatusRestriction(OpenmrsFhirCriteriaContext criteriaContext, String path, String fulfillerStatus) { // not implemented in Core until 2.2; see override in FhirEncounterDaoImpl_2_2 return null; diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/BaseFhirDao.java b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/BaseFhirDao.java index 843611f83..668991239 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/BaseFhirDao.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/BaseFhirDao.java @@ -289,7 +289,7 @@ public boolean hasDistinctResults() { return true; } - protected void createAlias(OpenmrsFhirCriteriaContext criteriaContext, String referencedEntity, String alias) { + protected void createAlias(OpenmrsFhirCriteriaContext criteriaContext, String referencedEntity, String alias) { criteriaContext.getRoot().join(referencedEntity).alias(alias); } @@ -303,7 +303,7 @@ protected Optional handleLastUpdated(OpenmrsFhirCriteriaContex return handleLastUpdatedMutable(criteriaContext, param); } - protected Optional handleLastUpdatedMutable(OpenmrsFhirCriteriaContext criteriaContext, + protected Optional handleLastUpdatedMutable(OpenmrsFhirCriteriaContext criteriaContext, DateRangeParam param) { // @formatter:off return Optional.of(criteriaContext.getCriteriaBuilder().or(toCriteriaArray(handleDateRange(criteriaContext,"dateChanged", param), Optional.of( @@ -312,7 +312,7 @@ protected Optional handleLastUpdatedMutable(OpenmrsFhirCriteriaCo } // Implementation of handleLastUpdated for "immutable" types, that is, those that cannot be changed - protected Optional handleLastUpdatedImmutable(OpenmrsFhirCriteriaContext criteriaContext, + protected Optional handleLastUpdatedImmutable(OpenmrsFhirCriteriaContext criteriaContext, DateRangeParam param) { return handleDateRange(criteriaContext, "dateCreated", param); } @@ -323,7 +323,7 @@ protected Optional handleLastUpdatedImmutable(OpenmrsFhirCriteria * * @param criteriaContext The {@link OpenmrsFhirCriteriaContext} for the current query */ - protected void handleVoidable(OpenmrsFhirCriteriaContext criteriaContext) { + protected void handleVoidable(OpenmrsFhirCriteriaContext criteriaContext) { criteriaContext .addPredicate(criteriaContext.getCriteriaBuilder().equal(criteriaContext.getRoot().get("voided"), false)); } @@ -334,7 +334,7 @@ protected void handleVoidable(OpenmrsFhirCriteriaContext criteriaContext) { * * @param criteriaContext The {@link OpenmrsFhirCriteriaContext} for the current query */ - protected void handleRetireable(OpenmrsFhirCriteriaContext criteriaContext) { + protected void handleRetireable(OpenmrsFhirCriteriaContext criteriaContext) { criteriaContext .addPredicate(criteriaContext.getCriteriaBuilder().equal(criteriaContext.getRoot().get("retired"), false)); } @@ -401,7 +401,7 @@ protected Collection paramToProps(Openm } @Override - protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, @Nonnull String param) { + protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, @Nonnull String param) { if (DomainResource.SP_RES_ID.equals(param)) { return "uuid"; } @@ -410,7 +410,7 @@ protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, } @SuppressWarnings("unchecked") - protected void applyExactTotal(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { + protected void applyExactTotal(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { List> exactTotal = theParams.getParameters(EXACT_TOTAL_SEARCH_PARAMETER); if (!exactTotal.isEmpty()) { PropParam propParam = (PropParam) exactTotal.get(0); @@ -449,13 +449,14 @@ public static String getPropertyName(Expression expression) { * @param criteriaContext The criteria context containing the criteria builder and root. * @param idPropertyName The name of the id property to be used for ordering. */ - private void handleIdPropertyOrdering(OpenmrsFhirCriteriaContext criteriaContext, String idPropertyName) { + private void handleIdPropertyOrdering(OpenmrsFhirCriteriaContext criteriaContext, String idPropertyName) { criteriaContext.getCriteriaQuery() .orderBy(criteriaContext.getCriteriaBuilder().asc(criteriaContext.getRoot().get(idPropertyName))); } /** - * Handles the ordering of the criteria based on the specified id property name. + * Handles the ordering + * of the criteria based on the specified id property name. * * @param criteriaBuilder The criteria builder to build expressions * @param criteriaQuery The criteria query for the idPropertyName. diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/BasePersonDao.java b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/BasePersonDao.java index a9da0fc90..2e3df6d71 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/BasePersonDao.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/BasePersonDao.java @@ -54,7 +54,7 @@ public abstract class BasePersonDao extends * @return the property that points to the person for this object */ @SuppressWarnings("UnstableApiUsage") - protected From getPersonProperty(OpenmrsFhirCriteriaContext criteriaContext) { + protected From getPersonProperty(OpenmrsFhirCriteriaContext criteriaContext) { Class rawType = typeToken.getRawType(); if (rawType.equals(Person.class) || rawType.equals(Patient.class)) { return criteriaContext.getRoot(); @@ -64,7 +64,7 @@ public abstract class BasePersonDao extends } @Override - protected Collection paramToProps(OpenmrsFhirCriteriaContext criteriaContext, + protected Collection paramToProps(OpenmrsFhirCriteriaContext criteriaContext, @Nonnull SortState sortState) { String param = sortState.getParameter(); @@ -154,7 +154,7 @@ protected Collection paramToProps(OpenmrsFhirCriteriaContext crite } @Override - protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, @Nonnull String param) { + protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, @Nonnull String param) { switch (param) { case SP_BIRTHDATE: return "birthdate"; @@ -171,7 +171,7 @@ protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, } } - protected void handleAddresses(OpenmrsFhirCriteriaContext criteriaContext, + protected void handleAddresses(OpenmrsFhirCriteriaContext criteriaContext, Map.Entry>> entry) { StringAndListParam city = null; StringAndListParam country = null; @@ -202,7 +202,7 @@ protected void handleAddresses(OpenmrsFhirCriteriaContext criteriaContext, }); } - protected void handleNames(OpenmrsFhirCriteriaContext criteriaContext, List> params) { + protected void handleNames(OpenmrsFhirCriteriaContext criteriaContext, List> params) { StringAndListParam name = null; StringAndListParam given = null; StringAndListParam family = null; diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/BasePractitionerDao.java b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/BasePractitionerDao.java index c69acc7ef..8b265dd46 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/BasePractitionerDao.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/BasePractitionerDao.java @@ -23,7 +23,7 @@ public abstract class BasePractitionerDao extends BasePersonDao { @Override - protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { + protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { criteriaContext.getRoot().join("person").alias("p"); theParams.getParameters().forEach(entry -> { switch (entry.getKey()) { @@ -45,5 +45,5 @@ protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, }); } - protected abstract void handleIdentifier(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam identifier); + protected abstract void handleIdentifier(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam identifier); } diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirAllergyIntoleranceDaoImpl.java b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirAllergyIntoleranceDaoImpl.java index bb8e4fe99..5e35dd277 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirAllergyIntoleranceDaoImpl.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirAllergyIntoleranceDaoImpl.java @@ -53,7 +53,7 @@ public Allergy createOrUpdate(@Nonnull Allergy allergy) { } @Override - protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { + protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { theParams.getParameters().forEach(entry -> { switch (entry.getKey()) { case FhirConstants.PATIENT_REFERENCE_SEARCH_HANDLER: @@ -92,7 +92,7 @@ protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaCon }); } - private void handleManifestation(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam code) { + private void handleManifestation(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam code) { if (code != null) { Join reactionJoin = criteriaContext.addJoin("reactions", "r"); criteriaContext.addJoin(reactionJoin, "reaction", "rc"); @@ -102,7 +102,7 @@ private void handleManifestation(OpenmrsFhirCriteriaContext criteriaCon } } - private void handleAllergen(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam code) { + private void handleAllergen(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam code) { if (code != null) { Join allergenJoin = criteriaContext.addJoin("allergen", "allergen"); criteriaContext.addJoin(allergenJoin, "codedAllergen", "ac"); @@ -112,7 +112,7 @@ private void handleAllergen(OpenmrsFhirCriteriaContext criteriaContext, } } - private void handleSeverity(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam severityParam) { + private void handleSeverity(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam severityParam) { if (severityParam == null) { return; } @@ -147,7 +147,7 @@ private void handleSeverity(OpenmrsFhirCriteriaContext criteriaContext, criteriaContext.finalizeQuery(); } - private Optional handleAllergenCategory(OpenmrsFhirCriteriaContext criteriaContext, + private Optional handleAllergenCategory(OpenmrsFhirCriteriaContext criteriaContext, From allergyJoin, String propertyName, TokenAndListParam categoryParam) { if (categoryParam == null) { return Optional.empty(); @@ -179,7 +179,7 @@ private Optional handleAllergenCategory(OpenmrsFhirCriteriaContex } @Override - protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, @NonNull String param) { + protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, @NonNull String param) { if (AllergyIntolerance.SP_SEVERITY.equals(param)) { return "severity"; } diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirConceptDaoImpl.java b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirConceptDaoImpl.java index 9010a35b6..157ae0ac2 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirConceptDaoImpl.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirConceptDaoImpl.java @@ -52,7 +52,7 @@ public Optional getConceptWithSameAsMappingInSource(@Nonnull ConceptSou return Optional.empty(); } - OpenmrsFhirCriteriaContext criteriaContext = createCriteriaContext(Concept.class); + OpenmrsFhirCriteriaContext criteriaContext = createCriteriaContext(Concept.class); createConceptMapCriteriaBuilder(conceptSource, mappingCode); Optional> conceptAliasJoin = criteriaContext.getJoin("concept"); @@ -81,12 +81,12 @@ public List getConceptsWithAnyMappingInSource(@Nonnull ConceptSource co return Collections.emptyList(); } - OpenmrsFhirCriteriaContext criteriaContext = createCriteriaContext(ConceptMap.class); + OpenmrsFhirCriteriaContext criteriaContext = createCriteriaContext(ConceptMap.class); createConceptMapCriteriaBuilder(conceptSource, mappingCode); Join conceptJoin = criteriaContext.addJoin("concept", "concept"); criteriaContext.addOrder(criteriaContext.getCriteriaBuilder().asc(conceptJoin.get("retired"))); - OpenmrsFhirCriteriaContext fhirCriteriaContext = createCriteriaContext(Concept.class); + OpenmrsFhirCriteriaContext fhirCriteriaContext = createCriteriaContext(Concept.class); return fhirCriteriaContext.getEntityManager().createQuery(fhirCriteriaContext.getCriteriaQuery()) .unwrap(org.hibernate.query.Query.class).setResultTransformer(DistinctRootEntityResultTransformer.INSTANCE) @@ -94,7 +94,7 @@ public List getConceptsWithAnyMappingInSource(@Nonnull ConceptSource co } @Override - protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { + protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { criteriaContext.getCriteriaBuilder() .and(criteriaContext.getCriteriaBuilder().equal(criteriaContext.getRoot().get("set"), true)); theParams.getParameters().forEach(entry -> { @@ -106,7 +106,7 @@ protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaCon }); } - protected void handleTitle(OpenmrsFhirCriteriaContext criteriaContext, StringAndListParam titlePattern) { + protected void handleTitle(OpenmrsFhirCriteriaContext criteriaContext, StringAndListParam titlePattern) { Join conceptNamesJoin = criteriaContext.addJoin("names", "cn"); handleAndListParam(criteriaContext.getCriteriaBuilder(), titlePattern, (title) -> propertyLike(criteriaContext, conceptNamesJoin, "name", title)) @@ -114,8 +114,8 @@ protected void handleTitle(OpenmrsFhirCriteriaContext criteriaContext, criteriaContext.finalizeQuery(); } - protected void createConceptMapCriteriaBuilder(@Nonnull ConceptSource conceptSource, String mappingCode) { - OpenmrsFhirCriteriaContext criteriaContext = createCriteriaContext(ConceptMap.class); + protected void createConceptMapCriteriaBuilder(@Nonnull ConceptSource conceptSource, String mappingCode) { + OpenmrsFhirCriteriaContext criteriaContext = createCriteriaContext(ConceptMap.class); criteriaContext.getCriteriaQuery().select(criteriaContext.getRoot().get("concept")); criteriaContext.addJoin("conceptMapType", "mapType"); criteriaContext.addJoin("concept", "concept"); diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirConceptSourceDaoImpl.java b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirConceptSourceDaoImpl.java index ed70d8579..1316c2dc6 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirConceptSourceDaoImpl.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirConceptSourceDaoImpl.java @@ -47,7 +47,7 @@ public class FhirConceptSourceDaoImpl implements FhirConceptSourceDao { @Override @Transactional(readOnly = true) public Collection getFhirConceptSources() { - OpenmrsFhirCriteriaContext criteriaContext = openmrsFhirCriteriaContext(); + OpenmrsFhirCriteriaContext criteriaContext = openmrsFhirCriteriaContext(); criteriaContext.getCriteriaQuery().select(criteriaContext.getRoot()); return criteriaContext.getEntityManager().createQuery(criteriaContext.getCriteriaQuery()).getResultList(); @@ -55,7 +55,7 @@ public Collection getFhirConceptSources() { @Override public Optional getFhirConceptSourceByUrl(@Nonnull String url) { - OpenmrsFhirCriteriaContext criteriaContext = openmrsFhirCriteriaContext(); + OpenmrsFhirCriteriaContext criteriaContext = openmrsFhirCriteriaContext(); criteriaContext.getCriteriaQuery().select(criteriaContext.getRoot()); criteriaContext.addPredicate(criteriaContext.getCriteriaBuilder().and( @@ -74,7 +74,7 @@ public Optional getFhirConceptSourceByUrl(@Nonnull String url @Override public Optional getFhirConceptSourceByConceptSourceName(@Nonnull String sourceName) { - OpenmrsFhirCriteriaContext criteriaContext = openmrsFhirCriteriaContext(); + OpenmrsFhirCriteriaContext criteriaContext = openmrsFhirCriteriaContext(); criteriaContext.getCriteriaQuery().select(criteriaContext.getRoot()); Join conceptSourceJoin = criteriaContext.getRoot().join("conceptSource"); @@ -143,7 +143,7 @@ public FhirConceptSource saveFhirConceptSource(@Nonnull FhirConceptSource fhirCo return fhirConceptSource; } - private OpenmrsFhirCriteriaContext openmrsFhirCriteriaContext() { + private OpenmrsFhirCriteriaContext openmrsFhirCriteriaContext() { EntityManager em = sessionFactory.getCurrentSession(); CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery cq = cb.createQuery(FhirConceptSource.class); diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirConditionDaoImpl.java b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirConditionDaoImpl.java index 931859da2..9ff948b18 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirConditionDaoImpl.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirConditionDaoImpl.java @@ -72,7 +72,7 @@ public boolean hasDistinctResults() { } @Override - protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { + protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { theParams.getParameters().forEach(entry -> { switch (entry.getKey()) { case FhirConstants.PATIENT_REFERENCE_SEARCH_HANDLER: @@ -104,7 +104,7 @@ protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaC }); } - private void handleCode(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam code) { + private void handleCode(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam code) { if (code != null) { criteriaContext.getRoot().join("condition.coded").alias("cd"); handleCodeableConcept(criteriaContext, code, "cd", "map", "term").ifPresent(criteriaContext::addPredicate); @@ -112,7 +112,7 @@ private void handleCode(OpenmrsFhirCriteriaContext criteriaContext, T } } - private void handleClinicalStatus(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam status) { + private void handleClinicalStatus(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam status) { handleAndListParam(criteriaContext.getCriteriaBuilder(), status, tokenParam -> Optional.of(criteriaContext.getCriteriaBuilder() .equal(criteriaContext.getRoot().get("clinicalStatus"), convertStatus(tokenParam.getValue())))) @@ -120,7 +120,7 @@ private void handleClinicalStatus(OpenmrsFhirCriteriaContext criteria criteriaContext.finalizeQuery(); } - private void handleOnsetAge(OpenmrsFhirCriteriaContext criteriaContext, QuantityAndListParam onsetAge) { + private void handleOnsetAge(OpenmrsFhirCriteriaContext criteriaContext, QuantityAndListParam onsetAge) { handleAndListParam(criteriaContext.getCriteriaBuilder(), onsetAge, onsetAgeParam -> handleAgeByDateProperty(criteriaContext, "onsetDate", onsetAgeParam)) .ifPresent(criteriaContext::addPredicate); @@ -128,13 +128,13 @@ private void handleOnsetAge(OpenmrsFhirCriteriaContext criteriaContex } @Override - protected Optional handleLastUpdated(OpenmrsFhirCriteriaContext criteriaContext, + protected Optional handleLastUpdated(OpenmrsFhirCriteriaContext criteriaContext, DateRangeParam param) { return super.handleLastUpdated(criteriaContext, param); } @Override - protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, @NonNull String param) { + protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, @NonNull String param) { switch (param) { case org.hl7.fhir.r4.model.Condition.SP_ONSET_DATE: return "onsetDate"; diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirContactPointMapDaoImpl.java b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirContactPointMapDaoImpl.java index 67b6e8bff..e6c102b8a 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirContactPointMapDaoImpl.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirContactPointMapDaoImpl.java @@ -41,7 +41,7 @@ public class FhirContactPointMapDaoImpl implements FhirContactPointMapDao { @Override public Optional getFhirContactPointMapByUuid(String uuid) { - OpenmrsFhirCriteriaContext criteriaContext = openmrsFhirCriteriaContext(); + OpenmrsFhirCriteriaContext criteriaContext = openmrsFhirCriteriaContext(); criteriaContext .addPredicate(criteriaContext.getCriteriaBuilder().equal(criteriaContext.getRoot().get("uuid"), uuid)); @@ -56,7 +56,7 @@ public Optional getFhirContactPointMapForPersonAttributeTyp return Optional.empty(); } - OpenmrsFhirCriteriaContext criteriaContext = openmrsFhirCriteriaContext(); + OpenmrsFhirCriteriaContext criteriaContext = openmrsFhirCriteriaContext(); criteriaContext.getCriteriaQuery().select(criteriaContext.getRoot()); return criteriaContext.getEntityManager().createQuery( @@ -89,7 +89,7 @@ public Optional getFhirContactPointMapForAttributeType( return Optional.empty(); } - OpenmrsFhirCriteriaContext criteriaContext = openmrsFhirCriteriaContext(); + OpenmrsFhirCriteriaContext criteriaContext = openmrsFhirCriteriaContext(); criteriaContext.getCriteriaQuery().select(criteriaContext.getRoot()); return criteriaContext.getEntityManager().createQuery( @@ -100,7 +100,7 @@ public Optional getFhirContactPointMapForAttributeType( @Override public FhirContactPointMap saveFhirContactPointMap(@Nonnull FhirContactPointMap contactPointMap) { - OpenmrsFhirCriteriaContext criteriaContext = openmrsFhirCriteriaContext(); + OpenmrsFhirCriteriaContext criteriaContext = openmrsFhirCriteriaContext(); criteriaContext.getCriteriaQuery().select(criteriaContext.getRoot()); FhirContactPointMap existingContactPointMap = criteriaContext.getEntityManager().createQuery( @@ -121,7 +121,7 @@ public FhirContactPointMap saveFhirContactPointMap(@Nonnull FhirContactPointMap } } - private OpenmrsFhirCriteriaContext openmrsFhirCriteriaContext() { + private OpenmrsFhirCriteriaContext openmrsFhirCriteriaContext() { EntityManager em = sessionFactory.getCurrentSession(); CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery cq = cb.createQuery(FhirContactPointMap.class); diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirDiagnosticReportDaoImpl.java b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirDiagnosticReportDaoImpl.java index 8f44c8338..2887932fd 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirDiagnosticReportDaoImpl.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirDiagnosticReportDaoImpl.java @@ -31,7 +31,7 @@ public class FhirDiagnosticReportDaoImpl extends BaseFhirDao implements FhirDiagnosticReportDao { @Override - protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, + protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { theParams.getParameters().forEach(entry -> { switch (entry.getKey()) { @@ -65,7 +65,7 @@ protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, + private void handleCodedConcept(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam code) { if (code != null) { if (!criteriaContext.getJoin("c").isPresent()) { @@ -76,7 +76,7 @@ private void handleCodedConcept(OpenmrsFhirCriteriaContext } } - private void handleObservationReference(OpenmrsFhirCriteriaContext criteriaContext, + private void handleObservationReference(OpenmrsFhirCriteriaContext criteriaContext, ReferenceAndListParam result) { if (result != null) { Join resultsJoin = criteriaContext.addJoin("results", "obs"); @@ -89,7 +89,7 @@ private void handleObservationReference(OpenmrsFhirCriteriaContext String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, @NonNull String param) { + protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, @NonNull String param) { if (DiagnosticReport.SP_ISSUED.equals(param)) { return "issued"; } diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirEncounterDaoImpl.java b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirEncounterDaoImpl.java index 7a8d96680..c14d8e172 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirEncounterDaoImpl.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirEncounterDaoImpl.java @@ -51,7 +51,7 @@ public boolean hasDistinctResults() { @Override public List getSearchResultUuids(@Nonnull SearchParameterMap theParams) { - OpenmrsFhirCriteriaContext criteriaContext = createCriteriaContext(Encounter.class); + OpenmrsFhirCriteriaContext criteriaContext = createCriteriaContext(Encounter.class); if (!theParams.getParameters(FhirConstants.LASTN_ENCOUNTERS_SEARCH_HANDLER).isEmpty()) { setupSearchParams(criteriaContext, theParams); @@ -88,13 +88,13 @@ private int getMaxParameter(SearchParameterMap theParams) { } @Override - protected void handleDate(OpenmrsFhirCriteriaContext criteriaContext, DateRangeParam dateRangeParam) { + protected void handleDate(OpenmrsFhirCriteriaContext criteriaContext, DateRangeParam dateRangeParam) { handleDateRange(criteriaContext, "encounterDatetime", dateRangeParam).ifPresent(criteriaContext::addPredicate); criteriaContext.finalizeQuery(); } @Override - protected void handleEncounterType(OpenmrsFhirCriteriaContext criteriaContext, + protected void handleEncounterType(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam tokenAndListParam) { handleAndListParam(criteriaContext.getCriteriaBuilder(), tokenAndListParam, t -> { Join et = criteriaContext.getRoot().join("encounterType"); @@ -104,14 +104,14 @@ protected void handleEncounterType(OpenmrsFhirCriteriaContext criteri } @Override - protected void handleParticipant(OpenmrsFhirCriteriaContext criteriaContext, + protected void handleParticipant(OpenmrsFhirCriteriaContext criteriaContext, ReferenceAndListParam referenceAndListParam) { criteriaContext.getRoot().join("encounterProviders"); handleParticipantReference(criteriaContext, referenceAndListParam); } @Override - protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, @NonNull String param) { + protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, @NonNull String param) { switch (param) { case SP_DATE: return "encounterDatetime"; @@ -121,7 +121,7 @@ protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, } @Override - protected Predicate generateNotCompletedOrderQuery(OpenmrsFhirCriteriaContext criteriaContext, String path) { + protected Predicate generateNotCompletedOrderQuery(OpenmrsFhirCriteriaContext criteriaContext, String path) { return criteriaContext.getCriteriaBuilder().or( criteriaContext.getCriteriaBuilder().isNull(criteriaContext.getRoot().join(path).get("fulfillerStatus")), criteriaContext.getCriteriaBuilder().notEqual(criteriaContext.getRoot().join(path).get("fulfillerStatus"), @@ -129,14 +129,14 @@ protected Predicate generateNotCompletedOrderQuery(OpenmrsFhirCriteriaContex } @Override - protected Predicate generateFulfillerStatusRestriction(OpenmrsFhirCriteriaContext criteriaContext, String path, + protected Predicate generateFulfillerStatusRestriction(OpenmrsFhirCriteriaContext criteriaContext, String path, String fulfillerStatus) { return criteriaContext.getCriteriaBuilder().equal(criteriaContext.getRoot().join(path).get("fulfillerStatus"), Order.FulfillerStatus.valueOf(fulfillerStatus.toUpperCase())); } @Override - protected Predicate generateNotFulfillerStatusRestriction(OpenmrsFhirCriteriaContext criteriaContext, String path, + protected Predicate generateNotFulfillerStatusRestriction(OpenmrsFhirCriteriaContext criteriaContext, String path, String fulfillerStatus) { return criteriaContext.getCriteriaBuilder().or( criteriaContext.getCriteriaBuilder().isNull(criteriaContext.getRoot().join(path).get("fulfillerStatus")), diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirGlobalPropertyDaoImpl.java b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirGlobalPropertyDaoImpl.java index 9f1979754..48a3da3fd 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirGlobalPropertyDaoImpl.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirGlobalPropertyDaoImpl.java @@ -44,7 +44,7 @@ public String getGlobalProperty(String property) throws APIException { @Override public GlobalProperty getGlobalPropertyObject(String property) { - OpenmrsFhirCriteriaContext criteriaContext = openmrsFhirCriteriaContext(); + OpenmrsFhirCriteriaContext criteriaContext = createCriteriaContext(); criteriaContext.getCriteriaQuery() .where(criteriaContext.getCriteriaBuilder().equal(criteriaContext.getRoot().get("property"), property)); @@ -56,10 +56,10 @@ public GlobalProperty getGlobalPropertyObject(String property) { public Map getGlobalProperties(String... properties) { Map globalPropertiesMap = new HashMap<>(); - openmrsFhirCriteriaContext().getCriteriaQuery().where(openmrsFhirCriteriaContext().getCriteriaQuery() + createCriteriaContext().getCriteriaQuery().where(createCriteriaContext().getCriteriaQuery() .from(GlobalProperty.class).get("property").in((Object[]) properties)); - Collection globalProperties = openmrsFhirCriteriaContext().getEntityManager() - .createQuery(openmrsFhirCriteriaContext().getCriteriaQuery()).getResultList(); + Collection globalProperties = createCriteriaContext().getEntityManager() + .createQuery(createCriteriaContext().getCriteriaQuery()).getResultList(); for (GlobalProperty property : globalProperties) { globalPropertiesMap.put(property.getProperty(), property.getPropertyValue()); @@ -68,7 +68,7 @@ public Map getGlobalProperties(String... properties) { return globalPropertiesMap; } - protected OpenmrsFhirCriteriaContext openmrsFhirCriteriaContext() { + private OpenmrsFhirCriteriaContext createCriteriaContext() { EntityManager em = sessionFactory.getCurrentSession(); CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery cq = cb.createQuery(GlobalProperty.class); diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirGroupDaoImpl.java b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirGroupDaoImpl.java index afbb39030..2534e9ded 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirGroupDaoImpl.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirGroupDaoImpl.java @@ -36,7 +36,7 @@ public class FhirGroupDaoImpl extends BaseFhirDao implements FhirGroupDa private static final String PERSON_ALIAS = "person"; @Override - protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { + protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { theParams.getParameters().forEach(entry -> { if (FhirConstants.PARTICIPANT_REFERENCE_SEARCH_HANDLER.equals(entry.getKey())) { entry.getValue() @@ -50,7 +50,7 @@ protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaCont * Find a way to merge this logic into handleParticipantReference logic in the BaseDao class * make it reusable */ - protected void handleManagingEntity(OpenmrsFhirCriteriaContext criteriaContext, + protected void handleManagingEntity(OpenmrsFhirCriteriaContext criteriaContext, ReferenceAndListParam participantReference) { if (participantReference != null) { Join creatorJoin = criteriaContext.addJoin("creator", "cr"); diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirLocationDaoImpl.java b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirLocationDaoImpl.java index b7578b5b7..17c573c44 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirLocationDaoImpl.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirLocationDaoImpl.java @@ -42,7 +42,7 @@ public class FhirLocationDaoImpl extends BaseFhirDao implements FhirLo LocationService locationService; @Override - protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { + protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { theParams.getParameters().forEach(entry -> { switch (entry.getKey()) { case FhirConstants.NAME_SEARCH_HANDLER: @@ -79,7 +79,8 @@ protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaCo @Override public List getActiveAttributesByLocationAndAttributeTypeUuid(@Nonnull Location location, @Nonnull String locationAttributeTypeUuid) { - OpenmrsFhirCriteriaContext criteriaContext = openmrsFhirCriteriaContext(); + OpenmrsFhirCriteriaContext criteriaContext = createCriteriaContext( + LocationAttribute.class); criteriaContext.getCriteriaQuery().select(criteriaContext.getRoot()); criteriaContext.addPredicate(criteriaContext.getCriteriaBuilder().and( @@ -92,28 +93,28 @@ public List getActiveAttributesByLocationAndAttributeTypeUuid return criteriaContext.getEntityManager().createQuery(criteriaContext.finalizeQuery()).getResultList(); } - private void handleName(OpenmrsFhirCriteriaContext criteriaContext, StringAndListParam namePattern) { + private void handleName(OpenmrsFhirCriteriaContext criteriaContext, StringAndListParam namePattern) { handleAndListParam(criteriaContext.getCriteriaBuilder(), namePattern, (name) -> propertyLike(criteriaContext, criteriaContext.getRoot(), "name", name)) .ifPresent(criteriaContext::addPredicate); criteriaContext.finalizeQuery(); } - private void handleCity(OpenmrsFhirCriteriaContext criteriaContext, StringAndListParam cityPattern) { + private void handleCity(OpenmrsFhirCriteriaContext criteriaContext, StringAndListParam cityPattern) { handleAndListParam(criteriaContext.getCriteriaBuilder(), cityPattern, (city) -> propertyLike(criteriaContext, criteriaContext.getRoot(), "cityVillage", city)) .ifPresent(criteriaContext::addPredicate); criteriaContext.finalizeQuery(); } - private void handleCountry(OpenmrsFhirCriteriaContext criteriaContext, StringAndListParam countryPattern) { + private void handleCountry(OpenmrsFhirCriteriaContext criteriaContext, StringAndListParam countryPattern) { handleAndListParam(criteriaContext.getCriteriaBuilder(), countryPattern, (country) -> propertyLike(criteriaContext, criteriaContext.getRoot(), "country", country)) .ifPresent(criteriaContext::addPredicate); criteriaContext.finalizeQuery(); } - private void handlePostalCode(OpenmrsFhirCriteriaContext criteriaContext, + private void handlePostalCode(OpenmrsFhirCriteriaContext criteriaContext, StringAndListParam postalCodePattern) { handleAndListParam(criteriaContext.getCriteriaBuilder(), postalCodePattern, (postalCode) -> propertyLike(criteriaContext, criteriaContext.getRoot(), "postalCode", postalCode)) @@ -121,14 +122,14 @@ private void handlePostalCode(OpenmrsFhirCriteriaContext criteriaConte criteriaContext.finalizeQuery(); } - private void handleState(OpenmrsFhirCriteriaContext criteriaContext, StringAndListParam statePattern) { + private void handleState(OpenmrsFhirCriteriaContext criteriaContext, StringAndListParam statePattern) { handleAndListParam(criteriaContext.getCriteriaBuilder(), statePattern, (state) -> propertyLike(criteriaContext, criteriaContext.getRoot(), "stateProvince", state)) .ifPresent(criteriaContext::addPredicate); criteriaContext.finalizeQuery(); } - private void handleTag(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam tags) { + private void handleTag(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam tags) { if (tags != null) { criteriaContext.addJoin("tags", "t"); handleAndListParam(criteriaContext.getCriteriaBuilder(), tags, @@ -139,7 +140,7 @@ private void handleTag(OpenmrsFhirCriteriaContext criteriaContext, Tok } } - private void handleParentLocation(OpenmrsFhirCriteriaContext criteriaContext, ReferenceAndListParam parent) { + private void handleParentLocation(OpenmrsFhirCriteriaContext criteriaContext, ReferenceAndListParam parent) { handleLocationReference(criteriaContext, "loc", parent).ifPresent(loc -> { criteriaContext.addJoin("parentLocation", "loc"); criteriaContext.addPredicate(loc); @@ -148,7 +149,7 @@ private void handleParentLocation(OpenmrsFhirCriteriaContext criteriaC } @Override - protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, @NonNull String param) { + protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, @NonNull String param) { switch (param) { case org.hl7.fhir.r4.model.Location.SP_NAME: return "name"; @@ -181,12 +182,4 @@ public LocationAttributeType getLocationAttributeTypeByUuid(String uuid) { return locationService.getLocationAttributeTypeByUuid(uuid); } - protected OpenmrsFhirCriteriaContext openmrsFhirCriteriaContext() { - EntityManager em = sessionFactory.getCurrentSession(); - CriteriaBuilder cb = em.getCriteriaBuilder(); - CriteriaQuery cq = cb.createQuery(LocationAttribute.class); - Root root = cq.from(LocationAttribute.class); - - return new OpenmrsFhirCriteriaContext<>(em, cb, cq, root); - } } diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirMedicationDaoImpl.java b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirMedicationDaoImpl.java index 62062377f..4561e2f61 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirMedicationDaoImpl.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirMedicationDaoImpl.java @@ -29,7 +29,7 @@ public class FhirMedicationDaoImpl extends BaseFhirDao implements FhirMedicationDao { @Override - protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { + protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { theParams.getParameters().forEach(entry -> { switch (entry.getKey()) { case FhirConstants.CODED_SEARCH_HANDLER: @@ -53,7 +53,7 @@ protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContex } // TODO: look into DetachedCriteria and how to translate it to jpa criteria api - private void handleIngredientCode(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam ingredientCode) { + private void handleIngredientCode(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam ingredientCode) { if (ingredientCode != null) { criteriaContext.getRoot().join("ingredients").alias("i"); DetachedCriteria detachedCriteria = DetachedCriteria.forClass(Concept.class, "ic"); @@ -65,7 +65,7 @@ private void handleIngredientCode(OpenmrsFhirCriteriaContext criteriaConte } } - private void handleMedicationCode(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam code) { + private void handleMedicationCode(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam code) { if (code != null) { criteriaContext.getRoot().join("concept").alias("cc"); handleCodeableConcept(criteriaContext, code, "cc", "ccm", "ccrt").ifPresent(criteriaContext::addPredicate); @@ -73,7 +73,7 @@ private void handleMedicationCode(OpenmrsFhirCriteriaContext criteriaConte } } - private void handleMedicationDosageForm(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam dosageForm) { + private void handleMedicationDosageForm(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam dosageForm) { if (dosageForm != null) { criteriaContext.getRoot().join("dosageForm").alias("dc"); handleCodeableConcept(criteriaContext, dosageForm, "dc", "dcm", "dcrt").ifPresent(criteriaContext::addPredicate); diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirMedicationRequestDaoImpl.java b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirMedicationRequestDaoImpl.java index 78c2dcf0a..8fd935df0 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirMedicationRequestDaoImpl.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirMedicationRequestDaoImpl.java @@ -57,7 +57,7 @@ public List get(@Nonnull Collection uuids) { } @Override - protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { + protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { theParams.getParameters().forEach(entry -> { switch (entry.getKey()) { case FhirConstants.FULFILLER_STATUS_SEARCH_HANDLER: @@ -105,7 +105,7 @@ protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaC excludeDiscontinueOrders(criteriaContext); } - private Optional handleStatus(OpenmrsFhirCriteriaContext criteriaContext, + private Optional handleStatus(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam tokenAndListParam) { return handleAndListParam(criteriaContext.getCriteriaBuilder(), tokenAndListParam, token -> { if (token.getValue() != null) { @@ -124,7 +124,7 @@ private Optional handleStatus(OpenmrsFhirCriteriaContext crite }); } - private Optional handleFulfillerStatus(OpenmrsFhirCriteriaContext criteriaContext, + private Optional handleFulfillerStatus(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam tokenAndListParam) { return handleAndListParam(criteriaContext.getCriteriaBuilder(), tokenAndListParam, token -> { if (token.getValue() != null) { @@ -135,12 +135,12 @@ private Optional handleFulfillerStatus(OpenmrsFhirCriteriaContext }); } - protected Predicate generateFulfillerStatusRestriction(OpenmrsFhirCriteriaContext criteriaContext, + protected Predicate generateFulfillerStatusRestriction(OpenmrsFhirCriteriaContext criteriaContext, Order.FulfillerStatus fulfillerStatus) { return generateFulfillerStatusRestriction(criteriaContext, "", fulfillerStatus); } - protected Predicate generateFulfillerStatusRestriction(OpenmrsFhirCriteriaContext criteriaContext, String path, + protected Predicate generateFulfillerStatusRestriction(OpenmrsFhirCriteriaContext criteriaContext, String path, Order.FulfillerStatus fulfillerStatus) { if (StringUtils.isNotBlank(path)) { path = path + "."; @@ -150,7 +150,7 @@ protected Predicate generateFulfillerStatusRestriction(OpenmrsFhirCriteriaCo fulfillerStatus); } - private void handleCodedConcept(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam code) { + private void handleCodedConcept(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam code) { if (code != null) { if (!criteriaContext.getJoin("c").isPresent()) { criteriaContext.addJoin("concept", "c"); @@ -161,7 +161,7 @@ private void handleCodedConcept(OpenmrsFhirCriteriaContext criteriaCo } } - private void excludeDiscontinueOrders(OpenmrsFhirCriteriaContext criteriaContext) { + private void excludeDiscontinueOrders(OpenmrsFhirCriteriaContext criteriaContext) { // exclude "discontinue" orders, see: https://issues.openmrs.org/browse/FM2-532 criteriaContext.getCriteriaBuilder().and(criteriaContext.getCriteriaBuilder() .notEqual(criteriaContext.getRoot().get("action"), Order.Action.DISCONTINUE)); diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirObservationDaoImpl.java b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirObservationDaoImpl.java index d73925f4a..99de0e869 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirObservationDaoImpl.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirObservationDaoImpl.java @@ -217,7 +217,7 @@ protected void setupSearchParams(OpenmrsFhirCriteriaContext criteria }); } - private void handleHasMemberReference(OpenmrsFhirCriteriaContext criteriaContext, + private void handleHasMemberReference(OpenmrsFhirCriteriaContext criteriaContext, ReferenceAndListParam hasMemberReference) { Join groupMembersJoin = criteriaContext.addJoin("groupMembers", "groupMembersJoin"); if (hasMemberReference != null) { @@ -246,7 +246,7 @@ private void handleHasMemberReference(OpenmrsFhirCriteriaContext criteriaCo } } - private Optional handleValueStringParam(OpenmrsFhirCriteriaContext criteriaContext, + private Optional handleValueStringParam(OpenmrsFhirCriteriaContext criteriaContext, @Nonnull String propertyName, StringAndListParam valueStringParam) { //TODO: needs further investigation Join propertyNameJoin = criteriaContext.addJoin(propertyName, propertyName); @@ -254,7 +254,7 @@ private Optional handleValueStringParam(OpenmrsFhirCriteriaContex v -> propertyLike(criteriaContext, propertyNameJoin, propertyName, v.getValue())); } - private void handleCodedConcept(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam code) { + private void handleCodedConcept(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam code) { if (code != null) { criteriaContext.addJoin("concept", "c"); @@ -263,7 +263,7 @@ private void handleCodedConcept(OpenmrsFhirCriteriaContext criteriaContext, } } - private void handleConceptClass(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam category) { + private void handleConceptClass(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam category) { if (category == null) { Join conceptJoin = criteriaContext.addJoin("concept", "c"); Join conceptClassJoin = criteriaContext.addJoin(conceptJoin, "conceptClass", "cc"); @@ -271,7 +271,7 @@ private void handleConceptClass(OpenmrsFhirCriteriaContext criteriaContext, if (param.getValue() == null) { return Optional.empty(); } - OpenmrsFhirCriteriaContext context = createCriteriaContext(String.class); + OpenmrsFhirCriteriaContext context = createCriteriaContext(String.class); context.getCriteriaQuery().subquery(String.class).select(conceptClassJoin.get("uuid")) .where(context.getCriteriaBuilder().equal(context.getRoot().get("category"), param.getValue())); @@ -283,7 +283,7 @@ private void handleConceptClass(OpenmrsFhirCriteriaContext criteriaContext, } } - private void handleValueCodedConcept(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam valueConcept) { + private void handleValueCodedConcept(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam valueConcept) { if (valueConcept != null) { if (!criteriaContext.getJoin("vc").isPresent()) { criteriaContext.addJoin("valueCoded", "vc"); @@ -295,7 +295,7 @@ private void handleValueCodedConcept(OpenmrsFhirCriteriaContext criteriaCon } @Override - protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, @NonNull String paramName) { + protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, @NonNull String paramName) { if (Observation.SP_DATE.equals(paramName)) { return "obsDatetime"; } diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirPatientDaoImpl.java b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirPatientDaoImpl.java index 989ee150a..d8034dd18 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirPatientDaoImpl.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirPatientDaoImpl.java @@ -98,7 +98,7 @@ public PatientIdentifierType getPatientIdentifierTypeByNameOrUuid(String name, S } @Override - protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { + protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { theParams.getParameters().forEach(entry -> { switch (entry.getKey()) { case FhirConstants.QUERY_SEARCH_HANDLER: @@ -140,7 +140,7 @@ protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaCon }); } - private void handlePatientQuery(OpenmrsFhirCriteriaContext criteriaContext, @Nonnull StringAndListParam query) { + private void handlePatientQuery(OpenmrsFhirCriteriaContext criteriaContext, @Nonnull StringAndListParam query) { if (query == null) { return; } @@ -173,7 +173,7 @@ private void handlePatientQuery(OpenmrsFhirCriteriaContext criteriaCont criteriaContext.finalizeQuery(); } - protected void handleIdentifier(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam identifier) { + protected void handleIdentifier(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam identifier) { if (identifier == null) { return; } @@ -198,7 +198,7 @@ protected void handleIdentifier(OpenmrsFhirCriteriaContext criteriaCont } @Override - protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, @NonNull String param) { + protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, @NonNull String param) { if (SP_DEATH_DATE.equalsIgnoreCase(param)) { return "deathDate"; } diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirPatientIdentifierSystemDaoImpl.java b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirPatientIdentifierSystemDaoImpl.java index a0146377c..a126ba8a0 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirPatientIdentifierSystemDaoImpl.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirPatientIdentifierSystemDaoImpl.java @@ -77,7 +77,7 @@ public PatientIdentifierType getPatientIdentifierTypeByUrl(String url) { @Override public Optional getFhirPatientIdentifierSystem( @Nonnull PatientIdentifierType patientIdentifierType) { - OpenmrsFhirCriteriaContext criteriaContext = openmrsFhirCriteriaContext(); + OpenmrsFhirCriteriaContext criteriaContext = openmrsFhirCriteriaContext(); criteriaContext.getCriteriaQuery().where(criteriaContext.getCriteriaBuilder() .equal(criteriaContext.getRoot().get("patientIdentifierType"), patientIdentifierType)); @@ -92,7 +92,7 @@ public FhirPatientIdentifierSystem saveFhirPatientIdentifierSystem( return fhirPatientIdentifierSystem; } - private OpenmrsFhirCriteriaContext openmrsFhirCriteriaContext() { + private OpenmrsFhirCriteriaContext openmrsFhirCriteriaContext() { EntityManager em = sessionFactory.getCurrentSession(); CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery cq = cb.createQuery(FhirPatientIdentifierSystem.class); diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirPersonDaoImpl.java b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirPersonDaoImpl.java index cf627f5fd..da60e45ae 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirPersonDaoImpl.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirPersonDaoImpl.java @@ -45,7 +45,7 @@ public List getActiveAttributesByPersonAndAttributeTypeUuid(@No } @Override - protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { + protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { theParams.getParameters().forEach(entry -> { switch (entry.getKey()) { case FhirConstants.NAME_SEARCH_HANDLER: @@ -74,7 +74,7 @@ protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaCont } @Override - protected Optional handleLastUpdated(OpenmrsFhirCriteriaContext criteriaContext, + protected Optional handleLastUpdated(OpenmrsFhirCriteriaContext criteriaContext, DateRangeParam param) { return Optional.of(criteriaContext.getCriteriaBuilder().or(toCriteriaArray( handleDateRange(criteriaContext, "personDateChanged", param), @@ -86,7 +86,7 @@ protected Optional handleLastUpdated(OpenmrsFhirCriteriaContext criteriaContext) { + protected void handleVoidable(OpenmrsFhirCriteriaContext criteriaContext) { criteriaContext.addPredicate( criteriaContext.getCriteriaBuilder().equal(criteriaContext.getRoot().get("personVoided"), false)); } diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirPractitionerDaoImpl.java b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirPractitionerDaoImpl.java index ba464063f..615d5db11 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirPractitionerDaoImpl.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirPractitionerDaoImpl.java @@ -36,7 +36,7 @@ public boolean hasDistinctResults() { } @Override - protected void handleIdentifier(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam identifier) { + protected void handleIdentifier(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam identifier) { handleAndListParam(criteriaContext.getCriteriaBuilder(), identifier, param -> Optional.of( criteriaContext.getCriteriaBuilder().equal(criteriaContext.getRoot().get("identifier"), param.getValue()))) @@ -47,7 +47,7 @@ protected void handleIdentifier(OpenmrsFhirCriteriaContext criteriaCon @Override public List getActiveAttributesByPractitionerAndAttributeTypeUuid(@Nonnull Provider provider, @Nonnull String providerAttributeTypeUuid) { - OpenmrsFhirCriteriaContext criteriaContext = openmrsFhirCriteriaContext(); + OpenmrsFhirCriteriaContext criteriaContext = openmrsFhirCriteriaContext(); criteriaContext.getCriteriaQuery().select(criteriaContext.getRoot()); criteriaContext.addPredicate(criteriaContext.getCriteriaBuilder().and( @@ -60,7 +60,7 @@ public List getActiveAttributesByPractitionerAndAttributeType return criteriaContext.getEntityManager().createQuery(criteriaContext.finalizeQuery()).getResultList(); } - protected OpenmrsFhirCriteriaContext openmrsFhirCriteriaContext() { + protected OpenmrsFhirCriteriaContext openmrsFhirCriteriaContext() { EntityManager em = sessionFactory.getCurrentSession(); CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery cq = cb.createQuery(ProviderAttribute.class); diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirRelatedPersonDaoImpl.java b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirRelatedPersonDaoImpl.java index e95777153..fe858b303 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirRelatedPersonDaoImpl.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirRelatedPersonDaoImpl.java @@ -46,7 +46,7 @@ public class FhirRelatedPersonDaoImpl extends BaseFhirDao implements FhirRelatedPersonDao { @Override - protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, + protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { From personJoin = criteriaContext.addJoin("personA", "m"); theParams.getParameters().forEach(entry -> { @@ -78,7 +78,7 @@ protected void setupSearchParams(OpenmrsFhirCriteriaContext criter } @Override - protected Collection paramToProps(OpenmrsFhirCriteriaContext criteriaContext, + protected Collection paramToProps(OpenmrsFhirCriteriaContext criteriaContext, @Nonnull SortState sortState) { String param = sortState.getParameter(); @@ -167,7 +167,7 @@ protected Collection paramToProps(OpenmrsFhirCriteriaContext crite } @Override - protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, @Nonnull String param) { + protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, @Nonnull String param) { switch (param) { case SP_BIRTHDATE: return "m.birthdate"; @@ -184,7 +184,7 @@ protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, } } - private void handleAddresses(OpenmrsFhirCriteriaContext criteriaContext, + private void handleAddresses(OpenmrsFhirCriteriaContext criteriaContext, Map.Entry>> entry) { StringAndListParam city = null; StringAndListParam country = null; diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirServiceRequestDaoImpl.java b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirServiceRequestDaoImpl.java index b208699ac..9b15c140a 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirServiceRequestDaoImpl.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirServiceRequestDaoImpl.java @@ -35,7 +35,7 @@ public boolean hasDistinctResults() { } @Override - protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { + protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { theParams.getParameters().forEach(entry -> { switch (entry.getKey()) { case FhirConstants.ENCOUNTER_REFERENCE_SEARCH_HANDLER: @@ -68,7 +68,7 @@ protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaC }); } - private void handleCodedConcept(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam code) { + private void handleCodedConcept(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam code) { if (code != null) { if (!criteriaContext.getJoin("c").isPresent()) { criteriaContext.addJoin("concept", "c"); @@ -79,7 +79,7 @@ private void handleCodedConcept(OpenmrsFhirCriteriaContext criteriaCo } } - private Optional handleDateRange(OpenmrsFhirCriteriaContext criteriaContext, + private Optional handleDateRange(OpenmrsFhirCriteriaContext criteriaContext, DateRangeParam dateRangeParam) { if (dateRangeParam == null) { return Optional.empty(); diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirTaskDaoImpl.java b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirTaskDaoImpl.java index 6bf33e48a..e969e8c3e 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirTaskDaoImpl.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirTaskDaoImpl.java @@ -36,7 +36,7 @@ public class FhirTaskDaoImpl extends BaseFhirDao implements FhirTaskDao { @Override - protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { + protected void setupSearchParams(OpenmrsFhirCriteriaContext criteriaContext, SearchParameterMap theParams) { theParams.getParameters().forEach(entry -> { switch (entry.getKey()) { case FhirConstants.BASED_ON_REFERENCE_SEARCH_HANDLER: @@ -77,7 +77,7 @@ private Boolean validReferenceParam(ReferenceParam ref) { } private Optional handleStatus(TokenAndListParam tokenAndListParam) { - OpenmrsFhirCriteriaContext criteriaContext = createCriteriaContext(FhirTask.class); + OpenmrsFhirCriteriaContext criteriaContext = createCriteriaContext(FhirTask.class); return handleAndListParam(criteriaContext.getCriteriaBuilder(), tokenAndListParam, token -> { if (token.getValue() != null) { @@ -94,7 +94,7 @@ private Optional handleStatus(TokenAndListParam tokenAndListParam) { }); } - private void handleReference(OpenmrsFhirCriteriaContext criteriaContext, ReferenceAndListParam reference, + private void handleReference(OpenmrsFhirCriteriaContext criteriaContext, ReferenceAndListParam reference, String property, String alias) { handleAndListParam(criteriaContext.getCriteriaBuilder(), reference, param -> { if (validReferenceParam(param)) { diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirUserDaoImpl.java b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirUserDaoImpl.java index d1fa75afb..3d75b0466 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirUserDaoImpl.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirUserDaoImpl.java @@ -24,7 +24,7 @@ public class FhirUserDaoImpl extends BasePractitionerDao implements FhirUs @Override public User getUserByUserName(String username) { - OpenmrsFhirCriteriaContext criteriaContext = createCriteriaContext(User.class); + OpenmrsFhirCriteriaContext criteriaContext = createCriteriaContext(User.class); criteriaContext.getCriteriaQuery().select(criteriaContext.getRoot()) .where(criteriaContext.getCriteriaBuilder().equal(criteriaContext.getRoot().get("username"), username)); @@ -33,7 +33,7 @@ public User getUserByUserName(String username) { } @Override - protected void handleIdentifier(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam identifier) { + protected void handleIdentifier(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam identifier) { handleAndListParam(criteriaContext.getCriteriaBuilder(), identifier, param -> Optional.of( criteriaContext.getCriteriaBuilder().equal(criteriaContext.getRoot().get("username"), param.getValue()))) diff --git a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirVisitDaoImpl.java b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirVisitDaoImpl.java index 56faf3ef6..298197f09 100644 --- a/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirVisitDaoImpl.java +++ b/api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/FhirVisitDaoImpl.java @@ -32,13 +32,13 @@ public class FhirVisitDaoImpl extends BaseEncounterDao implements FhirVisitDao { @Override - protected void handleDate(OpenmrsFhirCriteriaContext criteriaContext, DateRangeParam dateRangeParam) { + protected void handleDate(OpenmrsFhirCriteriaContext criteriaContext, DateRangeParam dateRangeParam) { handleDateRange(criteriaContext, "startDatetime", dateRangeParam); criteriaContext.finalizeQuery(); } @Override - protected void handleEncounterType(OpenmrsFhirCriteriaContext criteriaContext, + protected void handleEncounterType(OpenmrsFhirCriteriaContext criteriaContext, TokenAndListParam tokenAndListParam) { Join visitTypeJoin = criteriaContext.addJoin("visitType", "vt"); handleAndListParam(criteriaContext.getCriteriaBuilder(), tokenAndListParam, @@ -51,7 +51,7 @@ protected void handleEncounterType(OpenmrsFhirCriteriaContext criteriaCon } @Override - protected void handleParticipant(OpenmrsFhirCriteriaContext criteriaContext, + protected void handleParticipant(OpenmrsFhirCriteriaContext criteriaContext, ReferenceAndListParam referenceAndListParam) { Join encounterJoin = criteriaContext.getRoot().join("encounters", JoinType.INNER); encounterJoin.join("encounterProviders", JoinType.INNER); @@ -59,7 +59,7 @@ protected void handleParticipant(OpenmrsFhirCriteriaContext criteriaConte } @Override - protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, @NonNull String param) { + protected String paramToProp(OpenmrsFhirCriteriaContext criteriaContext, @NonNull String param) { switch (param) { case SP_DATE: return "startDatetime";