View Javadoc
1   
2   package ca.uhn.fhir.jpa.rp.dstu3;
3   
4   import java.util.*;
5   
6   import org.apache.commons.lang3.StringUtils;
7   
8   import ca.uhn.fhir.jpa.provider.dstu3.*;
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 org.hl7.fhir.dstu3.model.*;
13  import ca.uhn.fhir.rest.annotation.*;
14  import ca.uhn.fhir.rest.param.*;
15  import ca.uhn.fhir.rest.api.SortSpec;
16  
17  public class SequenceResourceProvider extends 
18  	JpaResourceProviderDstu3<Sequence>
19  	{
20  
21  	@Override
22  	public Class<Sequence> getResourceType() {
23  		return Sequence.class;
24  	}
25  
26  	@Search(allowUnknownParams=true)
27  	public ca.uhn.fhir.rest.api.server.IBundleProvider search(
28  			javax.servlet.http.HttpServletRequest theServletRequest,
29  			javax.servlet.http.HttpServletResponse theServletResponse,
30  
31  			ca.uhn.fhir.rest.api.server.RequestDetails theRequestDetails,
32  			
33  			@Description(shortDefinition="Search the contents of the resource's data using a fulltext search")
34  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT)
35  			StringAndListParam theFtContent, 
36  
37  			@Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search")
38  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TEXT)
39  			StringAndListParam theFtText, 
40  
41  			@Description(shortDefinition="Search for resources which have the given tag")
42  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_TAG)
43  			TokenAndListParam theSearchForTag, 
44  
45  			@Description(shortDefinition="Search for resources which have the given security labels")
46  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY)
47  			TokenAndListParam theSearchForSecurity, 
48    
49  			@Description(shortDefinition="Search for resources which have the given profile")
50  			@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE)
51  			UriAndListParam theSearchForProfile, 
52  
53  			@Description(shortDefinition="Return resources linked to by the given target")
54  			@OptionalParam(name="_has")
55  			HasAndListParam theHas, 
56  
57    
58  			@Description(shortDefinition="The ID of the resource")
59  			@OptionalParam(name="_id")
60  			TokenAndListParam the_id, 
61    
62  			@Description(shortDefinition="The language of the resource")
63  			@OptionalParam(name="_language")
64  			StringAndListParam the_language, 
65    
66  			@Description(shortDefinition="Chromosome number of the reference sequence")
67  			@OptionalParam(name="chromosome")
68  			TokenAndListParam theChromosome, 
69    
70  			@Description(shortDefinition="Search parameter for region of the reference DNA sequence string. This will refer to part of a locus or part of a gene where search region will be represented in 1-based system. Since the coordinateSystem can either be 0-based or 1-based, this search query will include the result of both coordinateSystem that contains the equivalent segment of the gene or whole genome sequence. For example, a search for sequence can be represented as `coordinate=1$lt345$gt123`, this means it will search for the Sequence resource on chromosome 1 and with position >123 and <345, where in 1-based system resource, all strings within region 1:124-344 will be revealed, while in 0-based system resource, all strings within region 1:123-344 will be revealed. You may want to check detail about 0-based v.s. 1-based above.")
71  			@OptionalParam(name="coordinate", compositeTypes= { TokenParam.class, NumberParam.class })
72  			CompositeAndListParam<TokenParam, NumberParam> theCoordinate,
73    
74  			@Description(shortDefinition="End position (0-based exclusive, which menas the acid at this position will not be included, 1-based inclusive, which means the acid at this position will be included) of the reference sequence.")
75  			@OptionalParam(name="end")
76  			NumberAndListParam theEnd, 
77    
78  			@Description(shortDefinition="The unique identity for a particular sequence")
79  			@OptionalParam(name="identifier")
80  			TokenAndListParam theIdentifier, 
81    
82  			@Description(shortDefinition="The subject that the observation is about")
83  			@OptionalParam(name="patient", targetTypes={  } )
84  			ReferenceAndListParam thePatient, 
85    
86  			@Description(shortDefinition="Start position (0-based inclusive, 1-based inclusive, that means the nucleic acid or amino acid at this position will be included) of the reference sequence.")
87  			@OptionalParam(name="start")
88  			NumberAndListParam theStart, 
89    
90  			@Description(shortDefinition="Amino Acid Sequence/ DNA Sequence / RNA Sequence")
91  			@OptionalParam(name="type")
92  			TokenAndListParam theType, 
93  
94  			@RawParam
95  			Map<String, List<String>> theAdditionalRawParams,
96  
97  			@IncludeParam(reverse=true)
98  			Set<Include> theRevIncludes,
99  			@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
100 			@OptionalParam(name="_lastUpdated")
101 			DateRangeParam theLastUpdated, 
102 
103 			@IncludeParam(allow= {
104 					"Sequence:patient" 					, "*"
105 			}) 
106 			Set<Include> theIncludes,
107 			
108 			@Sort 
109 			SortSpec theSort,
110 			
111 			@ca.uhn.fhir.rest.annotation.Count
112 			Integer theCount
113 	) {
114 		startRequest(theServletRequest);
115 		try {
116 			SearchParameterMap paramMap = new SearchParameterMap();
117 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_CONTENT, theFtContent);
118 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TEXT, theFtText);
119 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_TAG, theSearchForTag);
120 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
121 			paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
122 			paramMap.add("_has", theHas);
123 			paramMap.add("_id", the_id);
124 			paramMap.add("_language", the_language);
125 			paramMap.add("chromosome", theChromosome);
126 			paramMap.add("coordinate", theCoordinate);
127 			paramMap.add("end", theEnd);
128 			paramMap.add("identifier", theIdentifier);
129 			paramMap.add("patient", thePatient);
130 			paramMap.add("start", theStart);
131 			paramMap.add("type", theType);
132 			paramMap.setRevIncludes(theRevIncludes);
133 			paramMap.setLastUpdated(theLastUpdated);
134 			paramMap.setIncludes(theIncludes);
135 			paramMap.setSort(theSort);
136 			paramMap.setCount(theCount);
137 
138 			getDao().translateRawParameters(theAdditionalRawParams, paramMap);
139 
140 			ca.uhn.fhir.rest.api.server.IBundleProvider retVal = getDao().search(paramMap, theRequestDetails, theServletResponse);
141 			return retVal;
142 		} finally {
143 			endRequest(theServletRequest);
144 		}
145 	}
146 
147 }