001package ca.uhn.fhir.rest.annotation;
002
003/*
004 * #%L
005 * HAPI FHIR - Core Library
006 * %%
007 * Copyright (C) 2014 - 2021 Smile CDR, Inc.
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.api.TagList;
032import ca.uhn.fhir.model.primitive.IdDt;
033
034/**
035 * RESTful method annotation to be used for the FHIR <a
036 * href="http://hl7.org/implement/standards/fhir/http.html#tags">Tag
037 * Operations</a> which have to do with deleting tags.
038 * <ul>
039 * <li>
040 * To delete tag(s) <b>to the given resource
041 * instance</b>, this annotation should contain a {@link #type()} attribute
042 * specifying the resource type, and the method should have a parameter of type
043 * {@link IdDt} annotated with the {@link IdParam} annotation, as well as 
044 * a parameter of type {@link TagList} which will contain the list of tags
045 * to be deleted.
046 * Note that for a
047 * server implementation, the {@link #type()} annotation is optional if the
048 * method is defined in a <a href=
049 * "https://hapifhir.io/hapi-fhir/docs/server_plain/resource_providers.html"
050 * >resource provider</a>, since the type is implied.</li>
051 * <li>
052 * To delete tag(s) on the server <b>to the given version of the
053 * resource instance</b>, this annotation should contain a {@link #type()}
054 * attribute specifying the resource type, and the method should have a
055 * parameter of type {@link IdDt} annotated with the {@link VersionIdParam}
056 * annotation, <b>and</b> a parameter of type {@link IdDt} annotated with the
057 * {@link IdParam} annotation, as well as 
058 * a parameter of type {@link TagList} which will contain the list of tags
059 * to be deleted.
060 * Note that for a server implementation, the
061 * {@link #type()} annotation is optional if the method is defined in a <a href=
062 * "https://hapifhir.io/hapi-fhir/docs/server_plain/resource_providers.html"
063 * >resource provider</a>, since the type is implied.</li>
064 * </ul>
065 */
066@Target(value= ElementType.METHOD)
067@Retention(value=RetentionPolicy.RUNTIME)
068public @interface DeleteTags {
069
070        /**
071         * If set to a type other than the default (which is {@link IResource}
072         * , this method is expected to return a TagList containing only tags which
073         * are specific to the given resource type.
074         */
075        Class<? extends IBaseResource> type() default IBaseResource.class;
076
077        /**
078         * This method allows the return type for this method to be specified in a
079         * non-type-specific way, using the text name of the resource, e.g. "Patient".
080         *
081         * This attribute should be populate, or {@link #type()} should be, but not both.
082         *
083         * @since 5.4.0
084         */
085        String typeName() default "";
086
087}