private static void copyDomainResource(org.hl7.fhir.dstu3.model.DomainResource src, org.hl7.fhir.dstu2016may.model.DomainResource tgt) throws FHIRException { copyResource(src, tgt); if (src.hasText()) tgt.setText(convertNarrative(src.getText())); for (org.hl7.fhir.dstu3.model.Resource t : src.getContained()) tgt.addContained(convertResource(t)); for (org.hl7.fhir.dstu3.model.Extension t : src.getExtension()) tgt.addExtension(convertExtension(t)); for (org.hl7.fhir.dstu3.model.Extension t : src.getModifierExtension()) tgt.addModifierExtension(convertExtension(t)); } public static org.hl7.fhir.dstu3.model.Parameters convertParameters(org.hl7.fhir.dstu2016may.model.Parameters src) throws FHIRException {
public void copyDomainResource(org.hl7.fhir.instance.model.DomainResource src, org.hl7.fhir.dstu3.model.DomainResource tgt) throws FHIRException { copyResource(src, tgt); tgt.setText(convertNarrative(src.getText())); for (org.hl7.fhir.instance.model.Resource t : src.getContained()) tgt.addContained(convertResource(t)); for (org.hl7.fhir.instance.model.Extension t : src.getExtension()) tgt.addExtension(convertExtension(t)); for (org.hl7.fhir.instance.model.Extension t : src.getModifierExtension()) tgt.addModifierExtension(convertExtension(t)); } public void copyDomainResource(org.hl7.fhir.dstu3.model.DomainResource src, org.hl7.fhir.instance.model.DomainResource tgt) throws FHIRException {
@Override public CustomResource copy() { CustomResource retVal = new CustomResource(); super.copyValues(retVal); retVal.myTelevision = myTelevision; retVal.myDogs = myDogs; return retVal; }
public void copyElement(org.hl7.fhir.dstu3.model.DomainResource src, org.hl7.fhir.instance.model.Element tgt) throws FHIRException { tgt.setId(src.getId()); for (org.hl7.fhir.dstu3.model.Extension e : src.getExtension()) { tgt.addExtension(convertExtension(e)); } }
protected String addReference(DomainResource r, String title, String id) throws Exception { if (r.getText() == null) r.setText(new Narrative()); if (r.getText().getDiv() == null) { r.getText().setStatus(NarrativeStatus.GENERATED); new NarrativeGenerator("", "", context).generate(r); } r.setMeta(new Meta().setLastUpdatedElement(InstantType.now())); r.setId(id); feed.getEntry().add(new BundleEntryComponent().setResource(r)); return id; }
@Override public Base setProperty(String name, Base value) throws FHIRException { if (name.equals("text")) { this.text = castToNarrative(value); // Narrative } else if (name.equals("contained")) { this.getContained().add(castToResource(value)); } else if (name.equals("extension")) { this.getExtension().add(castToExtension(value)); } else if (name.equals("modifierExtension")) { this.getModifierExtension().add(castToExtension(value)); } else return super.setProperty(name, value); return value; }
private ValueSet resolveBindingReference(DomainResource ctxt, Type reference, String uri) { if (reference instanceof UriType) { long t = System.nanoTime(); ValueSet fr = context.fetchResource(ValueSet.class, ((UriType) reference).getValue().toString()); txTime = txTime + (System.nanoTime() - t); return fr; } else if (reference instanceof Reference) { String s = ((Reference) reference).getReference(); if (s.startsWith("#")) { for (Resource c : ctxt.getContained()) { if (c.getId().equals(s.substring(1)) && (c instanceof ValueSet)) return (ValueSet) c; } return null; } else { long t = System.nanoTime(); String ref = ((Reference) reference).getReference(); if (!Utilities.isAbsoluteUrl(ref)) ref = resolve(uri, ref); ValueSet fr = context.fetchResource(ValueSet.class, ref); txTime = txTime + (System.nanoTime() - t); return fr; } } else return null; }
@Override public Base makeProperty(int hash, String name) throws FHIRException { switch (hash) { case 3556653: return getText(); case -410956685: throw new FHIRException("Cannot make property contained as it is not a complex type"); // Resource case -612557761: return addExtension(); case -298878168: return addModifierExtension(); default: return super.makeProperty(hash, name); } }
@Override public Base addChild(String name) throws FHIRException { if (name.equals("issue")) { return addIssue(); } else return super.addChild(name); }
public static List<Extension> getExtensions(DomainResource resource, String url) { List<Extension> results = new ArrayList<Extension>(); for (Extension ex : resource.getExtension()) if (ex.getUrl().equals(url)) results.add(ex); return results; }
@Override public Base addChild(String name) throws FHIRException { if (name.equals("text")) { this.text = new Narrative(); return this.text; } else if (name.equals("contained")) { throw new FHIRException("Cannot call addChild on an abstract type DomainResource.contained"); } else if (name.equals("extension")) { return addExtension(); } else if (name.equals("modifierExtension")) { return addModifierExtension(); } else return super.addChild(name); }
/** * @param name the identity of the extension of interest * @return The extension, if on this element, else null. will check modifier extensions too, if appropriate */ public static Extension getExtension(DomainResource resource, String name) { if (name == null || resource == null || !resource.hasExtension()) return null; for (Extension e : resource.getExtension()) { if (name.equals(e.getUrl())) return e; } return null; }
/** * Returns a list of modifier extensions from this element which have the given URL. Note that * this list may not be modified (you can not add or remove elements from it) */ public List<Extension> getModifierExtensionsByUrl(String theUrl) { org.apache.commons.lang3.Validate.notBlank(theUrl, "theUrl must be provided with a value"); ArrayList<Extension> retVal = new ArrayList<Extension>(); for (Extension next : getModifierExtension()) { if (theUrl.equals(next.getUrl())) { retVal.add(next); } } return Collections.unmodifiableList(retVal); }
@Override public Base setProperty(int hash, String name, Base value) throws FHIRException { switch (hash) { case 3556653: // text this.text = castToNarrative(value); // Narrative return value; case -410956685: // contained this.getContained().add(castToResource(value)); // Resource return value; case -612557761: // extension this.getExtension().add(castToExtension(value)); // Extension return value; case -298878168: // modifierExtension this.getModifierExtension().add(castToExtension(value)); // Extension return value; default: return super.setProperty(hash, name, value); } }
protected String processDevice(Element participantRole, DomainResource r) throws Exception { Device d = new Device(); for (Element id : cda.getChildren(participantRole, "id")) { // todo: check for UDIs, how? d.getIdentifier().add(convert.makeIdentifierFromII(id)); } Element device = cda.getChild(participantRole, "playingDevice"); // todo: if (cda.getChild(device, "code") != null) d.setType(convert.makeCodeableConceptFromCD(cda.getChild(device, "code"))); // CCDA has an id - this is manufacturer? We just call it the name, but what to do about this? Element org = cda.getChild(participantRole, "scopingEntity"); d.setManufacturer(convert.makeURIfromII(cda.getChild(org, "id"))); String id = nextRef(); d.setId(id); r.getContained().add(d); return "#"+id; }
@Override public Base addChild(String name) throws FHIRException { if (name.equals("identifier")) { return addIdentifier(); } else if (name.equals("patient")) { this.patient = new Reference(); return this.patient; } else if (name.equals("recommendation")) { return addRecommendation(); } else return super.addChild(name); }
protected String addReference(DomainResource r, String title, String id) throws Exception { if (r.getText() == null) r.setText(new Narrative()); if (r.getText().getDiv() == null) { r.getText().setStatus(NarrativeStatus.GENERATED); new NarrativeGenerator("", "", context).generate(r); } r.setMeta(new Meta().setLastUpdatedElement(InstantType.now())); r.setId(id); feed.getEntry().add(new BundleEntryComponent().setResource(r)); return id; }
public static void removeExtension(DomainResource focus, String url) { Iterator<Extension> i = focus.getExtension().iterator(); while (i.hasNext()) { Extension e = i.next(); // must be called before you can call i.remove() if (e.getUrl().equals(url)) { i.remove(); } } }
public void copyElement(org.hl7.fhir.dstu3.model.DomainResource src, org.hl7.fhir.instance.model.Element tgt) throws FHIRException { tgt.setId(src.getId()); for (org.hl7.fhir.dstu3.model.Extension e : src.getExtension()) { tgt.addExtension(convertExtension(e)); } }
/** * @param name the identity of the extension of interest * @return The extension, if on this element, else null */ public static Extension getExtension(DomainResource resource, String name) { if (name == null) return null; if (!resource.hasExtension()) return null; for (Extension e : resource.getExtension()) { if (name.equals(e.getUrl())) return e; } return null; }