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