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 ScheduleResourceProvider extends 
21  	JpaResourceProviderDstu2<Schedule>
22  	{
23  
24  	@Override
25  	public Class<Schedule> getResourceType() {
26  		return Schedule.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="The individual(HealthcareService, Practitioner, Location, ...) to find a Schedule for")
70  			@OptionalParam(name="actor", targetTypes={  } )
71  			ReferenceAndListParam theActor, 
72    
73  			@Description(shortDefinition="Search for Schedule resources that have a period that contains this date specified")
74  			@OptionalParam(name="date")
75  			DateRangeParam theDate, 
76    
77  			@Description(shortDefinition="A Schedule Identifier")
78  			@OptionalParam(name="identifier")
79  			TokenAndListParam theIdentifier,
80    
81  			@Description(shortDefinition="The type of appointments that can be booked into associated slot(s)")
82  			@OptionalParam(name="type")
83  			TokenAndListParam theType,
84  
85  			@RawParam
86  			Map<String, List<String>> theAdditionalRawParams,
87  
88  			@IncludeParam(reverse=true)
89  			Set<Include> theRevIncludes,
90  			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
91  			@OptionalParam(name="_lastUpdated")
92  			DateRangeParam theLastUpdated, 
93  
94  			@IncludeParam(allow= {
95  					"Schedule:actor" 					, "*"
96  			}) 
97  			Set<Include> theIncludes,
98  			
99  			@Sort 
100 			SortSpec theSort,
101 			
102 			@ca.uhn.fhir.rest.annotation.Count
103 			Integer theCount,
104 
105 			SummaryEnum theSummaryMode,
106 
107 			SearchTotalModeEnum theSearchTotalMode
108 
109 			) {
110 		startRequest(theServletRequest);
111 		try {
112 			SearchParameterMap paramMap = new SearchParameterMap();
113 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
114 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
115 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
116 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
117 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
118 			paramMap.add("_has", theHas);
119 			paramMap.add("_id", the_id);
120 			paramMap.add("_language", the_language);
121 			paramMap.add("actor", theActor);
122 			paramMap.add("date", theDate);
123 			paramMap.add("identifier", theIdentifier);
124 			paramMap.add("type", theType);
125 			paramMap.setRevIncludes(theRevIncludes);
126 			paramMap.setLastUpdated(theLastUpdated);
127 			paramMap.setIncludes(theIncludes);
128 			paramMap.setSort(theSort);
129 			paramMap.setCount(theCount);
130 			paramMap.setSummaryMode(theSummaryMode);
131 			paramMap.setSearchTotalMode(theSearchTotalMode);
132 
133 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
134 
135 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
136 			return retVal;
137 		} finally {
138 			endRequest(theServletRequest);
139 		}
140 	}
141 
142 }