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 OrganizationResourceProvider extends 
19  	JpaResourceProviderDstu2<Organization>
20  	{
21  
22  	@Override
23  	public Class<Organization> getResourceType() {
24  		return Organization.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="Whether the organization's record is active")
68  			@OptionalParam(name="active")
69  			TokenAndListParam theActive, 
70    
71  			@Description(shortDefinition="A (part of the) address of the Organization")
72  			@OptionalParam(name="address")
73  			StringAndListParam theAddress, 
74    
75  			@Description(shortDefinition="A city specified in an address")
76  			@OptionalParam(name="address-city")
77  			StringAndListParam theAddress_city, 
78    
79  			@Description(shortDefinition="A country specified in an address")
80  			@OptionalParam(name="address-country")
81  			StringAndListParam theAddress_country, 
82    
83  			@Description(shortDefinition="A postal code specified in an address")
84  			@OptionalParam(name="address-postalcode")
85  			StringAndListParam theAddress_postalcode, 
86    
87  			@Description(shortDefinition="A state specified in an address")
88  			@OptionalParam(name="address-state")
89  			StringAndListParam theAddress_state, 
90    
91  			@Description(shortDefinition="A use code specified in an address")
92  			@OptionalParam(name="address-use")
93  			TokenAndListParam theAddress_use, 
94    
95  			@Description(shortDefinition="Any identifier for the organization (not the accreditation issuer's identifier)")
96  			@OptionalParam(name="identifier")
97  			TokenAndListParam theIdentifier, 
98    
99  			@Description(shortDefinition="A portion of the organization's name")
100 			@OptionalParam(name="name")
101 			StringAndListParam theName, 
102   
103 			@Description(shortDefinition="Search all organizations that are part of the given organization")
104 			@OptionalParam(name="partof", targetTypes={  } )
105 			ReferenceAndListParam thePartof, 
106   
107 			@Description(shortDefinition="A portion of the organization's name using some kind of phonetic matching algorithm")
108 			@OptionalParam(name="phonetic")
109 			StringAndListParam thePhonetic, 
110   
111 			@Description(shortDefinition="A code for the type of organization")
112 			@OptionalParam(name="type")
113 			TokenAndListParam theType, 
114 
115 			@RawParam
116 			Map<String, List<String>> theAdditionalRawParams,
117 
118 			@IncludeParam(reverse=true)
119 			Set<Include> theRevIncludes,
120 			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
121 			@OptionalParam(name="_lastUpdated")
122 			DateRangeParam theLastUpdated, 
123 
124 			@IncludeParam(allow= {
125 					"Organization:partof" 					, "*"
126 			}) 
127 			Set<Include> theIncludes,
128 			
129 			@Sort 
130 			SortSpec theSort,
131 			
132 			@ca.uhn.fhir.rest.annotation.Count
133 			Integer theCount
134 	) {
135 		startRequest(theServletRequest);
136 		try {
137 			SearchParameterMap paramMap = new SearchParameterMap();
138 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
139 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
140 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
141 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
142 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
143 			paramMap.add("_has", theHas);
144 			paramMap.add("_id", the_id);
145 			paramMap.add("_language", the_language);
146 			paramMap.add("active", theActive);
147 			paramMap.add("address", theAddress);
148 			paramMap.add("address-city", theAddress_city);
149 			paramMap.add("address-country", theAddress_country);
150 			paramMap.add("address-postalcode", theAddress_postalcode);
151 			paramMap.add("address-state", theAddress_state);
152 			paramMap.add("address-use", theAddress_use);
153 			paramMap.add("identifier", theIdentifier);
154 			paramMap.add("name", theName);
155 			paramMap.add("partof", thePartof);
156 			paramMap.add("phonetic", thePhonetic);
157 			paramMap.add("type", theType);
158 			paramMap.setRevIncludes(theRevIncludes);
159 			paramMap.setLastUpdated(theLastUpdated);
160 			paramMap.setIncludes(theIncludes);
161 			paramMap.setSort(theSort);
162 			paramMap.setCount(theCount);
163 
164 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
165 
166 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
167 			return retVal;
168 		} finally {
169 			endRequest(theServletRequest);
170 		}
171 	}
172 
173 }