@Override protected List<Object> extractValues(String thePaths, IBaseResource theResource) { List<Object> values = new ArrayList<>(); String[] nextPathsSplit = SPLIT.split(thePaths); FhirTerser t = getContext().newTerser(); for (String nextPath : nextPathsSplit) { String nextPathTrimmed = nextPath.trim(); List<Object> allValues; try { allValues = t.getValues(theResource, nextPathTrimmed); } catch (Exception e) { String msg = getContext().getLocalizer().getMessage(BaseSearchParamExtractor.class, "failedToExtractPaths", nextPath, e.toString()); throw new InternalErrorException(msg, e); } for (Object next : allValues) { if (next instanceof IBaseExtension) { IBaseDatatype value = ((IBaseExtension) next).getValue(); if (value != null) { values.add(value); } } else { values.add(next); } } } return values; }
private void encodeUndeclaredExtensions(IBaseResource theResource, XMLStreamWriter theEventWriter, List<? extends IBaseExtension<?, ?>> theExtensions, String tagName, boolean theIncludedResource, boolean theSubResource) throws XMLStreamException, DataFormatException { for (IBaseExtension<?, ?> next : theExtensions) { if (next == null || (ElementUtil.isEmpty(next.getValue()) && next.getExtension().isEmpty())) { continue; theEventWriter.writeAttribute("url", url); if (next.getValue() != null) { IBaseDatatype value = next.getValue(); RuntimeChildUndeclaredExtensionDefinition extDef = myContext.getRuntimeChildUndeclaredExtensionDefinition(); String childName = extDef.getChildNameByDatatype(value.getClass());
private void addExtension(BaseRuntimeElementCompositeDefinition<?> theSourceDef, IBase theSource, IBase theTarget, RuntimeChildDeclaredExtensionDefinition nextExt, String url) { RuntimeChildDeclaredExtensionDefinition sourceDeclaredExt = theSourceDef.getDeclaredExtension(url, ""); if (sourceDeclaredExt == null) { if (theSource instanceof IBaseHasExtensions) { for (IBaseExtension<?, ?> next : ((IBaseHasExtensions) theSource).getExtension()) { if (next.getUrl().equals(url)) { nextExt.getMutator().addValue(theTarget, next.getValue()); } } } if (theSource instanceof IBaseHasModifierExtensions) { for (IBaseExtension<?, ?> next : ((IBaseHasModifierExtensions) theSource).getModifierExtension()) { if (next.getUrl().equals(url)) { nextExt.getMutator().addValue(theTarget, next.getValue()); } } } } else { List<? extends IBase> values = sourceDeclaredExt.getAccessor().getValues(theSource); for (IBase nextElement : values) { nextExt.getMutator().addValue(theTarget, nextElement); } } } }
private void writeUndeclaredExtension(RuntimeResourceDefinition theResDef, IBaseResource theResource, JsonLikeWriter theEventWriter, IBaseExtension<?, ?> ext) throws IOException { IBase value = ext.getValue(); final String extensionUrl = getExtensionUrl(ext.getUrl());
List<? extends IBaseExtension<?, ?>> ext = element.getExtension(); for (IBaseExtension<?, ?> next : ext) { if (next == null || (ElementUtil.isEmpty(next.getValue()) && next.getExtension().isEmpty())) { continue;
nextObject = ((IBaseExtension<?, ?>) nextObject).getValue();
private void encodeUndeclaredExtensions(IBaseResource theResource, XMLStreamWriter theEventWriter, List<? extends IBaseExtension<?, ?>> theExtensions, String tagName, boolean theIncludedResource, EncodeContext theEncodeContext) throws XMLStreamException, DataFormatException { for (IBaseExtension<?, ?> next : theExtensions) { if (next == null || (ElementUtil.isEmpty(next.getValue()) && next.getExtension().isEmpty())) { continue; theEventWriter.writeAttribute("url", url); if (next.getValue() != null) { IBaseDatatype value = next.getValue(); RuntimeChildUndeclaredExtensionDefinition extDef = myContext.getRuntimeChildUndeclaredExtensionDefinition(); String childName = extDef.getChildNameByDatatype(value.getClass());
private void addExtension(BaseRuntimeElementCompositeDefinition<?> theSourceDef, IBase theSource, IBase theTarget, RuntimeChildDeclaredExtensionDefinition nextExt, String url) { RuntimeChildDeclaredExtensionDefinition sourceDeclaredExt = theSourceDef.getDeclaredExtension(url, ""); if (sourceDeclaredExt == null) { if (theSource instanceof IBaseHasExtensions) { for (IBaseExtension<?, ?> next : ((IBaseHasExtensions) theSource).getExtension()) { if (next.getUrl().equals(url)) { nextExt.getMutator().addValue(theTarget, next.getValue()); } } } if (theSource instanceof IBaseHasModifierExtensions) { for (IBaseExtension<?, ?> next : ((IBaseHasModifierExtensions) theSource).getModifierExtension()) { if (next.getUrl().equals(url)) { nextExt.getMutator().addValue(theTarget, next.getValue()); } } } } else { List<? extends IBase> values = sourceDeclaredExt.getAccessor().getValues(theSource); for (IBase nextElement : values) { nextExt.getMutator().addValue(theTarget, nextElement); } } } }
List<? extends IBaseExtension<?, ?>> ext = element.getExtension(); for (IBaseExtension<?, ?> next : ext) { if (next == null || (ElementUtil.isEmpty(next.getValue()) && next.getExtension().isEmpty())) { continue;
private void writeUndeclaredExtension(RuntimeResourceDefinition theResDef, IBaseResource theResource, JsonLikeWriter theEventWriter, IBaseExtension<?, ?> ext, EncodeContext theEncodeContext) throws IOException { IBase value = ext.getValue(); final String extensionUrl = getExtensionUrl(ext.getUrl());