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