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.primitive.IdDt;
32  //import ca.uhn.fhir.testmodel.Patient; // TODO: qualify this correctly
33  
34  /**
35   * RESTful method annotation to be used for the FHIR
36   * <a href="http://hl7.org/implement/standards/fhir/http.html#history">history</a> method.
37   * 
38   * <p>
39   * History returns a feed containing all versions (or a selected range of versions) of 
40   * a resource or a specific set of resources.
41   * </p>
42   * <p>
43   * The history command supports three usage patterns, as described in the
44   * <a href="http://hl7.org/implement/standards/fhir/http.html#history">FHIR history</a> documentation:
45   * </p>
46   * <ul>
47   * <li>
48   *   A search for the history of all resources on a server. In this case, {@link #type()} 
49   *   should be set to {@link IResource} (as is the default) and the method should not have an ID parameter.
50   *   <ul><li>
51   *   	To invoke this pattern: <code>GET [base]/_history{?[parameters]&amp;_format=[mime-type]}</code>
52   *   </li></ul>
53   * </li>
54   * <li>
55   *   A search for the history of all instances of a specific resource type on a server. In this case, {@link #type()} 
56   *   should be set to the specific resource type (e.g. <code>Patient.class</code>) and the method should not have an ID parameter.
57   *   <ul><li>
58   *   	To invoke this pattern: <code>GET [base]/[type]/_history{?[parameters]&amp;_format=[mime-type]}</code>
59   *   </li></ul>
60   * </li>
61   * <li>
62   *   A search for the history of a specific instances of a specific resource type on a server. In this case, {@link #type()} 
63   *   should be set to the specific resource type (e.g. <code>Patient.class</code> and the method should 
64   *   have one parameter of type {@link IdDt} annotated with the {@link IdParam} annotation. 
65   *   <ul><li>
66   *   	To invoke this pattern: <code>GET [base]/[type]/[id]/_history{?[parameters]&amp;_format=[mime-type]}</code>
67   *   </li></ul>
68   * </li>
69   * </ul>
70   * 
71   * @see Count
72   * @see Since
73   */
74  @Retention(RetentionPolicy.RUNTIME)
75  @Target(value=ElementType.METHOD)
76  public @interface History {
77  	
78  	/**
79  	 * The resource type that this method applies to. See the {@link History History annotation type documentation}
80  	 * for information on usage patterns.  
81  	 */
82  	Class<? extends IBaseResource> type() default IBaseResource.class;
83  	
84  }