View Javadoc
1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  
17  package ca.uhn.fhir.model.dstu.composite;
18  
19  /*
20   * #%L
21   * HAPI FHIR - Core Library
22   * %%
23   * Copyright (C) 2014 University Health Network
24   * %%
25   * Licensed under the Apache License, Version 2.0 (the "License");
26   * you may not use this file except in compliance with the License.
27   * You may obtain a copy of the License at
28   * 
29   *      http://www.apache.org/licenses/LICENSE-2.0
30   * 
31   * Unless required by applicable law or agreed to in writing, software
32   * distributed under the License is distributed on an "AS IS" BASIS,
33   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34   * See the License for the specific language governing permissions and
35   * limitations under the License.
36   * #L%
37   */
38  
39  import java.util.List;
40  
41  import ca.uhn.fhir.model.api.BaseIdentifiableElement;
42  import ca.uhn.fhir.model.api.ICompositeDatatype;
43  import ca.uhn.fhir.model.api.IElement;
44  import ca.uhn.fhir.model.api.annotation.Child;
45  import ca.uhn.fhir.model.api.annotation.DatatypeDef;
46  import ca.uhn.fhir.model.dstu.valueset.NarrativeStatusEnum;
47  import ca.uhn.fhir.model.primitive.BoundCodeDt;
48  import ca.uhn.fhir.model.primitive.CodeDt;
49  import ca.uhn.fhir.model.primitive.XhtmlDt;
50  
51  /**
52   * HAPI/FHIR <b>Narrative</b> Datatype
53   * (A human-readable formatted text, including images)
54   *
55   * <p>
56   * <b>Definition:</b>
57   * A human-readable formatted text, including images
58   * </p> 
59   *
60   * <p>
61   * <b>Requirements:</b>
62   * 
63   * </p> 
64   */
65  @DatatypeDef(name="Narrative") 
66  public class NarrativeDt extends BaseIdentifiableElement implements ICompositeDatatype {
67  
68  	@Child(name="status", type=CodeDt.class, order=0, min=1, max=1)	
69  	private BoundCodeDt<NarrativeStatusEnum> myStatus;
70  	
71  	@Child(name="div", type=XhtmlDt.class, order=1, min=1, max=1)	
72  	private XhtmlDt myDiv;
73  	
74  	public NarrativeDt() {
75  		// nothing
76  	}
77  	
78  	public NarrativeDt(XhtmlDt theDiv, NarrativeStatusEnum theStatus) {
79  		setDiv(theDiv);
80  		setStatus(theStatus);
81  	}
82  
83  	@Override
84  	public boolean isEmpty() {
85  		return ca.uhn.fhir.util.ElementUtil.isEmpty(  myStatus, myDiv );
86  	}
87  
88  	
89  	@Override
90  	public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
91  		return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements( theType, myStatus, myDiv );
92  	}
93  
94  	/**
95  	 * Gets the value(s) for <b>status</b> (generated | extensions | additional).
96  	 * creating it if it does
97  	 * not exist. Will not return <code>null</code>.
98  	 *
99       * <p>
100      * <b>Definition:</b>
101      * The status of the narrative - whether it's entirely generated (from just the defined data or the extensions too), or whether a human authored it and it may contain additional data
102      * </p> 
103 	 */
104 	public BoundCodeDt<NarrativeStatusEnum> getStatus() {  
105 		if (myStatus == null) {
106 			myStatus = new BoundCodeDt<NarrativeStatusEnum>(NarrativeStatusEnum.VALUESET_BINDER);
107 		}
108 		return myStatus;
109 	}
110 
111 	/**
112 	 * Sets the value(s) for <b>status</b> (generated | extensions | additional)
113 	 *
114      * <p>
115      * <b>Definition:</b>
116      * The status of the narrative - whether it's entirely generated (from just the defined data or the extensions too), or whether a human authored it and it may contain additional data
117      * </p> 
118 	 */
119 	public void setStatus(BoundCodeDt<NarrativeStatusEnum> theValue) {
120 		myStatus = theValue;
121 	}
122 
123 	/**
124 	 * Sets the value(s) for <b>status</b> (generated | extensions | additional)
125 	 *
126      * <p>
127      * <b>Definition:</b>
128      * The status of the narrative - whether it's entirely generated (from just the defined data or the extensions too), or whether a human authored it and it may contain additional data
129      * </p> 
130 	 */
131 	public void setStatus(NarrativeStatusEnum theValue) {
132 		getStatus().setValueAsEnum(theValue);
133 	}
134 
135   
136 	/**
137 	 * Gets the value(s) for <b>div</b> (Limited xhtml content).
138 	 * creating it if it does
139 	 * not exist. Will not return <code>null</code>.
140 	 *
141      * <p>
142      * <b>Definition:</b>
143      * The actual narrative content, a stripped down version of XHTML
144      * </p> 
145 	 */
146 	public XhtmlDt getDiv() {  
147 		if (myDiv == null) {
148 			myDiv = new XhtmlDt();
149 		}
150 		return myDiv;
151 	}
152 
153 	/**
154 	 * Sets the value(s) for <b>div</b> (Limited xhtml content)
155 	 *
156      * <p>
157      * <b>Definition:</b>
158      * The actual narrative content, a stripped down version of XHTML
159      * </p> 
160 	 */
161 	public void setDiv(XhtmlDt theValue) {
162 		myDiv = theValue;
163 	}
164 
165 	/**
166 	 * Sets the value using a textual DIV (or simple text block which will be
167 	 * converted to XHTML)
168 	 */
169 	public void setDiv(String theTextDiv) {
170 		myDiv = new XhtmlDt(theTextDiv);
171 	}
172 
173 
174 
175 
176 }