001package ca.uhn.fhir.rest.annotation; 002 003/* 004 * #%L 005 * HAPI FHIR - Core Library 006 * %% 007 * Copyright (C) 2014 - 2016 University Health Network 008 * %% 009 * Licensed under the Apache License, Version 2.0 (the "License"); 010 * you may not use this file except in compliance with the License. 011 * You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, software 016 * distributed under the License is distributed on an "AS IS" BASIS, 017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 018 * See the License for the specific language governing permissions and 019 * limitations under the License. 020 * #L% 021 */ 022 023import java.lang.annotation.ElementType; 024import java.lang.annotation.Retention; 025import java.lang.annotation.RetentionPolicy; 026import java.lang.annotation.Target; 027 028import ca.uhn.fhir.model.api.IResource; 029import ca.uhn.fhir.model.primitive.IdDt; 030//import ca.uhn.fhir.testmodel.Patient; // TODO: qualify this correctly 031 032/** 033 * RESTful method annotation to be used for the FHIR 034 * <a href="http://hl7.org/implement/standards/fhir/http.html#history">history</a> method. 035 * 036 * <p> 037 * History returns a feed containing all versions (or a selected range of versions) of 038 * a resource or a specific set of resources. 039 * </p> 040 * <p> 041 * The history command supports three usage patterns, as described in the 042 * <a href="http://hl7.org/implement/standards/fhir/http.html#history">FHIR history</a> documentation: 043 * </p> 044 * <ul> 045 * <li> 046 * A search for the history of all resources on a server. In this case, {@link #type()} 047 * should be set to {@link IResource} (as is the default) and the method should not have an ID parameter. 048 * <ul><li> 049 * To invoke this pattern: <code>GET [base]/_history{?[parameters]&_format=[mime-type]}</code> 050 * </li></ul> 051 * </li> 052 * <li> 053 * A search for the history of all instances of a specific resource type on a server. In this case, {@link #type()} 054 * should be set to the specific resource type (e.g. <code>Patient.class</code>) and the method should not have an ID parameter. 055 * <ul><li> 056 * To invoke this pattern: <code>GET [base]/[type]/_history{?[parameters]&_format=[mime-type]}</code> 057 * </li></ul> 058 * </li> 059 * <li> 060 * A search for the history of a specific instances of a specific resource type on a server. In this case, {@link #type()} 061 * should be set to the specific resource type (e.g. <code>Patient.class</code> and the method should 062 * have one parameter of type {@link IdDt} annotated with the {@link IdParam} annotation. 063 * <ul><li> 064 * To invoke this pattern: <code>GET [base]/[type]/[id]/_history{?[parameters]&_format=[mime-type]}</code> 065 * </li></ul> 066 * </li> 067 * </ul> 068 * 069 * @see Count 070 * @see Since 071 */ 072@Retention(RetentionPolicy.RUNTIME) 073@Target(value=ElementType.METHOD) 074public @interface History { 075 076 /** 077 * The resource type that this method applies to. See the {@link History History annotation type documentation} 078 * for information on usage patterns. 079 */ 080 Class<? extends IResource> type() default IResource.class; 081 082}