Package com.ibm.fhir.persistence.util
Class AbstractQueryBuilder<T1>
- java.lang.Object
-
- com.ibm.fhir.persistence.util.AbstractQueryBuilder<T1>
-
- All Implemented Interfaces:
QueryBuilder<T1>
- Direct Known Subclasses:
JDBCQueryBuilder
public abstract class AbstractQueryBuilder<T1> extends Object implements QueryBuilder<T1>
This class defines a reusable method structure and common functionality for a FHIR persistence query builder.
-
-
Constructor Summary
Constructors Constructor Description AbstractQueryBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract T1
buildLocationQuerySegment(String parmName, List<Bounding> boundingAreas, String paramTableAlias)
Builds a query segment for the passed parameter name using the geospatial data contained with the passed BoundingBoxprotected T1
buildQueryParm(Class<?> resourceType, QueryParameter queryParm)
Builds a query segment for the passed query parameter.static String
extractReferenceFromUrl(String parmValue)
Examines the passed ParamaterValue, and checks to see if the value is a URL.static boolean
isAbsoluteURL(String s)
protected abstract T1
processChainedReferenceParm(QueryParameter queryParm)
Contains special logic for handling chained reference search parameters.protected abstract T1
processCompositeParm(Class<?> resourceType, QueryParameter queryParm)
Creates a query segment for a Composite type parameter.protected abstract T1
processDateParm(Class<?> resourceType, QueryParameter queryParm)
Creates a query segment for a Date type parameter.protected abstract T1
processInclusionCriteria(QueryParameter queryParm)
Contains special logic for handling Compartment based searches.protected T1
processLocationPosition(List<QueryParameter> queryParameters, String paramTableAlias)
This method executes special logic for a Token type query that maps to a LocationPosition data type.protected abstract T1
processNumberParm(Class<?> resourceType, QueryParameter queryParm)
Creates a query segment for a Number type parameter.protected abstract T1
processQuantityParm(Class<?> resourceType, QueryParameter queryParm)
Creates a query segment for a Quantity type parameter.protected abstract T1
processReferenceParm(Class<?> resourceType, QueryParameter queryParm)
Creates a query segment for a Reference type parameter.protected abstract T1
processStringParm(QueryParameter queryParm)
Creates a query segment for a String type parameter.protected abstract T1
processTokenParm(QueryParameter queryParm)
Creates a query segment for a Token type parameter.protected abstract T1
processUriParm(QueryParameter queryParm)
Creates a query segment for a URI type parameter.-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.ibm.fhir.persistence.util.QueryBuilder
buildQuery
-
-
-
-
Method Detail
-
extractReferenceFromUrl
public static String extractReferenceFromUrl(String parmValue)
Examines the passed ParamaterValue, and checks to see if the value is a URL. If it is, the {ResourceType/id} part of the URL path is extracted and returned. For example: If the input value is http://localhost:8080/fhir/Patient/123, then Patient/123 is returned.- Parameters:
parmValue
- A valid String parameter value that may or may not contain a URL.- Returns:
- String - The last 2 segments of the URL path is returned if the passed parmValue is a URL; otherwise, null is returned.
-
isAbsoluteURL
public static boolean isAbsoluteURL(String s)
-
buildQueryParm
protected T1 buildQueryParm(Class<?> resourceType, QueryParameter queryParm) throws Exception
Builds a query segment for the passed query parameter.- Parameters:
resourceType
- - A valid FHIR Resource typequeryParm
- - A Parameter object describing the name, value and type of search parm.- Returns:
- T1 - An object representing the selector query segment for the passed search parm.
- Throws:
Exception
-
processStringParm
protected abstract T1 processStringParm(QueryParameter queryParm) throws FHIRPersistenceException
Creates a query segment for a String type parameter.- Parameters:
queryParm
- - The query parameter.- Returns:
- T1 - An object containing query segment.
- Throws:
FHIRPersistenceException
-
processReferenceParm
protected abstract T1 processReferenceParm(Class<?> resourceType, QueryParameter queryParm) throws Exception
Creates a query segment for a Reference type parameter.- Parameters:
queryParm
- - The query parameter.- Returns:
- T1 - An object containing query segment.
- Throws:
Exception
-
processChainedReferenceParm
protected abstract T1 processChainedReferenceParm(QueryParameter queryParm) throws Exception
Contains special logic for handling chained reference search parameters.- Parameters:
queryParm
- - The query parameter.- Returns:
- T1 - An object containing a query segment.
- Throws:
FHIRPersistenceException
Exception
-
processInclusionCriteria
protected abstract T1 processInclusionCriteria(QueryParameter queryParm) throws Exception
Contains special logic for handling Compartment based searches.- Parameters:
queryParm
- - The query parameter.- Returns:
- T1 - An object containing a query segment.
- Throws:
FHIRPersistenceException
Exception
-
processDateParm
protected abstract T1 processDateParm(Class<?> resourceType, QueryParameter queryParm) throws Exception
Creates a query segment for a Date type parameter.- Parameters:
queryParm
- - The query parameter.- Returns:
- T1 - An object containing query segment.
- Throws:
Exception
-
processTokenParm
protected abstract T1 processTokenParm(QueryParameter queryParm) throws FHIRPersistenceException
Creates a query segment for a Token type parameter.- Parameters:
queryParm
- - The query parameter.- Returns:
- T1 - An object containing query segment.
- Throws:
FHIRPersistenceException
-
processNumberParm
protected abstract T1 processNumberParm(Class<?> resourceType, QueryParameter queryParm) throws FHIRPersistenceException
Creates a query segment for a Number type parameter.- Parameters:
queryParm
- - The query parameter.- Returns:
- T1 - An object containing query segment.
- Throws:
FHIRPersistenceException
-
processQuantityParm
protected abstract T1 processQuantityParm(Class<?> resourceType, QueryParameter queryParm) throws Exception
Creates a query segment for a Quantity type parameter.- Parameters:
queryParm
- - The query parameter.- Returns:
- T1 - An object containing query segment.
- Throws:
Exception
-
processUriParm
protected abstract T1 processUriParm(QueryParameter queryParm) throws FHIRPersistenceException
Creates a query segment for a URI type parameter.- Parameters:
queryParm
- - The query parameter.- Returns:
- T1 - An object containing query segment.
- Throws:
FHIRPersistenceException
-
processCompositeParm
protected abstract T1 processCompositeParm(Class<?> resourceType, QueryParameter queryParm) throws FHIRPersistenceException
Creates a query segment for a Composite type parameter.- Parameters:
queryParm
- - The query parameter- Returns:
- T1 - An object containing query segment
- Throws:
FHIRPersistenceException
-
processLocationPosition
protected T1 processLocationPosition(List<QueryParameter> queryParameters, String paramTableAlias) throws FHIRPersistenceException
This method executes special logic for a Token type query that maps to a LocationPosition data type.- Parameters:
queryParameters
- The entire collection of query input parameters- Returns:
- T1 - A query segment related to a LocationPosition
- Throws:
FHIRPersistenceException
-
buildLocationQuerySegment
protected abstract T1 buildLocationQuerySegment(String parmName, List<Bounding> boundingAreas, String paramTableAlias) throws FHIRPersistenceException
Builds a query segment for the passed parameter name using the geospatial data contained with the passed BoundingBox- Parameters:
parmName
- - The name of the search parameterboundingAreas
- - Container for the geospatial data needed to construct the query segment.paramTableAlias
- the alias name of the parameter table- Returns:
- T1 - The query segment necessary for searching locations that are inside the bounding box.
- Throws:
FHIRPersistenceException
-
-