
001 002package ca.uhn.fhir.jpa.rp.dstu2; 003 004import java.util.*; 005 006import org.apache.commons.lang3.StringUtils; 007 008import ca.uhn.fhir.jpa.provider.*; 009import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; 010import ca.uhn.fhir.model.api.Include; 011import ca.uhn.fhir.model.api.annotation.*; 012import ca.uhn.fhir.model.dstu2.composite.*; 013import ca.uhn.fhir.model.dstu2.resource.*; // 014import ca.uhn.fhir.rest.annotation.*; 015import ca.uhn.fhir.rest.param.*; 016import ca.uhn.fhir.rest.api.SortSpec; 017import ca.uhn.fhir.rest.api.SummaryEnum; 018import ca.uhn.fhir.rest.api.SearchTotalModeEnum; 019import ca.uhn.fhir.rest.api.SearchContainedModeEnum; 020 021public class OrderResourceProvider extends 022 JpaResourceProviderDstu2<Order> 023 { 024 025 @Override 026 public Class<Order> getResourceType() { 027 return Order.class; 028 } 029 030 @Search(allowUnknownParams=true) 031 public ca.uhn.fhir.rest.api.server.IBundleProvider search( 032 javax.servlet.http.HttpServletRequest theServletRequest, 033 javax.servlet.http.HttpServletResponse theServletResponse, 034 035 ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails, 036 037 @Description(shortDefinition="Search the contents of the resource's data using a filter") 038 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_FILTER) 039 StringAndListParam theFtFilter, 040 041 @Description(shortDefinition="Search the contents of the resource's data using a fulltext search") 042 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT) 043 StringAndListParam theFtContent, 044 045 @Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search") 046 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TEXT) 047 StringAndListParam theFtText, 048 049 @Description(shortDefinition="Search for resources which have the given tag") 050 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TAG) 051 TokenAndListParam theSearchForTag, 052 053 @Description(shortDefinition="Search for resources which have the given security labels") 054 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY) 055 TokenAndListParam theSearchForSecurity, 056 057 @Description(shortDefinition="Search for resources which have the given profile") 058 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE) 059 UriAndListParam theSearchForProfile, 060 061 @Description(shortDefinition="Search for resources which have the given source value (Resource.meta.source)") 062 @OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE) 063 UriAndListParam theSearchForSource, 064 065 @Description(shortDefinition="Return resources linked to by the given target") 066 @OptionalParam(name="_has") 067 HasAndListParam theHas, 068 069 070 071 @Description(shortDefinition="The ID of the resource") 072 @OptionalParam(name="_id") 073 StringAndListParam the_id, 074 075 076 @Description(shortDefinition="") 077 @OptionalParam(name="date") 078 DateRangeParam theDate, 079 080 081 @Description(shortDefinition="") 082 @OptionalParam(name="detail", targetTypes={ } ) 083 ReferenceAndListParam theDetail, 084 085 086 @Description(shortDefinition="Instance id from source, target, and/or others") 087 @OptionalParam(name="identifier") 088 TokenAndListParam theIdentifier, 089 090 091 @Description(shortDefinition="") 092 @OptionalParam(name="patient", targetTypes={ } ) 093 ReferenceAndListParam thePatient, 094 095 096 @Description(shortDefinition="") 097 @OptionalParam(name="source", targetTypes={ } ) 098 ReferenceAndListParam theSource, 099 100 101 @Description(shortDefinition="") 102 @OptionalParam(name="subject", targetTypes={ } ) 103 ReferenceAndListParam theSubject, 104 105 106 @Description(shortDefinition="") 107 @OptionalParam(name="target", targetTypes={ } ) 108 ReferenceAndListParam theTarget, 109 110 111 @Description(shortDefinition="") 112 @OptionalParam(name="when") 113 DateRangeParam theWhen, 114 115 116 @Description(shortDefinition="") 117 @OptionalParam(name="when_code") 118 TokenAndListParam theWhen_code, 119 120 @RawParam 121 Map<String, List<String>> theAdditionalRawParams, 122 123 @Description(shortDefinition="Only return resources which were last updated as specified by the given range") 124 @OptionalParam(name="_lastUpdated") 125 DateRangeParam theLastUpdated, 126 127 @IncludeParam 128 Set<Include> theIncludes, 129 130 @IncludeParam(reverse=true) 131 Set<Include> theRevIncludes, 132 133 @Sort 134 SortSpec theSort, 135 136 @ca.uhn.fhir.rest.annotation.Count 137 Integer theCount, 138 139 @ca.uhn.fhir.rest.annotation.Offset 140 Integer theOffset, 141 142 SummaryEnum theSummaryMode, 143 144 SearchTotalModeEnum theSearchTotalMode, 145 146 SearchContainedModeEnum theSearchContainedMode 147 148 ) { 149 startRequest(theServletRequest); 150 try { 151 SearchParameterMap paramMap = new SearchParameterMap(); 152 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_FILTER, theFtFilter); 153 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent); 154 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText); 155 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag); 156 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity); 157 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile); 158 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE, theSearchForSource); 159 paramMap.add("_has", theHas); 160 paramMap.add("_id", the_id); 161 paramMap.add("date", theDate); 162 paramMap.add("detail", theDetail); 163 paramMap.add("identifier", theIdentifier); 164 paramMap.add("patient", thePatient); 165 paramMap.add("source", theSource); 166 paramMap.add("subject", theSubject); 167 paramMap.add("target", theTarget); 168 paramMap.add("when", theWhen); 169 paramMap.add("when_code", theWhen_code); 170 paramMap.setRevIncludes(theRevIncludes); 171 paramMap.setLastUpdated(theLastUpdated); 172 paramMap.setIncludes(theIncludes); 173 paramMap.setSort(theSort); 174 paramMap.setCount(theCount); 175 paramMap.setOffset(theOffset); 176 paramMap.setSummaryMode(theSummaryMode); 177 paramMap.setSearchTotalMode(theSearchTotalMode); 178 paramMap.setSearchContainedMode(theSearchContainedMode); 179 180 getDao().translateRawParameters(theAdditionalRawParams, paramMap); 181 182 ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse); 183 return retVal; 184 } finally { 185 endRequest(theServletRequest); 186 } 187 } 188 189}