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.dao.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  
17  public class CareTeamResourceProvider extends 
18  	JpaResourceProviderDstu3<CareTeam>
19  	{
20  
21  	@Override
22  	public Class<CareTeam> getResourceType() {
23  		return CareTeam.class;
24  	}
25  
26  	@Search(allowUnknownParams=true)
27  	public ca.uhn.fhir.rest.api.server.IBundleProvider search(
28  			javax.servlet.http.HttpServletRequest theServletRequest,
29  			javax.servlet.http.HttpServletResponse theServletResponse,
30  
31  			ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails,
32  			
33  			@Description(shortDefinition="Search the contents of the resource's data using a fulltext search")
34  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT)
35  			StringAndListParam theFtContent, 
36  
37  			@Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search")
38  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TEXT)
39  			StringAndListParam theFtText, 
40  
41  			@Description(shortDefinition="Search for resources which have the given tag")
42  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TAG)
43  			TokenAndListParam theSearchForTag, 
44  
45  			@Description(shortDefinition="Search for resources which have the given security labels")
46  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY)
47  			TokenAndListParam theSearchForSecurity, 
48    
49  			@Description(shortDefinition="Search for resources which have the given profile")
50  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE)
51  			UriAndListParam theSearchForProfile, 
52  
53  			@Description(shortDefinition="Return resources linked to by the given target")
54  			@OptionalParam(name="_has")
55  			HasAndListParam theHas, 
56  
57    
58  			@Description(shortDefinition="The ID of the resource")
59  			@OptionalParam(name="_id")
60  			TokenAndListParam the_id, 
61    
62  			@Description(shortDefinition="The language of the resource")
63  			@OptionalParam(name="_language")
64  			StringAndListParam the_language, 
65    
66  			@Description(shortDefinition="Type of team")
67  			@OptionalParam(name="category")
68  			TokenAndListParam theCategory, 
69    
70  			@Description(shortDefinition="Encounter or episode associated with CareTeam")
71  			@OptionalParam(name="context", targetTypes={  } )
72  			ReferenceAndListParam theContext, 
73    
74  			@Description(shortDefinition="Time period team covers")
75  			@OptionalParam(name="date")
76  			DateRangeParam theDate, 
77    
78  			@Description(shortDefinition="Encounter or episode associated with CareTeam")
79  			@OptionalParam(name="encounter", targetTypes={  } )
80  			ReferenceAndListParam theEncounter, 
81    
82  			@Description(shortDefinition="External Ids for this team")
83  			@OptionalParam(name="identifier")
84  			TokenAndListParam theIdentifier, 
85    
86  			@Description(shortDefinition="Who is involved")
87  			@OptionalParam(name="participant", targetTypes={  } )
88  			ReferenceAndListParam theParticipant, 
89    
90  			@Description(shortDefinition="Who care team is for")
91  			@OptionalParam(name="patient", targetTypes={  } )
92  			ReferenceAndListParam thePatient, 
93    
94  			@Description(shortDefinition="proposed | active | suspended | inactive | entered-in-error")
95  			@OptionalParam(name="status")
96  			TokenAndListParam theStatus, 
97    
98  			@Description(shortDefinition="Who care team is for")
99  			@OptionalParam(name="subject", targetTypes={  } )
100 			ReferenceAndListParam theSubject, 
101 
102 			@RawParam
103 			Map<String, List<String>> theAdditionalRawParams,
104 
105 			@IncludeParam(reverse=true)
106 			Set<Include> theRevIncludes,
107 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
108 			@OptionalParam(name="_lastUpdated")
109 			DateRangeParam theLastUpdated, 
110 
111 			@IncludeParam(allow= {
112 					"CareTeam:context" , 					"CareTeam:encounter" , 					"CareTeam:participant" , 					"CareTeam:patient" , 					"CareTeam:subject" , 						"CareTeam:context" , 					"CareTeam:encounter" , 					"CareTeam:participant" , 					"CareTeam:patient" , 					"CareTeam:subject" , 						"CareTeam:context" , 					"CareTeam:encounter" , 					"CareTeam:participant" , 					"CareTeam:patient" , 					"CareTeam:subject" , 						"CareTeam:context" , 					"CareTeam:encounter" , 					"CareTeam:participant" , 					"CareTeam:patient" , 					"CareTeam:subject" , 						"CareTeam:context" , 					"CareTeam:encounter" , 					"CareTeam:participant" , 					"CareTeam:patient" , 					"CareTeam:subject" 					, "*"
113 			}) 
114 			Set<Include> theIncludes,
115 			
116 			@Sort 
117 			SortSpec theSort,
118 			
119 			@ca.uhn.fhir.rest.annotation.Count
120 			Integer theCount
121 	) {
122 		startRequest(theServletRequest);
123 		try {
124 			SearchParameterMap paramMap = new SearchParameterMap();
125 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
126 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
127 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
128 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
129 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
130 			paramMap.add("_has", theHas);
131 			paramMap.add("_id", the_id);
132 			paramMap.add("_language", the_language);
133 			paramMap.add("category", theCategory);
134 			paramMap.add("context", theContext);
135 			paramMap.add("date", theDate);
136 			paramMap.add("encounter", theEncounter);
137 			paramMap.add("identifier", theIdentifier);
138 			paramMap.add("participant", theParticipant);
139 			paramMap.add("patient", thePatient);
140 			paramMap.add("status", theStatus);
141 			paramMap.add("subject", theSubject);
142 			paramMap.setRevIncludes(theRevIncludes);
143 			paramMap.setLastUpdated(theLastUpdated);
144 			paramMap.setIncludes(theIncludes);
145 			paramMap.setSort(theSort);
146 			paramMap.setCount(theCount);
147 
148 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
149 
150 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
151 			return retVal;
152 		} finally {
153 			endRequest(theServletRequest);
154 		}
155 	}
156 
157 }