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 SupplyDeliveryResourceProvider extends 
19  	JpaResourceProviderDstu2<SupplyDelivery>
20  	{
21  
22  	@Override
23  	public Class<SupplyDelivery> getResourceType() {
24  		return SupplyDelivery.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="identifier")
69  			TokenAndListParam theIdentifier, 
70    
71  			@Description(shortDefinition="")
72  			@OptionalParam(name="patient", targetTypes={  } )
73  			ReferenceAndListParam thePatient, 
74    
75  			@Description(shortDefinition="")
76  			@OptionalParam(name="receiver", targetTypes={  } )
77  			ReferenceAndListParam theReceiver, 
78    
79  			@Description(shortDefinition="")
80  			@OptionalParam(name="status")
81  			TokenAndListParam theStatus, 
82    
83  			@Description(shortDefinition="")
84  			@OptionalParam(name="supplier", targetTypes={  } )
85  			ReferenceAndListParam theSupplier, 
86  
87  			@RawParam
88  			Map<String, List<String>> theAdditionalRawParams,
89  
90  			@IncludeParam(reverse=true)
91  			Set<Include> theRevIncludes,
92  			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
93  			@OptionalParam(name="_lastUpdated")
94  			DateRangeParam theLastUpdated, 
95  
96  			@IncludeParam(allow= {
97  					"SupplyDelivery:patient" , 					"SupplyDelivery:receiver" , 					"SupplyDelivery:supplier" , 						"SupplyDelivery:patient" , 					"SupplyDelivery:receiver" , 					"SupplyDelivery:supplier" , 						"SupplyDelivery:patient" , 					"SupplyDelivery:receiver" , 					"SupplyDelivery:supplier" 					, "*"
98  			}) 
99  			Set<Include> theIncludes,
100 			
101 			@Sort 
102 			SortSpec theSort,
103 			
104 			@ca.uhn.fhir.rest.annotation.Count
105 			Integer theCount
106 	) {
107 		startRequest(theServletRequest);
108 		try {
109 			SearchParameterMap paramMap = new SearchParameterMap();
110 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
111 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
112 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
113 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
114 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
115 			paramMap.add("_has", theHas);
116 			paramMap.add("_id", the_id);
117 			paramMap.add("_language", the_language);
118 			paramMap.add("identifier", theIdentifier);
119 			paramMap.add("patient", thePatient);
120 			paramMap.add("receiver", theReceiver);
121 			paramMap.add("status", theStatus);
122 			paramMap.add("supplier", theSupplier);
123 			paramMap.setRevIncludes(theRevIncludes);
124 			paramMap.setLastUpdated(theLastUpdated);
125 			paramMap.setIncludes(theIncludes);
126 			paramMap.setSort(theSort);
127 			paramMap.setCount(theCount);
128 
129 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
130 
131 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
132 			return retVal;
133 		} finally {
134 			endRequest(theServletRequest);
135 		}
136 	}
137 
138 }