View Javadoc
1   
2   package ca.uhn.fhir.jpa.rp.dstu2;
3   
4   import java.util.*;
5   
6   import org.apache.commons.lang3.StringUtils;
7   
8   import ca.uhn.fhir.jpa.provider.*;
9   import ca.uhn.fhir.jpa.dao.SearchParameterMap;
10  import ca.uhn.fhir.model.api.Include;
11  import ca.uhn.fhir.model.api.annotation.*;
12  import ca.uhn.fhir.model.dstu2.composite.*;
13  import ca.uhn.fhir.model.dstu2.resource.*; //
14  import ca.uhn.fhir.rest.annotation.*;
15  import ca.uhn.fhir.rest.param.*;
16  import ca.uhn.fhir.rest.api.SortSpec;
17  
18  public class StructureDefinitionResourceProvider extends 
19  	JpaResourceProviderDstu2<StructureDefinition>
20  	{
21  
22  	@Override
23  	public Class<StructureDefinition> getResourceType() {
24  		return StructureDefinition.class;
25  	}
26  
27  	@Search(allowUnknownParams=true)
28  	public ca.uhn.fhir.rest.api.server.IBundleProvider search(
29  			javax.servlet.http.HttpServletRequest theServletRequest,
30  			javax.servlet.http.HttpServletResponse theServletResponse,
31  
32  			ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails,
33  			
34  			@Description(shortDefinition="Search the contents of the resource's data using a fulltext search")
35  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT)
36  			StringAndListParam theFtContent, 
37  
38  			@Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search")
39  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TEXT)
40  			StringAndListParam theFtText, 
41  
42  			@Description(shortDefinition="Search for resources which have the given tag")
43  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TAG)
44  			TokenAndListParam theSearchForTag, 
45  
46  			@Description(shortDefinition="Search for resources which have the given security labels")
47  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY)
48  			TokenAndListParam theSearchForSecurity, 
49    
50  			@Description(shortDefinition="Search for resources which have the given profile")
51  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE)
52  			UriAndListParam theSearchForProfile, 
53  
54  			@Description(shortDefinition="Return resources linked to by the given target")
55  			@OptionalParam(name="_has")
56  			HasAndListParam theHas, 
57  
58    
59  			@Description(shortDefinition="The ID of the resource")
60  			@OptionalParam(name="_id")
61  			StringAndListParam the_id, 
62    
63  			@Description(shortDefinition="The language of the resource")
64  			@OptionalParam(name="_language")
65  			StringAndListParam the_language, 
66    
67  			@Description(shortDefinition="")
68  			@OptionalParam(name="abstract")
69  			TokenAndListParam theAbstract, 
70    
71  			@Description(shortDefinition="")
72  			@OptionalParam(name="base")
73  			UriAndListParam theBase, 
74    
75  			@Description(shortDefinition="")
76  			@OptionalParam(name="base-path")
77  			TokenAndListParam theBase_path, 
78    
79  			@Description(shortDefinition="A code for the profile")
80  			@OptionalParam(name="code")
81  			TokenAndListParam theCode, 
82    
83  			@Description(shortDefinition="A use context assigned to the structure")
84  			@OptionalParam(name="context")
85  			TokenAndListParam theContext, 
86    
87  			@Description(shortDefinition="")
88  			@OptionalParam(name="context-type")
89  			TokenAndListParam theContext_type, 
90    
91  			@Description(shortDefinition="The profile publication date")
92  			@OptionalParam(name="date")
93  			DateRangeParam theDate, 
94    
95  			@Description(shortDefinition="Text search in the description of the profile")
96  			@OptionalParam(name="description")
97  			StringAndListParam theDescription, 
98    
99  			@Description(shortDefinition="")
100 			@OptionalParam(name="display")
101 			StringAndListParam theDisplay, 
102   
103 			@Description(shortDefinition="")
104 			@OptionalParam(name="experimental")
105 			TokenAndListParam theExperimental, 
106   
107 			@Description(shortDefinition="")
108 			@OptionalParam(name="ext-context")
109 			StringAndListParam theExt_context, 
110   
111 			@Description(shortDefinition="The identifier of the profile")
112 			@OptionalParam(name="identifier")
113 			TokenAndListParam theIdentifier, 
114   
115 			@Description(shortDefinition="")
116 			@OptionalParam(name="kind")
117 			TokenAndListParam theKind, 
118   
119 			@Description(shortDefinition="Name of the profile")
120 			@OptionalParam(name="name")
121 			StringAndListParam theName, 
122   
123 			@Description(shortDefinition="A path that is constrained in the profile")
124 			@OptionalParam(name="path")
125 			TokenAndListParam thePath, 
126   
127 			@Description(shortDefinition="Name of the publisher of the profile")
128 			@OptionalParam(name="publisher")
129 			StringAndListParam thePublisher, 
130   
131 			@Description(shortDefinition="The current status of the profile")
132 			@OptionalParam(name="status")
133 			TokenAndListParam theStatus, 
134   
135 			@Description(shortDefinition="")
136 			@OptionalParam(name="type")
137 			TokenAndListParam theType, 
138   
139 			@Description(shortDefinition="")
140 			@OptionalParam(name="url")
141 			UriAndListParam theUrl, 
142   
143 			@Description(shortDefinition="A vocabulary binding reference")
144 			@OptionalParam(name="valueset", targetTypes={  } )
145 			ReferenceAndListParam theValueset, 
146   
147 			@Description(shortDefinition="The version identifier of the profile")
148 			@OptionalParam(name="version")
149 			TokenAndListParam theVersion, 
150 
151 			@RawParam
152 			Map<String, List<String>> theAdditionalRawParams,
153 
154 			@IncludeParam(reverse=true)
155 			Set<Include> theRevIncludes,
156 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
157 			@OptionalParam(name="_lastUpdated")
158 			DateRangeParam theLastUpdated, 
159 
160 			@IncludeParam(allow= {
161 					"StructureDefinition:valueset" 					, "*"
162 			}) 
163 			Set<Include> theIncludes,
164 			
165 			@Sort 
166 			SortSpec theSort,
167 			
168 			@ca.uhn.fhir.rest.annotation.Count
169 			Integer theCount
170 	) {
171 		startRequest(theServletRequest);
172 		try {
173 			SearchParameterMap paramMap = new SearchParameterMap();
174 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
175 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
176 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
177 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
178 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
179 			paramMap.add("_has", theHas);
180 			paramMap.add("_id", the_id);
181 			paramMap.add("_language", the_language);
182 			paramMap.add("abstract", theAbstract);
183 			paramMap.add("base", theBase);
184 			paramMap.add("base-path", theBase_path);
185 			paramMap.add("code", theCode);
186 			paramMap.add("context", theContext);
187 			paramMap.add("context-type", theContext_type);
188 			paramMap.add("date", theDate);
189 			paramMap.add("description", theDescription);
190 			paramMap.add("display", theDisplay);
191 			paramMap.add("experimental", theExperimental);
192 			paramMap.add("ext-context", theExt_context);
193 			paramMap.add("identifier", theIdentifier);
194 			paramMap.add("kind", theKind);
195 			paramMap.add("name", theName);
196 			paramMap.add("path", thePath);
197 			paramMap.add("publisher", thePublisher);
198 			paramMap.add("status", theStatus);
199 			paramMap.add("type", theType);
200 			paramMap.add("url", theUrl);
201 			paramMap.add("valueset", theValueset);
202 			paramMap.add("version", theVersion);
203 			paramMap.setRevIncludes(theRevIncludes);
204 			paramMap.setLastUpdated(theLastUpdated);
205 			paramMap.setIncludes(theIncludes);
206 			paramMap.setSort(theSort);
207 			paramMap.setCount(theCount);
208 
209 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
210 
211 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
212 			return retVal;
213 		} finally {
214 			endRequest(theServletRequest);
215 		}
216 	}
217 
218 }