View Javadoc
1   
2   package ca.uhn.fhir.jpa.rp.dstu3;
3   
4   import java.util.*;
5   
6   import org.apache.commons.lang3.StringUtils;
7   
8   import ca.uhn.fhir.jpa.provider.dstu3.*;
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 org.hl7.fhir.dstu3.model.*;
13  import ca.uhn.fhir.rest.annotation.*;
14  import ca.uhn.fhir.rest.param.*;
15  import ca.uhn.fhir.rest.api.SortSpec;
16  
17  public class LibraryResourceProvider extends 
18  	JpaResourceProviderDstu3<Library>
19  	{
20  
21  	@Override
22  	public Class<Library> getResourceType() {
23  		return Library.class;
24  	}
25  
26  	@Search(allowUnknownParams=true)
27  	public ca.uhn.fhir.rest.api.server.IBundleProvider search(
28  			javax.servlet.http.HttpServletRequest theServletRequest,
29  			javax.servlet.http.HttpServletResponse theServletResponse,
30  
31  			ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails,
32  			
33  			@Description(shortDefinition="Search the contents of the resource's data using a fulltext search")
34  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT)
35  			StringAndListParam theFtContent, 
36  
37  			@Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search")
38  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TEXT)
39  			StringAndListParam theFtText, 
40  
41  			@Description(shortDefinition="Search for resources which have the given tag")
42  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TAG)
43  			TokenAndListParam theSearchForTag, 
44  
45  			@Description(shortDefinition="Search for resources which have the given security labels")
46  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY)
47  			TokenAndListParam theSearchForSecurity, 
48    
49  			@Description(shortDefinition="Search for resources which have the given profile")
50  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE)
51  			UriAndListParam theSearchForProfile, 
52  
53  			@Description(shortDefinition="Return resources linked to by the given target")
54  			@OptionalParam(name="_has")
55  			HasAndListParam theHas, 
56  
57    
58  			@Description(shortDefinition="The ID of the resource")
59  			@OptionalParam(name="_id")
60  			TokenAndListParam the_id, 
61    
62  			@Description(shortDefinition="The language of the resource")
63  			@OptionalParam(name="_language")
64  			StringAndListParam the_language, 
65    
66  			@Description(shortDefinition="What resource is being referenced")
67  			@OptionalParam(name="composed-of", targetTypes={  } )
68  			ReferenceAndListParam theComposed_of, 
69    
70  			@Description(shortDefinition="The library publication date")
71  			@OptionalParam(name="date")
72  			DateRangeParam theDate, 
73    
74  			@Description(shortDefinition="What resource is being referenced")
75  			@OptionalParam(name="depends-on", targetTypes={  } )
76  			ReferenceAndListParam theDepends_on, 
77    
78  			@Description(shortDefinition="What resource is being referenced")
79  			@OptionalParam(name="derived-from", targetTypes={  } )
80  			ReferenceAndListParam theDerived_from, 
81    
82  			@Description(shortDefinition="The description of the library")
83  			@OptionalParam(name="description")
84  			StringAndListParam theDescription, 
85    
86  			@Description(shortDefinition="The time during which the library is intended to be in use")
87  			@OptionalParam(name="effective")
88  			DateRangeParam theEffective, 
89    
90  			@Description(shortDefinition="External identifier for the library")
91  			@OptionalParam(name="identifier")
92  			TokenAndListParam theIdentifier, 
93    
94  			@Description(shortDefinition="Intended jurisdiction for the library")
95  			@OptionalParam(name="jurisdiction")
96  			TokenAndListParam theJurisdiction, 
97    
98  			@Description(shortDefinition="Computationally friendly name of the library")
99  			@OptionalParam(name="name")
100 			StringAndListParam theName, 
101   
102 			@Description(shortDefinition="What resource is being referenced")
103 			@OptionalParam(name="predecessor", targetTypes={  } )
104 			ReferenceAndListParam thePredecessor, 
105   
106 			@Description(shortDefinition="Name of the publisher of the library")
107 			@OptionalParam(name="publisher")
108 			StringAndListParam thePublisher, 
109   
110 			@Description(shortDefinition="The current status of the library")
111 			@OptionalParam(name="status")
112 			TokenAndListParam theStatus, 
113   
114 			@Description(shortDefinition="What resource is being referenced")
115 			@OptionalParam(name="successor", targetTypes={  } )
116 			ReferenceAndListParam theSuccessor, 
117   
118 			@Description(shortDefinition="The human-friendly name of the library")
119 			@OptionalParam(name="title")
120 			StringAndListParam theTitle, 
121   
122 			@Description(shortDefinition="Topics associated with the module")
123 			@OptionalParam(name="topic")
124 			TokenAndListParam theTopic, 
125   
126 			@Description(shortDefinition="The uri that identifies the library")
127 			@OptionalParam(name="url")
128 			UriAndListParam theUrl, 
129   
130 			@Description(shortDefinition="The business version of the library")
131 			@OptionalParam(name="version")
132 			TokenAndListParam theVersion, 
133 
134 			@RawParam
135 			Map<String, List<String>> theAdditionalRawParams,
136 
137 			@IncludeParam(reverse=true)
138 			Set<Include> theRevIncludes,
139 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
140 			@OptionalParam(name="_lastUpdated")
141 			DateRangeParam theLastUpdated, 
142 
143 			@IncludeParam(allow= {
144 					"Library:composed-of" , 					"Library:depends-on" , 					"Library:derived-from" , 					"Library:predecessor" , 					"Library:successor" , 						"Library:composed-of" , 					"Library:depends-on" , 					"Library:derived-from" , 					"Library:predecessor" , 					"Library:successor" , 						"Library:composed-of" , 					"Library:depends-on" , 					"Library:derived-from" , 					"Library:predecessor" , 					"Library:successor" , 						"Library:composed-of" , 					"Library:depends-on" , 					"Library:derived-from" , 					"Library:predecessor" , 					"Library:successor" , 						"Library:composed-of" , 					"Library:depends-on" , 					"Library:derived-from" , 					"Library:predecessor" , 					"Library:successor" 					, "*"
145 			}) 
146 			Set<Include> theIncludes,
147 			
148 			@Sort 
149 			SortSpec theSort,
150 			
151 			@ca.uhn.fhir.rest.annotation.Count
152 			Integer theCount
153 	) {
154 		startRequest(theServletRequest);
155 		try {
156 			SearchParameterMap paramMap = new SearchParameterMap();
157 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
158 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
159 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
160 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
161 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
162 			paramMap.add("_has", theHas);
163 			paramMap.add("_id", the_id);
164 			paramMap.add("_language", the_language);
165 			paramMap.add("composed-of", theComposed_of);
166 			paramMap.add("date", theDate);
167 			paramMap.add("depends-on", theDepends_on);
168 			paramMap.add("derived-from", theDerived_from);
169 			paramMap.add("description", theDescription);
170 			paramMap.add("effective", theEffective);
171 			paramMap.add("identifier", theIdentifier);
172 			paramMap.add("jurisdiction", theJurisdiction);
173 			paramMap.add("name", theName);
174 			paramMap.add("predecessor", thePredecessor);
175 			paramMap.add("publisher", thePublisher);
176 			paramMap.add("status", theStatus);
177 			paramMap.add("successor", theSuccessor);
178 			paramMap.add("title", theTitle);
179 			paramMap.add("topic", theTopic);
180 			paramMap.add("url", theUrl);
181 			paramMap.add("version", theVersion);
182 			paramMap.setRevIncludes(theRevIncludes);
183 			paramMap.setLastUpdated(theLastUpdated);
184 			paramMap.setIncludes(theIncludes);
185 			paramMap.setSort(theSort);
186 			paramMap.setCount(theCount);
187 
188 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
189 
190 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
191 			return retVal;
192 		} finally {
193 			endRequest(theServletRequest);
194 		}
195 	}
196 
197 }