-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
151 additions
and
40 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
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
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
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
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
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
28 changes: 28 additions & 0 deletions
28
engine/src/main/java/com/google/android/fhir/search/filter/IdTokenFilterCriterion.kt
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,28 @@ | ||
package com.google.android.fhir.search.filter | ||
|
||
import ca.uhn.fhir.rest.gclient.TokenClientParam | ||
import com.google.android.fhir.search.ConditionParam | ||
import com.google.android.fhir.search.Operation | ||
import com.google.android.fhir.search.SearchQuery | ||
import org.hl7.fhir.instance.model.api.IAnyResource | ||
import org.hl7.fhir.r4.model.ResourceType | ||
|
||
data class IdTokenFilterCriterion(private val tokenParamFilterCriterion: TokenParamFilterCriterion): FilterCriterion { | ||
override fun getConditionalParams(): List<ConditionParam<String>> { | ||
return tokenParamFilterCriterion.value!!.tokenFilters.map { | ||
ConditionParam("?", it.code) | ||
} | ||
} | ||
} | ||
|
||
internal data class IdTokenParamFilterCriteria( | ||
override val filters: List<IdTokenFilterCriterion>, | ||
) : FilterCriteria(filters, Operation.OR, IAnyResource.RES_ID, ""){ | ||
override fun query(type: ResourceType): SearchQuery { | ||
val conditionParams = filters.flatMap { it.getConditionalParams() } | ||
return SearchQuery( | ||
""" | ||
${ if (conditionParams.isNotEmpty()) "VALUES ${conditionParams.joinToString { "(${it.condition})" } } " else ""} | ||
""", conditionParams.flatMap { it.params }) | ||
} | ||
} |
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