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.searchparam.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  import ca.uhn.fhir.rest.api.SummaryEnum;
17  import ca.uhn.fhir.rest.api.SearchTotalModeEnum;
18  
19  public class SubscriptionResourceProvider extends 
20  	JpaResourceProviderDstu3<Subscription>
21  	{
22  
23  	@Override
24  	public Class<Subscription> getResourceType() {
25  		return Subscription.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="A tag to be added to the resource matching the criteria")
73  			@OptionalParam(name="add-tag")
74  			TokenAndListParam theAdd_tag,
75    
76  			@Description(shortDefinition="Contact details for the subscription")
77  			@OptionalParam(name="contact")
78  			TokenAndListParam theContact,
79    
80  			@Description(shortDefinition="The search rules used to determine when to send a notification")
81  			@OptionalParam(name="criteria")
82  			StringAndListParam theCriteria, 
83    
84  			@Description(shortDefinition="The mime-type of the notification payload")
85  			@OptionalParam(name="payload")
86  			StringAndListParam thePayload, 
87    
88  			@Description(shortDefinition="The current state of the subscription")
89  			@OptionalParam(name="status")
90  			TokenAndListParam theStatus,
91    
92  			@Description(shortDefinition="The type of channel for the sent notifications")
93  			@OptionalParam(name="type")
94  			TokenAndListParam theType,
95    
96  			@Description(shortDefinition="The uri that will receive the notifications")
97  			@OptionalParam(name="url")
98  			UriAndListParam theUrl, 
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 				"*"
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("add-tag", theAdd_tag);
138 			paramMap.add("contact", theContact);
139 			paramMap.add("criteria", theCriteria);
140 			paramMap.add("payload", thePayload);
141 			paramMap.add("status", theStatus);
142 			paramMap.add("type", theType);
143 			paramMap.add("url", theUrl);
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 }