-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TODO Fix handleCodeableConcept
- Loading branch information
Showing
3 changed files
with
94 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
api/src/main/java/org/openmrs/module/fhir2/api/dao/impl/OpenmrsFhirCriteriaSubquery.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public License, | ||
* v. 2.0. If a copy of the MPL was not distributed with this file, You can | ||
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under | ||
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license. | ||
* | ||
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS | ||
* graphic logo is a trademark of OpenMRS Inc. | ||
*/ | ||
package org.openmrs.module.fhir2.api.dao.impl; | ||
|
||
import javax.persistence.criteria.CriteriaBuilder; | ||
import javax.persistence.criteria.Predicate; | ||
import javax.persistence.criteria.Root; | ||
import javax.persistence.criteria.Subquery; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import lombok.Getter; | ||
import lombok.NonNull; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@RequiredArgsConstructor | ||
public class OpenmrsFhirCriteriaSubquery<Q> { | ||
|
||
@Getter | ||
@NonNull | ||
private final CriteriaBuilder criteriaBuilder; | ||
|
||
@Getter | ||
@NonNull | ||
Subquery<Q> subquery; | ||
|
||
@Getter | ||
@NonNull | ||
Root<Q> root; | ||
|
||
private final List<Predicate> predicates = new ArrayList<>(); | ||
|
||
public OpenmrsFhirCriteriaSubquery<Q> addPredicate(Predicate predicate) { | ||
predicates.add(predicate); | ||
return this; | ||
} | ||
|
||
public Subquery<Q> finalizeQuery() { | ||
return subquery.where(predicates.toArray(new Predicate[0])); | ||
} | ||
} |