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