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 org.hl7.fhir.instance.model.api.IBaseResource;
29  
30  import ca.uhn.fhir.model.api.IResource;
31  import ca.uhn.fhir.model.api.TagList;
32  import ca.uhn.fhir.model.primitive.IdDt;
33  
34  /**
35   * RESTful method annotation to be used for the FHIR <a
36   * href="http://hl7.org/implement/standards/fhir/http.html#tags">Tag
37   * Operations</a> which have to do with adding tags.
38   * <ul>
39   * <li>
40   * To add tag(s) <b>to the given resource
41   * instance</b>, this annotation should contain a {@link #type()} attribute
42   * specifying the resource type, and the method should have a parameter of type
43   * {@link IdDt} annotated with the {@link IdParam} annotation, as well as 
44   * a parameter of type {@link TagList}. Note that this {@link TagList} parameter
45   * does not need to contain a complete list of tags for the resource, only a list
46   * of tags to be added. Server implementations must not remove tags based on this
47   * operation.
48   * Note that for a
49   * server implementation, the {@link #type()} annotation is optional if the
50   * method is defined in a <a href=
51   * "http://jamesagnew.github.io/hapi-fhir/doc_rest_server.html#resource_providers"
52   * >resource provider</a>, since the type is implied.</li>
53   * <li>
54   * To add tag(s) on the server <b>to the given version of the
55   * resource instance</b>, this annotation should contain a {@link #type()}
56   * attribute specifying the resource type, and the method should have a
57   * parameter of type {@link IdDt} annotated with the {@link VersionIdParam}
58   * annotation, <b>and</b> a parameter of type {@link IdDt} annotated with the
59   * {@link IdParam} annotation, as well as 
60   * a parameter of type {@link TagList}. Note that this {@link TagList} parameter
61   * does not need to contain a complete list of tags for the resource, only a list
62   * of tags to be added. Server implementations must not remove tags based on this
63   * operation.
64   * Note that for a server implementation, the
65   * {@link #type()} annotation is optional if the method is defined in a <a href=
66   * "http://jamesagnew.github.io/hapi-fhir/doc_rest_server.html#resource_providers"
67   * >resource provider</a>, since the type is implied.</li>
68   * </ul>
69   */
70  @Target(value= ElementType.METHOD)
71  @Retention(value=RetentionPolicy.RUNTIME)
72  public @interface AddTags {
73  
74  	/**
75  	 * If set to a type other than the default (which is {@link IResource}
76  	 * , this method is expected to return a TagList containing only tags which
77  	 * are specific to the given resource type.
78  	 */
79  	Class<? extends IBaseResource> type() default IBaseResource.class;
80  
81  }