
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 DataElementResourceProvider extends 022 JpaResourceProviderDstu2<DataElement> 023 { 024 025 @Override 026 public Class<DataElement> getResourceType() { 027 return DataElement.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="A code for the data element (server may choose to do subsumption)") 077 @OptionalParam(name="code") 078 TokenAndListParam theCode, 079 080 081 @Description(shortDefinition="A use context assigned to the data element") 082 @OptionalParam(name="context") 083 TokenAndListParam theContext, 084 085 086 @Description(shortDefinition="The data element publication date") 087 @OptionalParam(name="date") 088 DateRangeParam theDate, 089 090 091 @Description(shortDefinition="Text search in the description of the data element. This corresponds to the definition of the first DataElement.element.") 092 @OptionalParam(name="description") 093 StringAndListParam theDescription, 094 095 096 @Description(shortDefinition="The identifier of the data element") 097 @OptionalParam(name="identifier") 098 TokenAndListParam theIdentifier, 099 100 101 @Description(shortDefinition="Name of the data element") 102 @OptionalParam(name="name") 103 StringAndListParam theName, 104 105 106 @Description(shortDefinition="Name of the publisher of the data element") 107 @OptionalParam(name="publisher") 108 StringAndListParam thePublisher, 109 110 111 @Description(shortDefinition="The current status of the data element") 112 @OptionalParam(name="status") 113 TokenAndListParam theStatus, 114 115 116 @Description(shortDefinition="The stringency of the data element definition") 117 @OptionalParam(name="stringency") 118 TokenAndListParam theStringency, 119 120 121 @Description(shortDefinition="The official URL for the data element") 122 @OptionalParam(name="url") 123 UriAndListParam theUrl, 124 125 126 @Description(shortDefinition="The version identifier of the data element") 127 @OptionalParam(name="version") 128 StringAndListParam theVersion, 129 130 @RawParam 131 Map<String, List<String>> theAdditionalRawParams, 132 133 @Description(shortDefinition="Only return resources which were last updated as specified by the given range") 134 @OptionalParam(name="_lastUpdated") 135 DateRangeParam theLastUpdated, 136 137 @IncludeParam 138 Set<Include> theIncludes, 139 140 @IncludeParam(reverse=true) 141 Set<Include> theRevIncludes, 142 143 @Sort 144 SortSpec theSort, 145 146 @ca.uhn.fhir.rest.annotation.Count 147 Integer theCount, 148 149 @ca.uhn.fhir.rest.annotation.Offset 150 Integer theOffset, 151 152 SummaryEnum theSummaryMode, 153 154 SearchTotalModeEnum theSearchTotalMode, 155 156 SearchContainedModeEnum theSearchContainedMode 157 158 ) { 159 startRequest(theServletRequest); 160 try { 161 SearchParameterMap paramMap = new SearchParameterMap(); 162 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_FILTER, theFtFilter); 163 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent); 164 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText); 165 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag); 166 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity); 167 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile); 168 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE, theSearchForSource); 169 paramMap.add("_has", theHas); 170 paramMap.add("_id", the_id); 171 paramMap.add("code", theCode); 172 paramMap.add("context", theContext); 173 paramMap.add("date", theDate); 174 paramMap.add("description", theDescription); 175 paramMap.add("identifier", theIdentifier); 176 paramMap.add("name", theName); 177 paramMap.add("publisher", thePublisher); 178 paramMap.add("status", theStatus); 179 paramMap.add("stringency", theStringency); 180 paramMap.add("url", theUrl); 181 paramMap.add("version", theVersion); 182 paramMap.setRevIncludes(theRevIncludes); 183 paramMap.setLastUpdated(theLastUpdated); 184 paramMap.setIncludes(theIncludes); 185 paramMap.setSort(theSort); 186 paramMap.setCount(theCount); 187 paramMap.setOffset(theOffset); 188 paramMap.setSummaryMode(theSummaryMode); 189 paramMap.setSearchTotalMode(theSearchTotalMode); 190 paramMap.setSearchContainedMode(theSearchContainedMode); 191 192 getDao().translateRawParameters(theAdditionalRawParams, paramMap); 193 194 ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse); 195 return retVal; 196 } finally { 197 endRequest(theServletRequest); 198 } 199 } 200 201}