001package ca.uhn.fhir.rest.annotation; 002 003/* 004 * #%L 005 * HAPI FHIR - Core Library 006 * %% 007 * Copyright (C) 2014 - 2017 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 org.hl7.fhir.instance.model.api.IBaseResource; 029 030import ca.uhn.fhir.model.api.IResource; 031import ca.uhn.fhir.model.primitive.IdDt; 032 033/** 034 * RESTful method annotation to be used for the FHIR <a 035 * href="http://hl7.org/implement/standards/fhir/http.html#tags">Tag 036 * Operations</a> which have to do with getting tags. 037 * <ul> 038 * <li> 039 * To return a global list of all tags on the server, this annotation should not 040 * contain a {@link #type()} attribute, and the method should not have an ID or 041 * Version ID parameter. On server implementations, the method must be defined 042 * in a <a href= 043 * "http://jamesagnew.github.io/hapi-fhir/doc_rest_server.html#plain_providers" 044 * >plain provider</a>.</li> 045 * <li> 046 * To return a list of all tags on the server <b>for the given resource 047 * type</b>, this annotation should contain a {@link #type()} attribute 048 * specifying the resource type, and the method should not have an ID or Version 049 * ID parameter. Note that for a server implementation, the {@link #type()} 050 * annotation is optional if the method is defined in a <a href= 051 * "http://jamesagnew.github.io/hapi-fhir/doc_rest_server.html#resource_providers" 052 * >resource provider</a>, since the type is implied.</li> 053 * <li> 054 * To return a list of all tags on the server <b>for the given resource 055 * instance</b>, this annotation should contain a {@link #type()} attribute 056 * specifying the resource type, and the method should have a parameter of type 057 * {@link IdDt} annotated with the {@link IdParam} annotation. Note that for a 058 * server implementation, the {@link #type()} annotation is optional if the 059 * method is defined in a <a href= 060 * "http://jamesagnew.github.io/hapi-fhir/doc_rest_server.html#resource_providers" 061 * >resource provider</a>, since the type is implied.</li> 062 * <li> 063 * To return a list of all tags on the server <b>for the given version of the 064 * resource instance</b>, this annotation should contain a {@link #type()} 065 * attribute specifying the resource type, and the method should have a 066 * parameter of type {@link IdDt} annotated with the {@link VersionIdParam} 067 * annotation, <b>and</b> a parameter of type {@link IdDt} annotated with the 068 * {@link IdParam} annotation. Note that for a server implementation, the 069 * {@link #type()} annotation is optional if the method is defined in a <a href= 070 * "http://jamesagnew.github.io/hapi-fhir/doc_rest_server.html#resource_providers" 071 * >resource provider</a>, since the type is implied.</li> 072 * </ul> 073 */ 074@Target(value= ElementType.METHOD) 075@Retention(value=RetentionPolicy.RUNTIME) 076public @interface GetTags { 077 078 /** 079 * If set to a type other than the default (which is {@link IResource} 080 * , this method is expected to return a TagList containing only tags which 081 * are specific to the given resource type. 082 */ 083 Class<? extends IBaseResource> type() default IBaseResource.class; 084 085}