Fixed this bug: the security labels wouldn't be encoded if versionId or lastUpdated weren't present.
This commit is contained in:
parent
f7a8c8d5f5
commit
8a2f9ff983
|
@ -670,14 +670,15 @@ public class JsonParser extends BaseParser implements IParser {
|
|||
|
||||
if (myContext.getVersion().getVersion().isNewerThan(FhirVersionEnum.DSTU1) && theResource instanceof IResource) {
|
||||
IResource resource = (IResource) theResource;
|
||||
if (!ElementUtil.isEmpty(resource.getId().getVersionIdPart(), ResourceMetadataKeyEnum.UPDATED.get(resource))) {
|
||||
//Object securityLabelRawObj =
|
||||
List<BaseCodingDt> securityLabels = (List<BaseCodingDt>) resource.getResourceMetadata().get(ResourceMetadataKeyEnum.SECURITY_LABELS);
|
||||
if (!ElementUtil.isEmpty(resource.getId().getVersionIdPart(), ResourceMetadataKeyEnum.UPDATED.get(resource))
|
||||
|| (securityLabels != null && !securityLabels.isEmpty())) {
|
||||
theEventWriter.writeStartObject("meta");
|
||||
writeOptionalTagWithTextNode(theEventWriter, "versionId", resource.getId().getVersionIdPart());
|
||||
writeOptionalTagWithTextNode(theEventWriter, "lastUpdated", ResourceMetadataKeyEnum.UPDATED.get(resource));
|
||||
|
||||
Object securityLabelRawObj = resource.getResourceMetadata().get(ResourceMetadataKeyEnum.SECURITY_LABELS);
|
||||
if (securityLabelRawObj != null) {
|
||||
List<BaseCodingDt> securityLabels = (List<BaseCodingDt>) securityLabelRawObj;
|
||||
if (securityLabels != null) {
|
||||
if (!securityLabels.isEmpty()) {
|
||||
theEventWriter.writeStartArray("security");
|
||||
|
||||
|
|
|
@ -747,8 +747,12 @@ public class XmlParser extends BaseParser implements IParser {
|
|||
|
||||
|
||||
InstantDt updated = (InstantDt) resource.getResourceMetadata().get(ResourceMetadataKeyEnum.UPDATED);
|
||||
//Object securityLabelRawObj = resource.getResourceMetadata().get(ResourceMetadataKeyEnum.SECURITY_LABELS);
|
||||
List<BaseCodingDt> securityLabels = (List<BaseCodingDt>) resource.getResourceMetadata().get(ResourceMetadataKeyEnum.SECURITY_LABELS);
|
||||
IdDt resourceId = resource.getId();
|
||||
if (resourceId != null && isNotBlank(resourceId.getVersionIdPart()) || (updated != null && !updated.isEmpty())) {
|
||||
if (resourceId != null && isNotBlank(resourceId.getVersionIdPart())
|
||||
|| (updated != null && !updated.isEmpty())
|
||||
|| (securityLabels != null && !securityLabels.isEmpty())) {
|
||||
theEventWriter.writeStartElement("meta");
|
||||
String versionIdPart = resourceId.getVersionIdPart();
|
||||
if (isBlank(versionIdPart)) {
|
||||
|
@ -758,9 +762,9 @@ public class XmlParser extends BaseParser implements IParser {
|
|||
if (updated != null) {
|
||||
writeOptionalTagWithValue(theEventWriter, "lastUpdated", updated.getValueAsString());
|
||||
}
|
||||
Object securityLabelRawObj = resource.getResourceMetadata().get(ResourceMetadataKeyEnum.SECURITY_LABELS);
|
||||
if (securityLabelRawObj != null) {
|
||||
List<BaseCodingDt> securityLabels = (List<BaseCodingDt>) securityLabelRawObj;
|
||||
|
||||
if (securityLabels != null) {
|
||||
|
||||
if (!securityLabels.isEmpty()) {
|
||||
|
||||
for (BaseCodingDt securityLabel : securityLabels) {
|
||||
|
|
Loading…
Reference in New Issue