ca.uhn.fhir.model.dstu2.composite.NarrativeDt Maven / Gradle / Ivy
/*
* #%L
* HAPI FHIR Structures - DSTU2 (FHIR v1.0.0)
* %%
* Copyright (C) 2014 - 2024 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
package ca.uhn.fhir.model.dstu2.composite;
import ca.uhn.fhir.model.api.IElement;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.base.composite.BaseNarrativeDt;
import ca.uhn.fhir.model.dstu2.valueset.NarrativeStatusEnum;
import ca.uhn.fhir.model.primitive.BoundCodeDt;
import ca.uhn.fhir.model.primitive.CodeDt;
import ca.uhn.fhir.model.primitive.XhtmlDt;
import java.util.List;
/**
* HAPI/FHIR Narrative Datatype
* (A human-readable formatted text, including images)
*
*
* Definition:
* A human-readable formatted text, including images
*
*
*
* Requirements:
*
*
*/
@DatatypeDef(name = "Narrative")
public class NarrativeDt extends BaseNarrativeDt {
@Child(name = "status", type = CodeDt.class, order = 0, min = 1, max = 1)
private BoundCodeDt myStatus;
@Child(name = "div", type = XhtmlDt.class, order = 1, min = 1, max = 1)
private XhtmlDt myDiv;
public NarrativeDt() {
// nothing
}
public NarrativeDt(XhtmlDt theDiv, NarrativeStatusEnum theStatus) {
setDiv(theDiv);
setStatus(theStatus);
}
@Override
public boolean isEmpty() {
return ca.uhn.fhir.util.ElementUtil.isEmpty(myStatus, myDiv);
}
@Override
public List getAllPopulatedChildElementsOfType(Class theType) {
return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myStatus, myDiv);
}
/**
* Gets the value(s) for status (generated | extensions | additional).
* creating it if it does
* not exist. Will not return null
.
*
*
* Definition:
* 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
*
*/
public BoundCodeDt getStatusElement() {
return getStatus();
}
/**
* Gets the value(s) for status (generated | extensions | additional).
* creating it if it does
* not exist. Will not return null
.
*
*
* Definition:
* 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
*
*/
@Override
public BoundCodeDt getStatus() {
if (myStatus == null) {
myStatus = new BoundCodeDt(NarrativeStatusEnum.VALUESET_BINDER);
}
return myStatus;
}
/**
* Sets the value(s) for status (generated | extensions | additional)
*
*
* Definition:
* 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
*
*/
public void setStatus(BoundCodeDt theValue) {
myStatus = theValue;
}
/**
* Sets the value(s) for status (generated | extensions | additional)
*
*
* Definition:
* 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
*
*/
public void setStatus(NarrativeStatusEnum theValue) {
getStatus().setValueAsEnum(theValue);
}
/**
* Gets the value(s) for div (Limited xhtml content).
* creating it if it does
* not exist. Will not return null
.
*
*
* Definition:
* The actual narrative content, a stripped down version of XHTML
*
*/
public XhtmlDt getDivElement() {
return getDiv();
}
/**
* Gets the value(s) for div (Limited xhtml content).
* creating it if it does
* not exist. Will not return null
.
*
*
* Definition:
* The actual narrative content, a stripped down version of XHTML
*
*/
@Override
public XhtmlDt getDiv() {
if (myDiv == null) {
myDiv = new XhtmlDt();
}
return myDiv;
}
/**
* Sets the value(s) for div (Limited xhtml content)
*
*
* Definition:
* The actual narrative content, a stripped down version of XHTML
*
*/
public void setDiv(XhtmlDt theValue) {
myDiv = theValue;
}
/**
* Sets the value using a textual DIV (or simple text block which will be
* converted to XHTML)
*/
public void setDiv(String theTextDiv) {
myDiv = new XhtmlDt(theTextDiv);
}
}