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 ProcessResponseResourceProvider extends 
022        JpaResourceProviderDstu2<ProcessResponse>
023        {
024
025        @Override
026        public Class<ProcessResponse> getResourceType() {
027                return ProcessResponse.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 business identifier of the Explanation of Benefit")
077                        @OptionalParam(name="identifier")
078                        TokenAndListParam theIdentifier,
079   
080
081                        @Description(shortDefinition="The organization who generated this resource")
082                        @OptionalParam(name="organization", targetTypes={  } )
083                        ReferenceAndListParam theOrganization, 
084   
085
086                        @Description(shortDefinition="The reference to the claim")
087                        @OptionalParam(name="request", targetTypes={  } )
088                        ReferenceAndListParam theRequest, 
089   
090
091                        @Description(shortDefinition="The Organization who is responsible the request transaction")
092                        @OptionalParam(name="requestorganization", targetTypes={  } )
093                        ReferenceAndListParam theRequestorganization, 
094   
095
096                        @Description(shortDefinition="The Provider who is responsible the request transaction")
097                        @OptionalParam(name="requestprovider", targetTypes={  } )
098                        ReferenceAndListParam theRequestprovider, 
099
100                        @RawParam
101                        Map<String, List<String>> theAdditionalRawParams,
102
103                        @Description(shortDefinition="Only return resources which were last updated as specified by the given range")
104                        @OptionalParam(name="_lastUpdated")
105                        DateRangeParam theLastUpdated, 
106
107                        @IncludeParam
108                        Set<Include> theIncludes,
109
110                        @IncludeParam(reverse=true)
111                        Set<Include> theRevIncludes,
112
113                        @Sort
114                        SortSpec theSort,
115                        
116                        @ca.uhn.fhir.rest.annotation.Count
117                        Integer theCount,
118
119                        @ca.uhn.fhir.rest.annotation.Offset
120                        Integer theOffset,
121
122                        SummaryEnum theSummaryMode,
123
124                        SearchTotalModeEnum theSearchTotalMode,
125
126                        SearchContainedModeEnum theSearchContainedMode
127
128                        ) {
129                startRequest(theServletRequest);
130                try {
131                        SearchParameterMap paramMap = new SearchParameterMap();
132                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_FILTER, theFtFilter);
133                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
134                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
135                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
136                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
137                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
138                        paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE, theSearchForSource);
139                        paramMap.add("_has", theHas);
140                        paramMap.add("_id", the_id);
141                        paramMap.add("identifier", theIdentifier);
142                        paramMap.add("organization", theOrganization);
143                        paramMap.add("request", theRequest);
144                        paramMap.add("requestorganization", theRequestorganization);
145                        paramMap.add("requestprovider", theRequestprovider);
146                        paramMap.setRevIncludes(theRevIncludes);
147                        paramMap.setLastUpdated(theLastUpdated);
148                        paramMap.setIncludes(theIncludes);
149                        paramMap.setSort(theSort);
150                        paramMap.setCount(theCount);
151                        paramMap.setOffset(theOffset);
152                        paramMap.setSummaryMode(theSummaryMode);
153                        paramMap.setSearchTotalMode(theSearchTotalMode);
154                        paramMap.setSearchContainedMode(theSearchContainedMode);
155
156                        getDao().translateRawParameters(theAdditionalRawParams, paramMap);
157
158                        ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
159                        return retVal;
160                } finally {
161                        endRequest(theServletRequest);
162                }
163        }
164
165}