View Javadoc
1   package ca.uhn.fhir.rest.gclient;
2   
3   import java.util.Collection;
4   
5   /*
6    * #%L
7    * HAPI FHIR - Core Library
8    * %%
9    * Copyright (C) 2014 - 2018 University Health Network
10   * %%
11   * Licensed under the Apache License, Version 2.0 (the "License");
12   * you may not use this file except in compliance with the License.
13   * You may obtain a copy of the License at
14   * 
15   *      http://www.apache.org/licenses/LICENSE-2.0
16   * 
17   * Unless required by applicable law or agreed to in writing, software
18   * distributed under the License is distributed on an "AS IS" BASIS,
19   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20   * See the License for the specific language governing permissions and
21   * limitations under the License.
22   * #L%
23   */
24  
25  import org.hl7.fhir.instance.model.api.IBaseBundle;
26  
27  import ca.uhn.fhir.model.api.Include;
28  import ca.uhn.fhir.rest.api.SearchStyleEnum;
29  import ca.uhn.fhir.rest.param.DateRangeParam;
30  
31  public interface IQuery<Y> extends IBaseQuery<IQuery<Y>>, IClientExecutable<IQuery<Y>, Y> {
32  
33  	/**
34  	 * Add an "_include" specification or an "_include:recurse" specification. If you are using
35  	 * a constant from one of the built-in structures you can select whether you want recursive
36  	 * behaviour by using the following syntax:
37  	 * <ul>
38  	 * <li><b>Recurse:</b> <code>.include(Patient.INCLUDE_ORGANIZATION.asRecursive())</code>
39  	 * <li><b>No Recurse:</b> <code>.include(Patient.INCLUDE_ORGANIZATION.asNonRecursive())</code>
40  	 * </ul>
41  	 */
42  	IQuery<Y> include(Include theInclude);
43  
44  	ISort<Y> sort();
45  
46  	/**
47  	 * Specifies the <code>_count</code> parameter, which indicates to the server how many resources should be returned
48  	 * on a single page.
49  	 * 
50  	 * @deprecated This parameter is badly named, since FHIR calls this parameter "_count" and not "_limit". Use {@link #count(int)} instead (it also sets the _count parameter)
51  	 */
52  	@Deprecated
53  	IQuery<Y> limitTo(int theLimitTo);
54  
55  	/**
56  	 * Specifies the <code>_count</code> parameter, which indicates to the server how many resources should be returned
57  	 * on a single page.
58  	 * 
59  	 * @since 1.4
60  	 */
61  	IQuery<Y> count(int theCount);
62  
63  	/**
64  	 * Match only resources where the resource has the given tag. This parameter corresponds to
65  	 * the <code>_tag</code> URL parameter.
66  	 * @param theSystem The tag code system, or <code>null</code> to match any code system (this may not be supported on all servers)
67  	 * @param theCode The tag code. Must not be <code>null</code> or empty.
68  	 */
69  	IQuery<Y> withTag(String theSystem, String theCode);
70  
71  	/**
72  	 * Match only resources where the resource has the given security tag. This parameter corresponds to
73  	 * the <code>_security</code> URL parameter.
74  	 * @param theSystem The tag code system, or <code>null</code> to match any code system (this may not be supported on all servers)
75  	 * @param theCode The tag code. Must not be <code>null</code> or empty.
76  	 */
77  	IQuery<Y> withSecurity(String theSystem, String theCode);
78  
79  	/**
80  	 * Match only resources where the resource has the given profile declaration. This parameter corresponds to
81  	 * the <code>_profile</code> URL parameter.
82  	 * @param theProfileUri The URI of a given profile to search for resources which match  
83  	 */
84  	IQuery<Y> withProfile(String theProfileUri);
85  
86  	/**
87  	 * Matches any of the profiles given as argument. This would result in an OR search for resources matching one or more profiles.
88  	 * To do an AND search, make multiple calls to {@link #withProfile(String)}.
89  	 * @param theProfileUris The URIs of a given profile to search for resources which match.
90  	 */
91  	IQuery<Y> withAnyProfile(Collection<String> theProfileUris);
92  	
93  	/**
94  	 * Forces the query to perform the search using the given method (allowable methods are described in the 
95  	 * <a href="http://www.hl7.org/fhir/search.html">FHIR Search Specification</a>)
96  	 * <p>
97  	 * This can be used to force the use of an HTTP POST instead of an HTTP GET
98  	 * </p>
99  	 * 
100 	 * @see SearchStyleEnum
101 	 * @since 0.6
102 	 */
103 	IQuery<Y> usingStyle(SearchStyleEnum theStyle);
104 
105 	IQuery<Y> withIdAndCompartment(String theResourceId, String theCompartmentName);
106 
107 	/**
108 	 * Add a "_revinclude" specification
109 	 * 
110 	 * @since HAPI FHIR 1.0 - Note that option was added to FHIR itself in DSTU2
111 	 */
112 	IQuery<Y> revInclude(Include theIncludeTarget);
113 
114 	/**
115 	 * Add a "_lastUpdated" specification
116 	 * 
117 	 * @since HAPI FHIR 1.1 - Note that option was added to FHIR itself in DSTU2
118 	 */
119 	IQuery<Y> lastUpdated(DateRangeParam theLastUpdated);
120 
121 	/**
122 	 * Request that the client return the specified bundle type, e.g. <code>org.hl7.fhir.instance.model.Bundle.class</code>
123 	 * or <code>ca.uhn.fhir.model.dstu2.resource.Bundle.class</code>
124 	 */
125 	<B extends IBaseBundle> IQuery<B> returnBundle(Class<B> theClass);
126 
127 	/**
128 	 * {@inheritDoc}
129 	 */
130 	// This is here as an overridden method to allow mocking clients with Mockito to work
131 	@Override
132 	IQuery<Y> where(ICriterion<?> theCriterion);
133 
134 	/**
135 	 * {@inheritDoc}
136 	 */
137 	// This is here as an overridden method to allow mocking clients with Mockito to work
138 	@Override
139 	IQuery<Y> and(ICriterion<?> theCriterion);
140 
141 //	Y execute();
142 
143 }