View Javadoc
1   package ca.uhn.fhir.model.api;
2   
3   /*
4    * #%L
5    * HAPI FHIR - Core Library
6    * %%
7    * Copyright (C) 2014 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  
23  import java.util.Map;
24  
25  import ca.uhn.fhir.model.dstu.composite.ContainedDt;
26  import ca.uhn.fhir.model.dstu.composite.NarrativeDt;
27  import ca.uhn.fhir.model.dstu.resource.Patient;
28  import ca.uhn.fhir.model.primitive.CodeDt;
29  import ca.uhn.fhir.model.primitive.IdDt;
30  
31  public interface IResource extends ICompositeElement {
32  
33  	/**
34  	 * Returns the contained resource list for this resource.
35  	 * <p>
36  	 * Usage note: HAPI will generally populate and use the resources from this
37  	 * list automatically (placing inline resources in the contained list when
38  	 * encoding, and copying contained resources from this list to their
39  	 * appropriate references when parsing) so it is generally not neccesary to
40  	 * interact with this list directly. Instead, in a server you can place
41  	 * resource instances in reference fields (such as {@link Patient#setManagingOrganization(ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt)})
42  	 * and the resource will be automatically contained. In a client, contained resources will
43  	 * be automatically populated into their appropriate fields by the HAPI parser.
44  	 * </p>
45  	 * TODO: document contained resources and link there
46  	 */
47  	ContainedDt getContained();
48  
49  	/**
50  	 * Returns the ID of this resource. Note that this identifier is the URL (or a portion
51  	 * of the URL) used to access this resource, and is not the same thing as any business
52  	 * identifiers stored within the resource. For example, a Patient resource might
53  	 * have any number of medical record numbers but these are not stored here.
54  	 * <p>
55  	 * This ID is specified as the "Logical ID" and "Version ID" in the FHIR specification, see 
56  	 * <a href="http://www.hl7.org/implement/standards/fhir/resources.html#metadata">here</a>
57  	 * </p>
58  	 */
59  	IdDt getId();
60  
61  	/**
62  	 * Gets the language of the resource itself - <b>NOTE that this language attribute
63  	 * applies to the resource itself, it is not (for example) the language spoken by
64  	 * a practitioner or patient</b>
65  	 */
66  	CodeDt getLanguage();
67  
68  	/**
69  	 * Returns the metadata map for this object, creating it if neccesary.
70  	 * Metadata entries are used to get/set feed bundle entries, such as the
71  	 * resource version, or the last updated timestamp.
72  	 * <p>
73  	 * Keys in this map are enumerated in the {@link ResourceMetadataKeyEnum},
74  	 * and each key has a specific value type that it must use.
75  	 * </p>
76  	 * 
77  	 * @see ResourceMetadataKeyEnum for a list of allowable keys and the object
78  	 *      types that values of a given key must use.
79  	 */
80  	Map<ResourceMetadataKeyEnum<?>, Object> getResourceMetadata();
81  
82  	/**
83  	 * Returns the narrative block for this resource
84  	 */
85  	NarrativeDt getText();
86  	
87  	/**
88  	 * Sets the ID of this resource. Note that this identifier is the URL (or a portion
89  	 * of the URL) used to access this resource, and is not the same thing as any business
90  	 * identifiers stored within the resource. For example, a Patient resource might
91  	 * have any number of medical record numbers but these are not stored here.
92  	 * <p>
93  	 * This ID is specified as the "Logical ID" and "Version ID" in the FHIR specification, see 
94  	 * <a href="http://www.hl7.org/implement/standards/fhir/resources.html#metadata">here</a>
95  	 * </p>
96  	 */
97  	void setId(IdDt theId);
98  
99  	/**
100 	 * Sets the language of the resource itself - <b>NOTE that this language attribute
101 	 * applies to the resource itself, it is not (for example) the language spoken by
102 	 * a practitioner or patient</b>
103 	 */
104 	void setLanguage(CodeDt theLanguage);
105 
106 	/**
107 	 * Sets the metadata map for this object. Metadata entries are used to
108 	 * get/set feed bundle entries, such as the resource version, or the last
109 	 * updated timestamp.
110 	 * 
111 	 * @throws NullPointerException
112 	 *             The map must not be null
113 	 */
114 	void setResourceMetadata(Map<ResourceMetadataKeyEnum<?>, Object> theMap);
115 	
116 }