
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 ScheduleResourceProvider extends 022 JpaResourceProviderDstu2<Schedule> 023 { 024 025 @Override 026 public Class<Schedule> getResourceType() { 027 return Schedule.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="The individual(HealthcareService, Practitioner, Location, ...) to find a Schedule for") 077 @OptionalParam(name="actor", targetTypes={ } ) 078 ReferenceAndListParam theActor, 079 080 081 @Description(shortDefinition="Search for Schedule resources that have a period that contains this date specified") 082 @OptionalParam(name="date") 083 DateRangeParam theDate, 084 085 086 @Description(shortDefinition="A Schedule Identifier") 087 @OptionalParam(name="identifier") 088 TokenAndListParam theIdentifier, 089 090 091 @Description(shortDefinition="The type of appointments that can be booked into associated slot(s)") 092 @OptionalParam(name="type") 093 TokenAndListParam theType, 094 095 @RawParam 096 Map<String, List<String>> theAdditionalRawParams, 097 098 @Description(shortDefinition="Only return resources which were last updated as specified by the given range") 099 @OptionalParam(name="_lastUpdated") 100 DateRangeParam theLastUpdated, 101 102 @IncludeParam 103 Set<Include> theIncludes, 104 105 @IncludeParam(reverse=true) 106 Set<Include> theRevIncludes, 107 108 @Sort 109 SortSpec theSort, 110 111 @ca.uhn.fhir.rest.annotation.Count 112 Integer theCount, 113 114 @ca.uhn.fhir.rest.annotation.Offset 115 Integer theOffset, 116 117 SummaryEnum theSummaryMode, 118 119 SearchTotalModeEnum theSearchTotalMode, 120 121 SearchContainedModeEnum theSearchContainedMode 122 123 ) { 124 startRequest(theServletRequest); 125 try { 126 SearchParameterMap paramMap = new SearchParameterMap(); 127 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_FILTER, theFtFilter); 128 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent); 129 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText); 130 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag); 131 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity); 132 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile); 133 paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE, theSearchForSource); 134 paramMap.add("_has", theHas); 135 paramMap.add("_id", the_id); 136 paramMap.add("actor", theActor); 137 paramMap.add("date", theDate); 138 paramMap.add("identifier", theIdentifier); 139 paramMap.add("type", theType); 140 paramMap.setRevIncludes(theRevIncludes); 141 paramMap.setLastUpdated(theLastUpdated); 142 paramMap.setIncludes(theIncludes); 143 paramMap.setSort(theSort); 144 paramMap.setCount(theCount); 145 paramMap.setOffset(theOffset); 146 paramMap.setSummaryMode(theSummaryMode); 147 paramMap.setSearchTotalMode(theSearchTotalMode); 148 paramMap.setSearchContainedMode(theSearchContainedMode); 149 150 getDao().translateRawParameters(theAdditionalRawParams, paramMap); 151 152 ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse); 153 return retVal; 154 } finally { 155 endRequest(theServletRequest); 156 } 157 } 158 159}