View Javadoc
1   
2   package ca.uhn.fhir.jpa.rp.r4;
3   
4   import java.util.*;
5   
6   import org.apache.commons.lang3.StringUtils;
7   
8   import ca.uhn.fhir.jpa.provider.r4.*;
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 org.hl7.fhir.r4.model.*;
13  import ca.uhn.fhir.rest.annotation.*;
14  import ca.uhn.fhir.rest.param.*;
15  import ca.uhn.fhir.rest.api.SortSpec;
16  import ca.uhn.fhir.rest.api.SummaryEnum;
17  import ca.uhn.fhir.rest.api.SearchTotalModeEnum;
18  
19  public class SupplyRequestResourceProvider extends 
20  	JpaResourceProviderR4<SupplyRequest>
21  	{
22  
23  	@Override
24  	public Class<SupplyRequest> getResourceType() {
25  		return SupplyRequest.class;
26  	}
27  
28  	@Search(allowUnknownParams=true)
29  	public ca.uhn.fhir.rest.api.server.IBundleProvider search(
30  			javax.servlet.http.HttpServletRequest theServletRequest,
31  			javax.servlet.http.HttpServletResponse theServletResponse,
32  
33  			ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails,
34  
35  			@Description(shortDefinition="Search the contents of the resource's data using a filter")
36  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_FILTER)
37  			StringAndListParam theFtFilter,
38  
39  			@Description(shortDefinition="Search the contents of the resource's data using a fulltext search")
40  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT)
41  			StringAndListParam theFtContent, 
42  
43  			@Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search")
44  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TEXT)
45  			StringAndListParam theFtText, 
46  
47  			@Description(shortDefinition="Search for resources which have the given tag")
48  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TAG)
49  			TokenAndListParam theSearchForTag, 
50  
51  			@Description(shortDefinition="Search for resources which have the given security labels")
52  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY)
53  			TokenAndListParam theSearchForSecurity, 
54    
55  			@Description(shortDefinition="Search for resources which have the given profile")
56  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE)
57  			UriAndListParam theSearchForProfile, 
58  
59  			@Description(shortDefinition="Return resources linked to by the given target")
60  			@OptionalParam(name="_has")
61  			HasAndListParam theHas, 
62  
63    
64  			@Description(shortDefinition="The ID of the resource")
65  			@OptionalParam(name="_id")
66  			TokenAndListParam the_id,
67    
68  			@Description(shortDefinition="The language of the resource")
69  			@OptionalParam(name="_language")
70  			StringAndListParam the_language, 
71    
72  			@Description(shortDefinition="The kind of supply (central, non-stock, etc.)")
73  			@OptionalParam(name="category")
74  			TokenAndListParam theCategory,
75    
76  			@Description(shortDefinition="When the request was made")
77  			@OptionalParam(name="date")
78  			DateRangeParam theDate, 
79    
80  			@Description(shortDefinition="Business Identifier for SupplyRequest")
81  			@OptionalParam(name="identifier")
82  			TokenAndListParam theIdentifier,
83    
84  			@Description(shortDefinition="Individual making the request")
85  			@OptionalParam(name="requester", targetTypes={  } )
86  			ReferenceAndListParam theRequester, 
87    
88  			@Description(shortDefinition="draft | active | suspended +")
89  			@OptionalParam(name="status")
90  			TokenAndListParam theStatus,
91    
92  			@Description(shortDefinition="The destination of the supply")
93  			@OptionalParam(name="subject", targetTypes={  } )
94  			ReferenceAndListParam theSubject, 
95    
96  			@Description(shortDefinition="Who is intended to fulfill the request")
97  			@OptionalParam(name="supplier", targetTypes={  } )
98  			ReferenceAndListParam theSupplier, 
99  
100 			@RawParam
101 			Map<String, List<String>> theAdditionalRawParams,
102 
103 			@IncludeParam(reverse=true)
104 			Set<Include> theRevIncludes,
105 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
106 			@OptionalParam(name="_lastUpdated")
107 			DateRangeParam theLastUpdated, 
108 
109 			@IncludeParam(allow= {
110 					"SupplyRequest:requester" , 					"SupplyRequest:subject" , 					"SupplyRequest:supplier" , 						"SupplyRequest:requester" , 					"SupplyRequest:subject" , 					"SupplyRequest:supplier" , 						"SupplyRequest:requester" , 					"SupplyRequest:subject" , 					"SupplyRequest:supplier" 					, "*"
111 			}) 
112 			Set<Include> theIncludes,
113 			
114 			@Sort 
115 			SortSpec theSort,
116 			
117 			@ca.uhn.fhir.rest.annotation.Count
118 			Integer theCount,
119 
120 			SummaryEnum theSummaryMode,
121 
122 			SearchTotalModeEnum theSearchTotalMode
123 
124 			) {
125 		startRequest(theServletRequest);
126 		try {
127 			SearchParameterMap paramMap = new SearchParameterMap();
128 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_FILTER, theFtFilter);
129 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
130 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
131 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
132 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
133 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
134 			paramMap.add("_has", theHas);
135 			paramMap.add("_id", the_id);
136 			paramMap.add("_language", the_language);
137 			paramMap.add("category", theCategory);
138 			paramMap.add("date", theDate);
139 			paramMap.add("identifier", theIdentifier);
140 			paramMap.add("requester", theRequester);
141 			paramMap.add("status", theStatus);
142 			paramMap.add("subject", theSubject);
143 			paramMap.add("supplier", theSupplier);
144 			paramMap.setRevIncludes(theRevIncludes);
145 			paramMap.setLastUpdated(theLastUpdated);
146 			paramMap.setIncludes(theIncludes);
147 			paramMap.setSort(theSort);
148 			paramMap.setCount(theCount);
149 			paramMap.setSummaryMode(theSummaryMode);
150 			paramMap.setSearchTotalMode(theSearchTotalMode);
151 
152 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
153 
154 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
155 			return retVal;
156 		} finally {
157 			endRequest(theServletRequest);
158 		}
159 	}
160 
161 }