private void addExtensionMetadata(RuntimeResourceDefinition theResDef, IBaseResource theResource, boolean theContainedResource, boolean theSubResource, List<Map.Entry<ResourceMetadataKeyEnum<?>, Object>> extensionMetadataKeys, RuntimeResourceDefinition resDef, JsonLikeWriter theEventWriter) throws IOException { if (extensionMetadataKeys.isEmpty()) { return; } ExtensionDt metaResource = new ExtensionDt(); for (Map.Entry<ResourceMetadataKeyEnum<?>, Object> entry : extensionMetadataKeys) { metaResource.addUndeclaredExtension((ExtensionDt) entry.getValue()); } encodeCompositeElementToStreamWriter(theResDef, theResource, metaResource, theEventWriter, theContainedResource, theSubResource, new CompositeChildElement(resDef, theSubResource)); }
private void addParent(CompositeChildElement theParent, StringBuilder theB) { if (theParent != null) { if (theParent.myResDef != null) { theB.append(theParent.myResDef.getName()); return; } if (theParent.myParent != null) { addParent(theParent.myParent, theB); } if (theParent.myDef != null) { if (theB.length() > 0) { theB.append('.'); } theB.append(theParent.myDef.getElementName()); } } }
private boolean isStripVersionsFromReferences(CompositeChildElement theCompositeChildElement) { Boolean stripVersionsFromReferences = myStripVersionsFromReferences; if (stripVersionsFromReferences != null) { return stripVersionsFromReferences; } if (myContext.getParserOptions().isStripVersionsFromReferences() == false) { return false; } Set<String> dontStripVersionsFromReferencesAtPaths = myDontStripVersionsFromReferencesAtPaths; if (dontStripVersionsFromReferencesAtPaths != null) { if (dontStripVersionsFromReferencesAtPaths.isEmpty() == false && theCompositeChildElement.anyPathMatches(dontStripVersionsFromReferencesAtPaths)) { return false; } } dontStripVersionsFromReferencesAtPaths = myContext.getParserOptions().getDontStripVersionsFromReferencesAtPaths(); return dontStripVersionsFromReferencesAtPaths.isEmpty() != false || !theCompositeChildElement.anyPathMatches(dontStripVersionsFromReferencesAtPaths); }
for (CompositeChildElement nextChildElem : super.compositeChildIterator(theElement, theContainedResource, theParent, theEncodeContext)) { BaseRuntimeChildDefinition nextChild = nextChildElem.getDef(); if (nextChildElem.getDef().getElementName().equals("extension") || nextChildElem.getDef().getElementName().equals("modifierExtension") || nextChild instanceof RuntimeChildDeclaredExtensionDefinition) { if (!haveWrittenExtensions) {
encodeCompositeElementToStreamWriter(theResource, theResource, theEventWriter, theContainedResource, new CompositeChildElement(resDef, theEncodeContext), theEncodeContext); writeOptionalTagWithValue(theEventWriter, "content", bin.getContentAsBase64()); } else { encodeCompositeElementToStreamWriter(theResource, theResource, theEventWriter, theContainedResource, new CompositeChildElement(resDef, theEncodeContext), theEncodeContext);
encodeCompositeElementToStreamWriter(theResDef, theResource, theResource, theEventWriter, theContainedResource, new CompositeChildElement(resDef, theEncodeContext), theEncodeContext);
BaseRuntimeChildDefinition nextChild = nextChildElem.getDef();
private boolean checkIfParentShouldBeEncodedAndBuildPath() { List<ElementsPath> encodeElements = myEncodeElements; String currentResourceName = myEncodeContext.getResourcePath().get(myEncodeContext.getResourcePath().size() - 1).getName(); if (myEncodeElementsAppliesToResourceTypes != null && !myEncodeElementsAppliesToResourceTypes.contains(currentResourceName)) { encodeElements = null; } boolean retVal = checkIfPathMatchesForEncoding(encodeElements, true); /* * We force the meta tag to be encoded even if it's not specified as an element in the * elements filter, specifically because we'll need it in order to automatically add * the SUBSETTED tag */ if (!retVal) { if ("meta".equals(myEncodeContext.getLeafResourcePathFirstField()) && shouldAddSubsettedTag(myEncodeContext)) { // The next element is a child of the <meta> element retVal = true; } else if ("meta".equals(myDef.getElementName()) && shouldAddSubsettedTag(myEncodeContext)) { // The next element is the <meta> element retVal = true; } } return retVal; }
public CompositeChildElement(CompositeChildElement theParent, BaseRuntimeChildDefinition theDef, EncodeContext theEncodeContext) { myDef = theDef; myParent = theParent; myResDef = null; myEncodeContext = theEncodeContext; if (ourLog.isTraceEnabled()) { if (theParent != null) { StringBuilder path = theParent.buildPath(); if (path != null) { path.append('.'); path.append(myDef.getElementName()); ourLog.trace(" * Next path: {}", path.toString()); } } } }
private void addParent(CompositeChildElement theParent, StringBuilder theB) { if (theParent != null) { if (theParent.myResDef != null) { theB.append(theParent.myResDef.getName()); return; } if (theParent.myParent != null) { addParent(theParent.myParent, theB); } if (theParent.myDef != null) { if (theB.length() > 0) { theB.append('.'); } theB.append(theParent.myDef.getElementName()); } } }
private boolean isStripVersionsFromReferences(CompositeChildElement theCompositeChildElement) { Boolean stripVersionsFromReferences = myStripVersionsFromReferences; if (stripVersionsFromReferences != null) { return stripVersionsFromReferences; } if (myContext.getParserOptions().isStripVersionsFromReferences() == false) { return false; } Set<String> dontStripVersionsFromReferencesAtPaths = myDontStripVersionsFromReferencesAtPaths; if (dontStripVersionsFromReferencesAtPaths != null) { if (dontStripVersionsFromReferencesAtPaths.isEmpty() == false && theCompositeChildElement.anyPathMatches(dontStripVersionsFromReferencesAtPaths)) { return false; } } dontStripVersionsFromReferencesAtPaths = myContext.getParserOptions().getDontStripVersionsFromReferencesAtPaths(); return dontStripVersionsFromReferencesAtPaths.isEmpty() != false || !theCompositeChildElement.anyPathMatches(dontStripVersionsFromReferencesAtPaths); }
private StringBuilder buildPath() { if (myResDef != null) { StringBuilder b = new StringBuilder(); b.append(myResDef.getName()); return b; } else if (myParent != null) { StringBuilder b = myParent.buildPath(); if (b != null && myDef != null) { b.append('.'); b.append(myDef.getElementName()); } return b; } else { return null; } }
private boolean checkIfParentShouldNotBeEncodedAndBuildPath() { return checkIfPathMatchesForEncoding(myDontEncodeElements, false); }
private void addExtensionMetadata(RuntimeResourceDefinition theResDef, IBaseResource theResource, boolean theContainedResource, List<Map.Entry<ResourceMetadataKeyEnum<?>, Object>> extensionMetadataKeys, RuntimeResourceDefinition resDef, JsonLikeWriter theEventWriter, EncodeContext theEncodeContext) throws IOException { if (extensionMetadataKeys.isEmpty()) { return; } ExtensionDt metaResource = new ExtensionDt(); for (Map.Entry<ResourceMetadataKeyEnum<?>, Object> entry : extensionMetadataKeys) { metaResource.addUndeclaredExtension((ExtensionDt) entry.getValue()); } encodeCompositeElementToStreamWriter(theResDef, theResource, metaResource, theEventWriter, theContainedResource, new CompositeChildElement(resDef, theEncodeContext), theEncodeContext); }
public boolean shouldBeEncoded() { boolean retVal = true; if (myEncodeElements != null) { retVal = checkIfParentShouldBeEncodedAndBuildPath(); } if (retVal && myDontEncodeElements != null) { retVal = !checkIfParentShouldNotBeEncodedAndBuildPath(); } return retVal; } }
public boolean anyPathMatches(Set<String> thePaths) { StringBuilder b = new StringBuilder(); addParent(this, b); String path = b.toString(); return thePaths.contains(path); }
for (CompositeChildElement nextChildElem : super.compositeChildIterator(theElement, theContainedResource, theSubResource, theParent)) { BaseRuntimeChildDefinition nextChild = nextChildElem.getDef(); if (nextChildElem.getDef().getElementName().equals("extension") || nextChildElem.getDef().getElementName().equals("modifierExtension") || nextChild instanceof RuntimeChildDeclaredExtensionDefinition) { if (!haveWrittenExtensions) {
encodeCompositeElementToStreamWriter(theResDef, theResource, theResource, theEventWriter, theContainedResource, theSubResource, new CompositeChildElement(resDef, theSubResource));
encodeCompositeElementToStreamWriter(theResource, theResource, theEventWriter, theContainedResource, theSubResource, new CompositeChildElement(resDef, theSubResource)); writeOptionalTagWithValue(theEventWriter, "content", bin.getContentAsBase64()); } else { encodeCompositeElementToStreamWriter(theResource, theResource, theEventWriter, theContainedResource, theSubResource, new CompositeChildElement(resDef, theSubResource));
BaseRuntimeChildDefinition nextChild = nextChildElem.getDef();