public static void removeExtension(Element 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 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; }
public boolean hasExtension(String url) { for (Extension e : getExtension()) if (url.equals(e.getUrl())) return true; return false; }
public static List<Extension> getExtensions(Element element, String url) { List<Extension> results = new ArrayList<Extension>(); for (Extension ex : element.getExtension()) if (ex.getUrl().equals(url)) results.add(ex); return results; }
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(); } } }
/** * Returns a list of 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> getExtensionsByUrl(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 : getExtension()) { if (theUrl.equals(next.getUrl())) { retVal.add(next); } } return Collections.unmodifiableList(retVal); }
/** * 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); }
public void removeExtension(String theUrl) { for (int i = getExtension().size()-1; i >= 0; i--) { if (theUrl.equals(getExtension().get(i).getUrl())) getExtension().remove(i); } }
public static Extension getExtension(Element el, String name) { if (name == null) return null; if (!el.hasExtension()) return null; for (Extension e : el.getExtension()) { if (name.equals(e.getUrl())) return e; } return null; }
public static Type getAllowedUnits(ElementDefinition eld) { for (Extension e : eld.getExtension()) if (e.getUrl().equals(EXT_ALLOWABLE_UNITS)) return e.getValue(); return null; }
private Map<String, String> convertChannelExtensionsR4(org.hl7.fhir.r4.model.Subscription theSubscription) { Map<String, String> retval = new HashMap<>(); for (org.hl7.fhir.r4.model.Extension extension : theSubscription.getChannel().getExtension()) { String url = extension.getUrl(); if (isNotBlank(url)) { String value = extractExtension(theSubscription, url); if (isNotBlank(value)) { retval.put(url, value); } } } return retval; }
/** * @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; }
public static Map<String, String> getLanguageTranslations(Element e) { Map<String, String> res = new HashMap<String, String>(); for (Extension ext : e.getExtension()) { if (ext.getUrl().equals(EXT_TRANSLATION)) { String lang = readStringExtension(ext, "lang"); String value = readStringExtension(ext, "content"); res.put(lang, value); } } return res; }
public String getTranslation(String l) throws FHIRException { for (Extension e : getExtension()) { if (e.getUrl().equals(ToolingExtensions.EXT_TRANSLATION)) { String lang = ToolingExtensions.readStringExtension(e, "lang"); if (lang.equals(l)) return e.getExtensionString("content"); } } return null; }
public static boolean hasLanguageTranslation(Element element, String lang) { for (Extension e : element.getExtension()) { if (e.getUrl().equals(EXT_TRANSLATION)) { Extension e1 = ExtensionHelper.getExtension(e, "lang"); if (e1 != null && e1.getValue() instanceof CodeType && ((CodeType) e.getValue()).getValue().equals(lang)) return true; } } return false; }
public static void setExtension(Element focus, String url, Coding c) { for (Extension e : focus.getExtension()) if (e.getUrl().equals(url)) { e.setValue(c); return; } focus.getExtension().add(new Extension().setUrl(url).setValue(c)); }
public static void setAllowableUnits(ElementDefinition eld, CodeableConcept cc) { for (Extension e : eld.getExtension()) if (e.getUrl().equals(EXT_ALLOWABLE_UNITS)) { e.setValue(cc); return; } eld.getExtension().add(new Extension().setUrl(EXT_ALLOWABLE_UNITS).setValue(cc)); }
public static String getLanguageTranslation(Element element, String lang) { for (Extension e : element.getExtension()) { if (e.getUrl().equals(EXT_TRANSLATION)) { Extension e1 = ExtensionHelper.getExtension(e, "lang"); if (e1 != null && e1.getValue() instanceof CodeType && ((CodeType) e.getValue()).getValue().equals(lang)) { e1 = ExtensionHelper.getExtension(e, "content"); return ((StringType) e.getValue()).getValue(); } } } return null; }
public static org.hl7.fhir.dstu2016may.model.Extension convertExtension(org.hl7.fhir.r4.model.Extension src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.dstu2016may.model.Extension tgt = new org.hl7.fhir.dstu2016may.model.Extension(); copyElement(src, tgt); tgt.setUrl(src.getUrl()); if (src.hasValue()) if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.r4.model.CanonicalType) tgt.setValue(convertCanonicalToReference((CanonicalType)src.getValue())); else tgt.setValue(convertType(src.getValue())); return tgt; }
public org.hl7.fhir.instance.model.Extension convertExtension(org.hl7.fhir.r4.model.Extension src) throws FHIRException { if (src == null || src.isEmpty()) return null; org.hl7.fhir.instance.model.Extension tgt = new org.hl7.fhir.instance.model.Extension(); copyElement(src, tgt); tgt.setUrl(src.getUrl()); if (src.hasValue()) if (CANONICAL_URLS.contains(src.getUrl()) && src.getValue() instanceof org.hl7.fhir.r4.model.CanonicalType) tgt.setValue(convertCanonicalToReference((CanonicalType)src.getValue())); else tgt.setValue(convertType(src.getValue())); tgt.setValue(convertType(src.getValue())); return tgt; }