public static void main(String[] args) throws Exception { FhirContext ctx = FhirContext.forDstu2(); String fileName = "src/main/resources/vs/dstu2/all-valuesets-bundle.xml"; FileReader fr = new FileReader(fileName); Bundle b = ctx.newXmlParser().parseResource(Bundle.class, fr); for (Entry nextEntry : b.getEntry()) { BaseResource nextRes = (BaseResource) nextEntry.getResource(); nextRes.setText(new NarrativeDt()); } File f = new File(fileName); OutputStreamWriter fw = new OutputStreamWriter(new FileOutputStream(f, false), "UTF-8"); ctx.newXmlParser().encodeResourceToWriter(b, fw); fw.close(); ourLog.info("Fixed {} valuesets", b.getEntry().size()); }
@Override public NarrativeDt getText() { if (myText == null) { myText = new NarrativeDt(); } return myText; }
/** * Gets the value(s) for <b>text</b> (). * creating it if it does * not exist. Will not return <code>null</code>. * * <p> * <b>Definition:</b> * A human-readable narrative that contains the attested content of the section, used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it \"clinically safe\" for a human to just read the narrative. * </p> */ public NarrativeDt getText() { if (myText == null) { myText = new NarrativeDt(); } return myText; }