001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017package ca.uhn.fhir.model.dstu2.composite;
018
019/*
020 * #%L
021 * HAPI FHIR Structures - DSTU2 (FHIR v1.0.0)
022 * %%
023 * Copyright (C) 2014 - 2016 University Health Network
024 * %%
025 * Licensed under the Apache License, Version 2.0 (the "License");
026 * you may not use this file except in compliance with the License.
027 * You may obtain a copy of the License at
028 * 
029 *      http://www.apache.org/licenses/LICENSE-2.0
030 * 
031 * Unless required by applicable law or agreed to in writing, software
032 * distributed under the License is distributed on an "AS IS" BASIS,
033 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
034 * See the License for the specific language governing permissions and
035 * limitations under the License.
036 * #L%
037 */
038
039import java.util.List;
040
041import ca.uhn.fhir.model.api.IElement;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.DatatypeDef;
044import ca.uhn.fhir.model.base.composite.BaseNarrativeDt;
045import ca.uhn.fhir.model.dstu2.valueset.NarrativeStatusEnum;
046import ca.uhn.fhir.model.primitive.BoundCodeDt;
047import ca.uhn.fhir.model.primitive.CodeDt;
048import ca.uhn.fhir.model.primitive.XhtmlDt;
049
050/**
051 * HAPI/FHIR <b>Narrative</b> Datatype
052 * (A human-readable formatted text, including images)
053 *
054 * <p>
055 * <b>Definition:</b>
056 * A human-readable formatted text, including images
057 * </p> 
058 *
059 * <p>
060 * <b>Requirements:</b>
061 * 
062 * </p> 
063 */
064@DatatypeDef(name="Narrative") 
065public class NarrativeDt extends BaseNarrativeDt {
066
067        @Child(name="status", type=CodeDt.class, order=0, min=1, max=1) 
068        private BoundCodeDt<NarrativeStatusEnum> myStatus;
069        
070        @Child(name="div", type=XhtmlDt.class, order=1, min=1, max=1)   
071        private XhtmlDt myDiv;
072        
073        public NarrativeDt() {
074                // nothing
075        }
076        
077        public NarrativeDt(XhtmlDt theDiv, NarrativeStatusEnum theStatus) {
078                setDiv(theDiv);
079                setStatus(theStatus);
080        }
081
082        @Override
083        public boolean isEmpty() {
084                return ca.uhn.fhir.util.ElementUtil.isEmpty(  myStatus, myDiv );
085        }
086
087        
088        @Override
089        public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
090                return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements( theType, myStatus, myDiv );
091        }
092
093        /**
094         * Gets the value(s) for <b>status</b> (generated | extensions | additional).
095         * creating it if it does
096         * not exist. Will not return <code>null</code>.
097         *
098     * <p>
099     * <b>Definition:</b>
100     * 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
101     * </p> 
102         */
103        public BoundCodeDt<NarrativeStatusEnum> getStatusElement() {
104                return getStatus();
105        }
106        
107        /**
108         * Gets the value(s) for <b>status</b> (generated | extensions | additional).
109         * creating it if it does
110         * not exist. Will not return <code>null</code>.
111         *
112     * <p>
113     * <b>Definition:</b>
114     * 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
115     * </p> 
116         */
117        public BoundCodeDt<NarrativeStatusEnum> getStatus() {  
118                if (myStatus == null) {
119                        myStatus = new BoundCodeDt<NarrativeStatusEnum>(NarrativeStatusEnum.VALUESET_BINDER);
120                }
121                return myStatus;
122        }
123
124        /**
125         * Sets the value(s) for <b>status</b> (generated | extensions | additional)
126         *
127     * <p>
128     * <b>Definition:</b>
129     * 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
130     * </p> 
131         */
132        public void setStatus(BoundCodeDt<NarrativeStatusEnum> theValue) {
133                myStatus = theValue;
134        }
135
136        /**
137         * Sets the value(s) for <b>status</b> (generated | extensions | additional)
138         *
139     * <p>
140     * <b>Definition:</b>
141     * 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
142     * </p> 
143         */
144        public void setStatus(NarrativeStatusEnum theValue) {
145                getStatus().setValueAsEnum(theValue);
146        }
147
148  
149        /**
150         * Gets the value(s) for <b>div</b> (Limited xhtml content).
151         * creating it if it does
152         * not exist. Will not return <code>null</code>.
153         *
154     * <p>
155     * <b>Definition:</b>
156     * The actual narrative content, a stripped down version of XHTML
157     * </p> 
158         */
159        public XhtmlDt getDivElement() {
160                return getDiv();
161        }
162        
163        /**
164         * Gets the value(s) for <b>div</b> (Limited xhtml content).
165         * creating it if it does
166         * not exist. Will not return <code>null</code>.
167         *
168     * <p>
169     * <b>Definition:</b>
170     * The actual narrative content, a stripped down version of XHTML
171     * </p> 
172         */
173        public XhtmlDt getDiv() {  
174                if (myDiv == null) {
175                        myDiv = new XhtmlDt();
176                }
177                return myDiv;
178        }
179
180        /**
181         * Sets the value(s) for <b>div</b> (Limited xhtml content)
182         *
183     * <p>
184     * <b>Definition:</b>
185     * The actual narrative content, a stripped down version of XHTML
186     * </p> 
187         */
188        public void setDiv(XhtmlDt theValue) {
189                myDiv = theValue;
190        }
191
192        /**
193         * Sets the value using a textual DIV (or simple text block which will be
194         * converted to XHTML)
195         */
196        public void setDiv(String theTextDiv) {
197                myDiv = new XhtmlDt(theTextDiv);
198        }
199
200
201
202
203}