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; String url = getExtensionUrl(next.getUrl()); theEventWriter.writeAttribute("url", url); if (next.getValue() != null) { IBaseDatatype value = next.getValue(); RuntimeChildUndeclaredExtensionDefinition extDef = myContext.getRuntimeChildUndeclaredExtensionDefinition(); String childName = extDef.getChildNameByDatatype(value.getClass());
List<? extends IBaseExtension<?, ?>> ext = element.getExtension(); for (IBaseExtension<?, ?> next : ext) { if (next == null || (ElementUtil.isEmpty(next.getValue()) && next.getExtension().isEmpty())) { continue; List<? extends IBaseExtension<?, ?>> ext = element.getModifierExtension(); for (IBaseExtension<?, ?> next : ext) { if (next == null || next.isEmpty()) { continue;
private IBaseExtension createEmptyModifierExtension(IBaseHasModifierExtensions theBaseHasModifierExtensions, String theUrl) { return (IBaseExtension) theBaseHasModifierExtensions.addModifierExtension().setUrl(theUrl); }
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); } } } }
@Override public int compareTo(HeldExtension theArg0) { String url1 = myDef != null ? myDef.getExtensionUrl() : myUndeclaredExtension.getUrl(); String url2 = theArg0.myDef != null ? theArg0.myDef.getExtensionUrl() : theArg0.myUndeclaredExtension.getUrl(); url1 = defaultString(getExtensionUrl(url1)); url2 = defaultString(getExtensionUrl(url2)); return url1.compareTo(url2); }
extensionDts = ((IBaseExtension) theCurrentObj).getExtension(); extensions = ((IBaseHasExtensions) theCurrentObj).getExtension() .stream() .filter(t -> t.getUrl().equals(extensionUrlForLambda)) .collect(Collectors.toList()); extensionDts = ((IBaseExtension) theCurrentObj).getExtension(); extensions = ((IBaseHasModifierExtensions) theCurrentObj).getModifierExtension() .stream() .filter(t -> t.getUrl().equals(extensionUrlForLambda)) .collect(Collectors.toList());
@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; }
@SuppressWarnings("unchecked") private ExtensionDt createEmptyExtensionDt(IBaseExtension theBaseExtension, boolean theIsModifier, String theUrl) { ExtensionDt retVal = new ExtensionDt(theIsModifier, theUrl); theBaseExtension.getExtension().add(retVal); return retVal; }
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); } } } }
boolean handled = false; if (nextElement instanceof IBaseExtension) { String url = ((IBaseExtension<?, ?>) nextElement).getUrl(); for (RuntimeChildDeclaredExtensionDefinition nextExt : targetExts) { String nextTargetUrl = nextExt.getExtensionUrl();
extensionDts = ((IBaseExtension) theCurrentObj).getExtension(); extensions = ((IBaseHasExtensions) theCurrentObj).getExtension() .stream() .filter(t -> t.getUrl().equals(extensionUrlForLambda)) .collect(Collectors.toList()); extensionDts = ((IBaseExtension) theCurrentObj).getExtension(); extensions = ((IBaseHasModifierExtensions) theCurrentObj).getModifierExtension() .stream() .filter(t -> t.getUrl().equals(extensionUrlForLambda)) .collect(Collectors.toList());
nextObject = ((IBaseExtension<?, ?>) nextObject).getValue();
@SuppressWarnings("unchecked") private ExtensionDt createEmptyExtensionDt(IBaseExtension theBaseExtension, boolean theIsModifier, String theUrl) { ExtensionDt retVal = new ExtensionDt(theIsModifier, theUrl); theBaseExtension.getExtension().add(retVal); return retVal; }
private void writeUndeclaredExtension(RuntimeResourceDefinition theResDef, IBaseResource theResource, JsonLikeWriter theEventWriter, IBaseExtension<?, ?> ext) throws IOException { IBase value = ext.getValue(); final String extensionUrl = getExtensionUrl(ext.getUrl()); if (noValue && ext.getExtension().isEmpty()) { ourLog.debug("Extension with URL[{}] has no value", extensionUrl); } else if (noValue) { for (Object next : ext.getExtension()) { writeUndeclaredExtension(theResDef, theResource, theEventWriter, (IBaseExtension<?, ?>) next);
List<? extends IBaseExtension<?, ?>> ext = element.getExtension(); for (IBaseExtension<?, ?> next : ext) { if (next == null || (ElementUtil.isEmpty(next.getValue()) && next.getExtension().isEmpty())) { continue; List<? extends IBaseExtension<?, ?>> ext = element.getModifierExtension(); for (IBaseExtension<?, ?> next : ext) { if (next == null || next.isEmpty()) { continue;
static public List<String> getExtensionValues( final String url, final List<? extends IBaseExtension> extensions ) { return extensions.stream() .filter( e -> e.getUrl() .equals( url ) ) .map( IBaseExtension::getValue ) .filter( StringType.class::isInstance ) .map( e -> ((StringType) e).getValue() ) .collect( Collectors.toList() ); }
private IBaseExtension createEmptyExtension(IBaseHasExtensions theBaseHasExtensions, String theUrl) { return (IBaseExtension) theBaseHasExtensions.addExtension().setUrl(theUrl); }
} else if (nextChild instanceof RuntimeChildExtension) { IBaseExtension<?, ?> extension = (IBaseExtension<?, ?>) nextValue; if ((extension.getValue() == null || extension.getValue().isEmpty())) { if (extension.getExtension().isEmpty()) { continue; encodeChildElementToStreamWriter(theResource, theEventWriter, nextValue, childName, childDef, getExtensionUrl(extension.getUrl()), theContainedResource, theSubResource, nextChildElem); } else if (nextChild instanceof RuntimeChildNarrativeDefinition && theContainedResource) {
@Override public int compareTo(HeldExtension theArg0) { String url1 = myDef != null ? myDef.getExtensionUrl() : myUndeclaredExtension.getUrl(); String url2 = theArg0.myDef != null ? theArg0.myDef.getExtensionUrl() : theArg0.myUndeclaredExtension.getUrl(); url1 = defaultString(getExtensionUrl(url1)); url2 = defaultString(getExtensionUrl(url2)); return url1.compareTo(url2); }
private IBaseExtension createEmptyModifierExtension(IBaseHasModifierExtensions theBaseHasModifierExtensions, String theUrl) { return (IBaseExtension) theBaseHasModifierExtensions.addModifierExtension().setUrl(theUrl); }