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.searchparam.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  import ca.uhn.fhir.rest.api.SummaryEnum;
18  import ca.uhn.fhir.rest.api.SearchTotalModeEnum;
19  
20  public class DataElementResourceProvider extends 
21  	JpaResourceProviderDstu2<DataElement>
22  	{
23  
24  	@Override
25  	public Class<DataElement> getResourceType() {
26  		return DataElement.class;
27  	}
28  
29  	@Search(allowUnknownParams=true)
30  	public ca.uhn.fhir.rest.api.server.IBundleProvider search(
31  			javax.servlet.http.HttpServletRequest theServletRequest,
32  			javax.servlet.http.HttpServletResponse theServletResponse,
33  
34  			ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails,
35  			
36  			@Description(shortDefinition="Search the contents of the resource's data using a fulltext search")
37  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT)
38  			StringAndListParam theFtContent, 
39  
40  			@Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search")
41  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TEXT)
42  			StringAndListParam theFtText, 
43  
44  			@Description(shortDefinition="Search for resources which have the given tag")
45  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TAG)
46  			TokenAndListParam theSearchForTag, 
47  
48  			@Description(shortDefinition="Search for resources which have the given security labels")
49  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY)
50  			TokenAndListParam theSearchForSecurity, 
51    
52  			@Description(shortDefinition="Search for resources which have the given profile")
53  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE)
54  			UriAndListParam theSearchForProfile, 
55  
56  			@Description(shortDefinition="Return resources linked to by the given target")
57  			@OptionalParam(name="_has")
58  			HasAndListParam theHas, 
59  
60    
61  			@Description(shortDefinition="The ID of the resource")
62  			@OptionalParam(name="_id")
63  			StringAndListParam the_id, 
64    
65  			@Description(shortDefinition="The language of the resource")
66  			@OptionalParam(name="_language")
67  			StringAndListParam the_language, 
68    
69  			@Description(shortDefinition="A code for the data element (server may choose to do subsumption)")
70  			@OptionalParam(name="code")
71  			TokenAndListParam theCode,
72    
73  			@Description(shortDefinition="A use context assigned to the data element")
74  			@OptionalParam(name="context")
75  			TokenAndListParam theContext,
76    
77  			@Description(shortDefinition="The data element publication date")
78  			@OptionalParam(name="date")
79  			DateRangeParam theDate, 
80    
81  			@Description(shortDefinition="Text search in the description of the data element.  This corresponds to the definition of the first DataElement.element.")
82  			@OptionalParam(name="description")
83  			StringAndListParam theDescription, 
84    
85  			@Description(shortDefinition="The identifier of the data element")
86  			@OptionalParam(name="identifier")
87  			TokenAndListParam theIdentifier,
88    
89  			@Description(shortDefinition="Name of the data element")
90  			@OptionalParam(name="name")
91  			StringAndListParam theName, 
92    
93  			@Description(shortDefinition="Name of the publisher of the data element")
94  			@OptionalParam(name="publisher")
95  			StringAndListParam thePublisher, 
96    
97  			@Description(shortDefinition="The current status of the data element")
98  			@OptionalParam(name="status")
99  			TokenAndListParam theStatus,
100   
101 			@Description(shortDefinition="The stringency of the data element definition")
102 			@OptionalParam(name="stringency")
103 			TokenAndListParam theStringency,
104   
105 			@Description(shortDefinition="The official URL for the data element")
106 			@OptionalParam(name="url")
107 			UriAndListParam theUrl, 
108   
109 			@Description(shortDefinition="The version identifier of the data element")
110 			@OptionalParam(name="version")
111 			StringAndListParam theVersion, 
112 
113 			@RawParam
114 			Map<String, List<String>> theAdditionalRawParams,
115 
116 			@IncludeParam(reverse=true)
117 			Set<Include> theRevIncludes,
118 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
119 			@OptionalParam(name="_lastUpdated")
120 			DateRangeParam theLastUpdated, 
121 
122 			@IncludeParam(allow= {
123 				"*"
124 			}) 
125 			Set<Include> theIncludes,
126 			
127 			@Sort 
128 			SortSpec theSort,
129 			
130 			@ca.uhn.fhir.rest.annotation.Count
131 			Integer theCount,
132 
133 			SummaryEnum theSummaryMode,
134 
135 			SearchTotalModeEnum theSearchTotalMode
136 
137 			) {
138 		startRequest(theServletRequest);
139 		try {
140 			SearchParameterMap paramMap = new SearchParameterMap();
141 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
142 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
143 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
144 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
145 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
146 			paramMap.add("_has", theHas);
147 			paramMap.add("_id", the_id);
148 			paramMap.add("_language", the_language);
149 			paramMap.add("code", theCode);
150 			paramMap.add("context", theContext);
151 			paramMap.add("date", theDate);
152 			paramMap.add("description", theDescription);
153 			paramMap.add("identifier", theIdentifier);
154 			paramMap.add("name", theName);
155 			paramMap.add("publisher", thePublisher);
156 			paramMap.add("status", theStatus);
157 			paramMap.add("stringency", theStringency);
158 			paramMap.add("url", theUrl);
159 			paramMap.add("version", theVersion);
160 			paramMap.setRevIncludes(theRevIncludes);
161 			paramMap.setLastUpdated(theLastUpdated);
162 			paramMap.setIncludes(theIncludes);
163 			paramMap.setSort(theSort);
164 			paramMap.setCount(theCount);
165 			paramMap.setSummaryMode(theSummaryMode);
166 			paramMap.setSearchTotalMode(theSearchTotalMode);
167 
168 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
169 
170 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
171 			return retVal;
172 		} finally {
173 			endRequest(theServletRequest);
174 		}
175 	}
176 
177 }