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.rest.api.ValidationModeEnum; 030import ca.uhn.fhir.rest.server.IResourceProvider; 031 032/** 033 * RESTful method annotation to be used for the FHIR 034 * <a href="http://hl7.org/implement/standards/fhir/http.html#validate">validate</a> method. 035 * 036 * <p> 037 * Validate is used to accept a resource, and test whether it would be acceptable for 038 * storing (e.g. using an update or create method) 039 * </p> 040 * <p> 041 * <b>FHIR Version Note:</b> The validate operation was defined as a type operation in DSTU1 042 * using a URL syntax like <code>http://example.com/Patient/_validate</code>. In DSTU2, validation 043 * has been switched to being an extended operation using a URL syntax like 044 * <code>http://example.com/Patient/$validate</code>, with a n 045 * </p> 046 */ 047@Retention(RetentionPolicy.RUNTIME) 048@Target(value=ElementType.METHOD) 049public @interface Validate { 050 051 /** 052 * The return type for this method. This generally does not need 053 * to be populated for a server implementation (using a {@link IResourceProvider}, 054 * since resource providers will return only one resource type per class, 055 * but generally does need to be populated for client implementations. 056 */ 057 // NB: Read, Search (maybe others) share this annotation, so update the javadocs everywhere 058 Class<? extends IResource> type() default IResource.class; 059 060 /** 061 * Validation mode parameter annotation for the validation mode parameter (only supported 062 * in FHIR DSTU2+). Parameter must be of type {@link ValidationModeEnum}. 063 */ 064 @Retention(RetentionPolicy.RUNTIME) 065 @Target(value=ElementType.PARAMETER) 066 @interface Mode { 067 // nothing 068 } 069 070 /** 071 * Validation mode parameter annotation for the validation URI parameter (only supported 072 * in FHIR DSTU2+). Parameter must be of type {@link String}. 073 */ 074 @Retention(RetentionPolicy.RUNTIME) 075 @Target(value=ElementType.PARAMETER) 076 @interface Profile { 077 // nothing 078 } 079 080}