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