protected void containResourcesForEncoding(IBaseResource theResource) { ContainedResources contained = new ContainedResources(); containResourcesForEncoding(contained, theResource, theResource); contained.assignIdsToContainedResources(); myContainedResources = contained; }
filterCodingsWithNoCodeOrSystem(metaValue.getTag()); filterCodingsWithNoCodeOrSystem(metaValue.getSecurity()); List<? extends IPrimitiveType<String>> newProfileList = getProfileTagsForEncoding(theResource, metaValue.getProfile()); List<? extends IPrimitiveType<String>> oldProfileList = metaValue.getProfile(); if (oldProfileList != newProfileList) { if (shouldAddSubsettedTag()) { IBaseCoding coding = metaValue.addTag(); coding.setCode(Constants.TAG_SUBSETTED_CODE); coding.setSystem(getSubsettedCodeSystem()); coding.setDisplay(subsetDescription()); String refText = determineReferenceText(nextRef, theCompositeChildElement); if (!StringUtils.equals(refText, nextRef.getReferenceElement().getValue())) {
@Override public final void encodeResourceToWriter(IBaseResource theResource, Writer theWriter) throws IOException, DataFormatException { Validate.notNull(theResource, "theResource can not be null"); Validate.notNull(theWriter, "theWriter can not be null"); if (theResource.getStructureFhirVersionEnum() != myContext.getVersion().getVersion()) { throw new IllegalArgumentException( "This parser is for FHIR version " + myContext.getVersion().getVersion() + " - Can not encode a structure for version " + theResource.getStructureFhirVersionEnum()); } doEncodeResourceToWriter(theResource, theWriter); }
protected boolean shouldAddSubsettedTag() { return isSummaryMode() || isSuppressNarratives() || getEncodeElements() != null; }
private void encodeResourceToXmlStreamWriter(IBaseResource theResource, XMLStreamWriter theEventWriter, boolean theContainedResource, boolean theSubResource, IIdType theResourceId) throws XMLStreamException { if (!theContainedResource) { super.containResourcesForEncoding(theResource); profiles = super.getProfileTagsForEncoding(resource, profiles); if (super.shouldEncodeResourceMeta(resource) && ElementUtil.isEmpty(versionIdPart, updated, securityLabels, tags, profiles) == false) { theEventWriter.writeStartElement("meta"); writeOptionalTagWithValue(theEventWriter, "versionId", versionIdPart);
for (CompositeChildElement nextChildElem : super.compositeChildIterator(theElement, theContainedResource, theSubResource, theParent)) { values = super.preProcessValues(nextChild, theResource, values, nextChildElem); BaseParser.ChildNameAndDef childNameAndDef = super.getChildNameAndDef(nextChild, nextValue); if (childNameAndDef == null) { continue;
T retVal = doParseResource(theResourceType, theReader); continue; // TODO: remove this once the data model in tinder plugin catches up to 1.2 if (isOverrideResourceIdWithBundleEntryFullUrl()) { List<IBase> fullUrl = fullUrlChild.getAccessor().getValues(nextEntry); if (fullUrl != null && !fullUrl.isEmpty()) {
String reference = ref.getValue(); if (theRef.getResource() != null) { IIdType containedId = getContainedResources().getResourceId(theRef.getResource()); if (containedId != null && !containedId.isEmpty()) { if (containedId.isLocal()) { refId = refId.withResourceType(myContext.getResourceDefinition(theRef.getResource()).getName()); if (isStripVersionsFromReferences(theCompositeChildElement)) { reference = refId.toVersionless().getValue(); } else { if (isStripVersionsFromReferences(theCompositeChildElement)) { return ref.toUnqualifiedVersionless().getValue(); if (isStripVersionsFromReferences(theCompositeChildElement)) { return ref.toVersionless().getValue();
@Override public String encodeResourceToString(IBaseResource theResource) throws DataFormatException { Writer stringWriter = new StringWriter(); try { encodeResourceToWriter(theResource, stringWriter); } catch (IOException e) { throw new Error("Encountered IOException during write to string - This should not happen!"); } return stringWriter.toString(); }
protected boolean isChildContained(BaseRuntimeElementDefinition<?> childDef, boolean theIncludedResource) { return (childDef.getChildType() == ChildTypeEnum.CONTAINED_RESOURCES || childDef.getChildType() == ChildTypeEnum.CONTAINED_RESOURCE_LIST) && getContainedResources().isEmpty() == false && theIncludedResource == false; }
private void encodeResourceToJsonStreamWriter(RuntimeResourceDefinition theResDef, IBaseResource theResource, JsonLikeWriter theEventWriter, String theObjectNameOrNull, boolean theContainedResource, boolean theSubResource, IIdType theResourceId) throws IOException { if (!theContainedResource) { super.containResourcesForEncoding(theResource); profiles = super.getProfileTagsForEncoding(resource, profiles); if (super.shouldEncodeResourceMeta(resource) && (ElementUtil.isEmpty(versionIdPart, updated, securityLabels, tags, profiles) == false) || !extensionMetadataKeys.isEmpty()) { beginObject(theEventWriter, "meta"); writeOptionalTagWithTextNode(theEventWriter, "versionId", versionIdPart);
private void encodeCompositeElementToStreamWriter(IBaseResource theResource, IBase theElement, XMLStreamWriter theEventWriter, boolean theContainedResource, boolean theSubResource, CompositeChildElement theParent) throws XMLStreamException, DataFormatException { for (CompositeChildElement nextChildElem : super.compositeChildIterator(theElement, theContainedResource, theSubResource, theParent)) { values = super.preProcessValues(nextChild, theResource, values, nextChildElem); BaseParser.ChildNameAndDef childNameAndDef = super.getChildNameAndDef(nextChild, nextValue); if (childNameAndDef == null) { continue;
T retVal = doParseResource(theResourceType, theReader); continue; // TODO: remove this once the data model in tinder plugin catches up to 1.2 if (isOverrideResourceIdWithBundleEntryFullUrl()) { List<IBase> fullUrl = fullUrlChild.getAccessor().getValues(nextEntry); if (fullUrl != null && !fullUrl.isEmpty()) {
String reference = ref.getValue(); if (theRef.getResource() != null) { IIdType containedId = getContainedResources().getResourceId(theRef.getResource()); if (containedId != null && !containedId.isEmpty()) { if (containedId.isLocal()) { refId = refId.withResourceType(myContext.getResourceDefinition(theRef.getResource()).getName()); if (isStripVersionsFromReferences(theCompositeChildElement)) { reference = refId.toVersionless().getValue(); } else { if (isStripVersionsFromReferences(theCompositeChildElement)) { return ref.toUnqualifiedVersionless().getValue(); if (isStripVersionsFromReferences(theCompositeChildElement)) { return ref.toVersionless().getValue();
@Override public String encodeResourceToString(IBaseResource theResource) throws DataFormatException { Writer stringWriter = new StringWriter(); try { encodeResourceToWriter(theResource, stringWriter); } catch (IOException e) { throw new Error("Encountered IOException during write to string - This should not happen!"); } return stringWriter.toString(); }
protected boolean isChildContained(BaseRuntimeElementDefinition<?> childDef, boolean theIncludedResource) { return (childDef.getChildType() == ChildTypeEnum.CONTAINED_RESOURCES || childDef.getChildType() == ChildTypeEnum.CONTAINED_RESOURCE_LIST) && getContainedResources().isEmpty() == false && theIncludedResource == false; }
filterCodingsWithNoCodeOrSystem(metaValue.getTag()); filterCodingsWithNoCodeOrSystem(metaValue.getSecurity()); List<? extends IPrimitiveType<String>> newProfileList = getProfileTagsForEncoding(theResource, metaValue.getProfile()); List<? extends IPrimitiveType<String>> oldProfileList = metaValue.getProfile(); if (oldProfileList != newProfileList) { if (shouldAddSubsettedTag(theEncodeContext)) { IBaseCoding coding = metaValue.addTag(); coding.setCode(Constants.TAG_SUBSETTED_CODE); coding.setSystem(getSubsettedCodeSystem()); coding.setDisplay(subsetDescription()); String refText = determineReferenceText(nextRef, theCompositeChildElement); if (!StringUtils.equals(refText, nextRef.getReferenceElement().getValue())) {
private void encodeResourceToXmlStreamWriter(IBaseResource theResource, XMLStreamWriter theEventWriter, boolean theContainedResource, IIdType theResourceId, EncodeContext theEncodeContext) throws XMLStreamException { if (!theContainedResource) { super.containResourcesForEncoding(theResource); profiles = super.getProfileTagsForEncoding(resource, profiles); if (super.shouldEncodeResourceMeta(resource) && ElementUtil.isEmpty(versionIdPart, updated, securityLabels, tags, profiles) == false) { theEventWriter.writeStartElement("meta"); if (shouldEncodePath(resource, "meta.versionId")) {
for (CompositeChildElement nextChildElem : super.compositeChildIterator(theElement, theContainedResource, theParent, theEncodeContext)) { values = super.preProcessValues(nextChild, theResource, values, nextChildElem, theEncodeContext); BaseParser.ChildNameAndDef childNameAndDef = super.getChildNameAndDef(nextChild, nextValue); if (childNameAndDef == null) { continue;
if (potentialTarget != null) { theContained.addContained(next.getReferenceElement(), potentialTarget); containResourcesForEncoding(theContained, potentialTarget, theTarget); containResourcesForEncoding(theContained, resource, theTarget);