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; 006 007public abstract class BaseNarrative extends Type implements INarrative { 008 009 /** 010 * Sets the value of 011 * 012 * @param theString 013 * @throws Exception 014 */ 015 public void setDivAsString(String theString) { 016 XhtmlNode div; 017 if (StringUtils.isNotBlank(theString)) { 018 div = new XhtmlNode(); 019 div.setValueAsString(theString); 020 } else { 021 div = null; 022 } 023 setDiv(div); 024 } 025 026 protected abstract BaseNarrative setDiv(XhtmlNode theDiv); 027 028 public String getDivAsString() { 029 XhtmlNode div = getDiv(); 030 if (div != null && !div.isEmpty()) { 031 return div.getValueAsString(); 032 } else { 033 return null; 034 } 035 } 036 037 protected abstract XhtmlNode getDiv(); 038 039 public abstract Enumeration<?> getStatusElement(); 040 041 public INarrative setStatusAsString(String theString) { 042 getStatusElement().setValueAsString(theString); 043 return this; 044 } 045 046 public String getStatusAsString() { 047 return getStatusElement().getValueAsString(); 048 } 049 050}