From de1effbf5279f9443e4c8fda5ddb12f1f0b70baa Mon Sep 17 00:00:00 2001 From: "b.debeaubien" Date: Wed, 15 Apr 2015 11:10:08 -0400 Subject: [PATCH] #157 - removed published from dstu1 bundle, as it should only be present for bundleEntry --- .../src/main/java/ca/uhn/fhir/model/api/Bundle.java | 4 ++++ .../src/main/java/ca/uhn/fhir/parser/JsonParser.java | 1 - .../src/main/java/ca/uhn/fhir/parser/ParserState.java | 2 -- .../src/main/java/ca/uhn/fhir/parser/XmlParser.java | 1 - .../java/ca/uhn/fhir/rest/server/Dstu1BundleFactory.java | 7 ------- .../src/test/java/ca/uhn/fhir/parser/JsonParserTest.java | 2 -- .../src/test/java/ca/uhn/fhir/parser/XmlParserTest.java | 4 ---- .../src/test/resources/mixed-return-bundle.xml | 1 - 8 files changed, 4 insertions(+), 18 deletions(-) diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/Bundle.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/Bundle.java index a57b1f79c96..285307e5adc 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/Bundle.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/Bundle.java @@ -293,6 +293,7 @@ public class Bundle extends BaseBundle /* implements IElement */{ return myLinkSelf; } + /* public InstantDt getPublished() { InstantDt retVal = (InstantDt) getResourceMetadata().get(ResourceMetadataKeyEnum.PUBLISHED); if (retVal == null) { @@ -301,6 +302,7 @@ public class Bundle extends BaseBundle /* implements IElement */{ } return retVal; } + */ /** * Retrieves a resource from a bundle given its logical ID. @@ -394,9 +396,11 @@ public class Bundle extends BaseBundle /* implements IElement */{ myCategories = theCategories; } + /* public void setPublished(InstantDt thePublished) { getResourceMetadata().put(ResourceMetadataKeyEnum.PUBLISHED, thePublished); } + /* public void setType(BoundCodeDt theType) { myType = theType; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java index b30990034c7..0b83d3821da 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java @@ -192,7 +192,6 @@ public class JsonParser extends BaseParser implements IParser { writeTagWithTextNode(eventWriter, "title", theBundle.getTitle()); writeTagWithTextNode(eventWriter, "id", theBundle.getBundleId()); writeOptionalTagWithTextNode(eventWriter, "updated", theBundle.getUpdated()); - writeOptionalTagWithTextNode(eventWriter, "published", theBundle.getPublished()); boolean linkStarted = false; linkStarted = writeAtomLinkInDstu1Format(eventWriter, "self", theBundle.getLinkSelf(), linkStarted); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java index 8cf297d8576..7120d35a69c 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java @@ -680,8 +680,6 @@ class ParserState { public void enteringNewElement(String theNamespaceURI, String theLocalPart) throws DataFormatException { if ("entry".equals(theLocalPart) && verifyNamespace(XmlParser.ATOM_NS, theNamespaceURI)) { push(new AtomEntryState(myInstance, myResourceType)); - } else if (theLocalPart.equals("published")) { - push(new AtomPrimitiveState(myInstance.getPublished())); } else if (theLocalPart.equals("title")) { push(new AtomPrimitiveState(myInstance.getTitle())); } else if ("id".equals(theLocalPart)) { diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java index 21c04ac451c..ae735e99d31 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java @@ -266,7 +266,6 @@ public class XmlParser extends BaseParser implements IParser { } writeOptionalTagWithTextNode(eventWriter, "updated", theBundle.getUpdated()); - writeOptionalTagWithTextNode(eventWriter, "published", theBundle.getPublished()); if (StringUtils.isNotBlank(theBundle.getAuthorName().getValue())) { eventWriter.writeStartElement("author"); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/Dstu1BundleFactory.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/Dstu1BundleFactory.java index 6a7fdcad26e..705fcf42023 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/Dstu1BundleFactory.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/Dstu1BundleFactory.java @@ -200,8 +200,6 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory { addResourcesToBundle(resourceList, theBundleType, theServerBase, theServer.getBundleInclusionRule(), theIncludes); addRootPropertiesToBundle(null, theServerBase, theCompleteUrl, theResult.size(), theBundleType); - myBundle.setPublished(theResult.getPublished()); - if (theServer.getPagingProvider() != null) { int limit; limit = theLimit != null ? theLimit : theServer.getPagingProvider().getDefaultPageSize(); @@ -229,10 +227,6 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory { myBundle.getBundleId().setValue(UUID.randomUUID().toString()); } - if (myBundle.getPublished().isEmpty()) { - myBundle.getPublished().setToCurrentTimeInLocalTimeZone(); - } - if (myBundle.getLinkBase().isEmpty()) { myBundle.getLinkBase().setValue(theServerBase); } @@ -266,7 +260,6 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory { myBundle.getAuthorName().setValue(theAuthor); myBundle.getBundleId().setValue(UUID.randomUUID().toString()); - myBundle.getPublished().setToCurrentTimeInLocalTimeZone(); myBundle.getLinkBase().setValue(theServerBase); myBundle.getLinkSelf().setValue(theCompleteUrl); myBundle.getType().setValueAsEnum(theBundleType); diff --git a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/parser/JsonParserTest.java b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/parser/JsonParserTest.java index f1503066ac6..2ac07bc00e2 100644 --- a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/parser/JsonParserTest.java +++ b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/parser/JsonParserTest.java @@ -1219,7 +1219,6 @@ public class JsonParserTest { Bundle b = new Bundle(); InstantDt pub = InstantDt.withCurrentTime(); - b.setPublished(pub); Thread.sleep(2); Patient p1 = new Patient(); @@ -1245,7 +1244,6 @@ public class JsonParserTest { ourLog.info(bundleString); List strings = new ArrayList(); - strings.addAll(Arrays.asList("\"published\":\"" + pub.getValueAsString() + "\"")); strings.addAll(Arrays.asList("\"id\":\"1\"")); strings.addAll(Arrays.asList("this is the summary")); strings.addAll(Arrays.asList("\"id\":\"2\"", "\"rel\":\"alternate\"", "\"href\":\"http://foo/bar\"")); diff --git a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java index 099fcb1d779..160278b945b 100644 --- a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java +++ b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java @@ -314,7 +314,6 @@ public class XmlParserTest { b.getCategories().addTag("http://hl7.org/fhir/tag", "http://hl7.org/fhir/tag/message", "Message"); InstantDt pub = InstantDt.withCurrentTime(); - b.setPublished(pub); Thread.sleep(2); Patient p1 = new Patient(); @@ -340,7 +339,6 @@ public class XmlParserTest { ourLog.info(bundleString); List strings = new ArrayList(); - strings.addAll(Arrays.asList("", pub.getValueAsString(), "")); strings.add(""); strings.addAll(Arrays.asList("", "1", "", "", "")); strings.addAll(Arrays.asList("", "2", "", "", "")); @@ -380,7 +378,6 @@ public class XmlParserTest { b.getCategories().addTag("http://hl7.org/fhir/tag", "http://hl7.org/fhir/tag/message", "Message"); InstantDt pub = InstantDt.withCurrentTime(); - b.setPublished(pub); Thread.sleep(2); Patient p1 = new Patient(); @@ -406,7 +403,6 @@ public class XmlParserTest { ourLog.info(bundleString); List strings = new ArrayList(); - strings.addAll(Arrays.asList("", pub.getValueAsString(), "")); strings.add(""); strings.addAll(Arrays.asList("", "1", "", "", "")); strings.addAll(Arrays.asList("", "2", "", "", "")); diff --git a/hapi-fhir-structures-dstu/src/test/resources/mixed-return-bundle.xml b/hapi-fhir-structures-dstu/src/test/resources/mixed-return-bundle.xml index 9bee3ae5f64..3f51cb117f4 100644 --- a/hapi-fhir-structures-dstu/src/test/resources/mixed-return-bundle.xml +++ b/hapi-fhir-structures-dstu/src/test/resources/mixed-return-bundle.xml @@ -4,7 +4,6 @@ 2 - 2014-06-22T21:37:05-04:00 HAPI FHIR Server