View Javadoc
1   package ca.uhn.fhir.rest.annotation;
2   
3   /*
4    * #%L
5    * HAPI FHIR - Core Library
6    * %%
7    * Copyright (C) 2014 - 2018 University Health Network
8    * %%
9    * Licensed under the Apache License, Version 2.0 (the "License");
10   * you may not use this file except in compliance with the License.
11   * You may obtain a copy of the License at
12   * 
13   *      http://www.apache.org/licenses/LICENSE-2.0
14   * 
15   * Unless required by applicable law or agreed to in writing, software
16   * distributed under the License is distributed on an "AS IS" BASIS,
17   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18   * See the License for the specific language governing permissions and
19   * limitations under the License.
20   * #L%
21   */
22  
23  import java.lang.annotation.ElementType;
24  import java.lang.annotation.Retention;
25  import java.lang.annotation.RetentionPolicy;
26  import java.lang.annotation.Target;
27  
28  import ca.uhn.fhir.model.api.Include;
29  
30  /**
31   * Method parameter which is used to indicate a parameter that will
32   * be populated with the "_include" (or "_revinclude") values for a search param.
33   * The parameter annotated with this annotation is used for either "_include"
34   * or "_revinclude", depending on whether {@link #reverse()} has been
35   * set to <code>true</code> (default is <code>false</code>).
36   * 
37   * <p>
38   * Only up to two parameters may be annotated with this annotation (one each
39   * for <code>reverse=false</code> and <code>reverse=true</code>. That
40   * parameter should be one of the following:
41   * </p> 
42   * <ul>
43   * <li><code>Collection&lt;Include&gt;</code></li> 
44   * <li><code>List&lt;Include&gt;</code></li> 
45   * <li><code>Set&lt;Include&gt;</code></li> 
46   * </ul>
47   * 
48   * @see Include
49   */
50  @Retention(RetentionPolicy.RUNTIME)
51  @Target(value= {ElementType.PARAMETER})
52  public @interface IncludeParam {
53  
54  	/**
55  	 * Optional value, if provided the server will only allow the values
56  	 * within the given set. If an _include parameter is passed to the server
57  	 * which does not match any allowed values the server will return an error.
58  	 * <p>
59  	 * Values for this parameter take the form that the FHIR specification
60  	 * defines for <code>_include</code> values, namely <code>[Resource Name].[path]</code>.
61  	 * For example: <code>"Patient.link.other"</code>
62  	 * or <code>"Encounter.partOf"</code> 
63  	 * </p>
64  	 * <p>
65  	 * You may also pass in a value of "*" which indicates means that the
66  	 * client may request <code>_include=*</code>. This is a request to 
67  	 * include all referenced resources as well as any resources referenced
68  	 * by those resources, etc.
69  	 * </p>
70  	 * <p>
71  	 * Leave this parameter empty if you do not want the server to declare or
72  	 * restrict which includes are allowable. In this case, the client may add
73  	 * any _include value they want, and that value will be accepted by the server
74  	 * and passed to the handling method. Note that this means that the server 
75  	 * will not declare which _include values it supports in its conformance
76  	 * statement.
77  	 * </p> 
78  	 */
79  	String[] allow() default {};
80  	
81  	/**
82  	 * If set to <code>true</code> (default is <code>false</code>), the values
83  	 * for this parameter correspond to the <code>_revinclude<code> parameter
84  	 * instead of the <code>_include<code> parameter.
85  	 */
86  	boolean reverse() default false;
87  	
88  }