View Javadoc
1   package ca.uhn.fhir.rest.annotation;
2   
3   /*
4    * #%L
5    * HAPI FHIR - Core Library
6    * %%
7    * Copyright (C) 2014 - 2018 University Health Network
8    * %%
9    * Licensed under the Apache License, Version 2.0 (the "License");
10   * you may not use this file except in compliance with the License.
11   * You may obtain a copy of the License at
12   * 
13   *      http://www.apache.org/licenses/LICENSE-2.0
14   * 
15   * Unless required by applicable law or agreed to in writing, software
16   * distributed under the License is distributed on an "AS IS" BASIS,
17   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18   * See the License for the specific language governing permissions and
19   * limitations under the License.
20   * #L%
21   */
22  import java.lang.annotation.*;
23  
24  import org.hl7.fhir.instance.model.api.IBaseResource;
25  
26  import ca.uhn.fhir.rest.api.ValidationModeEnum;
27  
28  /**
29   * RESTful method annotation to be used for the FHIR
30   * <a href="http://hl7.org/implement/standards/fhir/http.html#validate">validate</a> method.
31   * 
32   * <p>
33   * Validate is used to accept a resource, and test whether it would be acceptable for
34   * storing (e.g. using an update or create method)  
35   * </p>
36   * <p>
37   * <b>FHIR Version Note:</b> The validate operation was defined as a type operation in DSTU1
38   * using a URL syntax like <code>http://example.com/Patient/_validate</code>. In DSTU2, validation
39   * has been switched to being an extended operation using a URL syntax like 
40   * <code>http://example.com/Patient/$validate</code>, with a n 
41   * </p>
42   */
43  @Retention(RetentionPolicy.RUNTIME)
44  @Target(value=ElementType.METHOD)
45  public @interface Validate {
46  
47  	/**
48  	 * The return type for this method. This generally does not need
49  	 * to be populated for a server implementation (using an IResourceProvider, 
50  	 * since resource providers will return only one resource type per class, 
51  	 * but generally does need to be populated for client implementations. 
52  	 */
53  	// NB: Read, Search (maybe others) share this annotation, so update the javadocs everywhere
54  	Class<? extends IBaseResource> type() default IBaseResource.class;
55  	
56  	/**
57  	 * Validation mode parameter annotation for the validation mode parameter (only supported
58  	 * in FHIR DSTU2+). Parameter must be of type {@link ValidationModeEnum}.
59  	 */
60  	@Retention(RetentionPolicy.RUNTIME)
61  	@Target(value=ElementType.PARAMETER)
62  	@interface Mode {
63  		// nothing
64  	}
65  	
66  	/**
67  	 * Validation mode parameter annotation for the validation URI parameter (only supported
68  	 * in FHIR DSTU2+). Parameter must be of type {@link String}.
69  	 */
70  	@Retention(RetentionPolicy.RUNTIME)
71  	@Target(value=ElementType.PARAMETER)
72  	@interface Profile {
73  		// nothing
74  	}
75  
76  }