001package org.hl7.fhir.r4.model;
002
003import org.apache.commons.lang3.StringUtils;
004import org.hl7.fhir.instance.model.api.INarrative;
005import org.hl7.fhir.utilities.xhtml.XhtmlNode;
006import org.hl7.fhir.utilities.xhtml.NodeType;
007
008public abstract class BaseNarrative extends Type implements INarrative {
009
010        /**
011         * Sets the value of
012         *
013         * @param theString
014         * @throws Exception
015         */
016        public void setDivAsString(String theString) {
017                XhtmlNode div;
018                if (StringUtils.isNotBlank(theString)) {
019                        div = new XhtmlNode(NodeType.Element, "div");
020                        div.setValueAsString(theString);
021                } else {
022                        div = null;
023                }
024                setDiv(div);
025        }
026
027        protected abstract BaseNarrative setDiv(XhtmlNode theDiv);
028
029        public String getDivAsString() {
030                XhtmlNode div = getDiv();
031                if (div != null && !div.isEmpty()) {
032                        return div.getValueAsString();
033                } else {
034                        return null;
035                }
036        }
037
038        protected abstract XhtmlNode getDiv();
039
040   public abstract Enumeration<?> getStatusElement();
041
042        public INarrative setStatusAsString(String theString) {
043                getStatusElement().setValueAsString(theString);
044                return this;
045        }
046
047        public String getStatusAsString() {
048                return getStatusElement().getValueAsString();
049        } 
050
051}