diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/Base64BinaryType.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/Base64BinaryType.java index 6c07d2f0a5e..0c92c6d0c0c 100644 --- a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/Base64BinaryType.java +++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/model/Base64BinaryType.java @@ -35,7 +35,7 @@ import ca.uhn.fhir.model.api.annotation.DatatypeDef; /** * Primitive type "base64Binary" in FHIR: a sequence of bytes represented in base64 */ -@DatatypeDef(name = "base64binary") +@DatatypeDef(name = "base64Binary") public class Base64BinaryType extends PrimitiveType { private static final long serialVersionUID = 3L; diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/model/ModelDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/model/ModelDstu3Test.java index 0e2c2edb6f4..67a7679c23f 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/model/ModelDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/model/ModelDstu3Test.java @@ -46,7 +46,13 @@ public class ModelDstu3Test { @Test public void testSetters() { Claim claim = new Claim(); - claim.setIdentifier(new ArrayList()).setCareTeam(new ArrayList()); + claim.setIdentifier(new ArrayList<>()).setCareTeam(new ArrayList<>()); + } + + @Test + public void testbase64BinaryName() { + assertEquals("base64Binary", ourCtx.getElementDefinition("base64binary").getName()); + assertEquals("base64Binary", ourCtx.getElementDefinition("base64Binary").getName()); } @Test diff --git a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/model/Base64BinaryType.java b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/model/Base64BinaryType.java index e0813445603..36f7a237b12 100644 --- a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/model/Base64BinaryType.java +++ b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/model/Base64BinaryType.java @@ -1,78 +1,78 @@ -/* -Copyright (c) 2011+, HL7, Inc -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of HL7 nor the names of its contributors may be used to - endorse or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - - */ -package org.hl7.fhir.r4.model; - -import org.apache.commons.codec.binary.Base64; - -import ca.uhn.fhir.model.api.annotation.DatatypeDef; - -/** - * Primitive type "base64Binary" in FHIR: a sequence of bytes represented in base64 - */ -@DatatypeDef(name="base64binary") -public class Base64BinaryType extends PrimitiveType { - - private static final long serialVersionUID = 3L; - - /** - * Constructor - */ - public Base64BinaryType() { - super(); - } - - public Base64BinaryType(byte[] theBytes) { - super(); - setValue(theBytes); - } - - public Base64BinaryType(String theValue) { - super(); - setValueAsString(theValue); - } - - protected byte[] parse(String theValue) { - return Base64.decodeBase64(theValue); - } - - protected String encode(byte[] theValue) { - return Base64.encodeBase64String(theValue); - } - - @Override - public Base64BinaryType copy() { - Base64BinaryType ret = new Base64BinaryType(getValue()); - copyValues(ret); - return ret; - } - - public String fhirType() { - return "base64Binary"; - } -} +/* +Copyright (c) 2011+, HL7, Inc +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + + */ +package org.hl7.fhir.r4.model; + +import org.apache.commons.codec.binary.Base64; + +import ca.uhn.fhir.model.api.annotation.DatatypeDef; + +/** + * Primitive type "base64Binary" in FHIR: a sequence of bytes represented in base64 + */ +@DatatypeDef(name="base64Binary") +public class Base64BinaryType extends PrimitiveType { + + private static final long serialVersionUID = 3L; + + /** + * Constructor + */ + public Base64BinaryType() { + super(); + } + + public Base64BinaryType(byte[] theBytes) { + super(); + setValue(theBytes); + } + + public Base64BinaryType(String theValue) { + super(); + setValueAsString(theValue); + } + + protected byte[] parse(String theValue) { + return Base64.decodeBase64(theValue); + } + + protected String encode(byte[] theValue) { + return Base64.encodeBase64String(theValue); + } + + @Override + public Base64BinaryType copy() { + Base64BinaryType ret = new Base64BinaryType(getValue()); + copyValues(ret); + return ret; + } + + public String fhirType() { + return "base64Binary"; + } +} diff --git a/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/model/ModelR4Test.java b/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/model/ModelR4Test.java new file mode 100644 index 00000000000..3610cad6327 --- /dev/null +++ b/hapi-fhir-structures-r4/src/test/java/org/hl7/fhir/r4/model/ModelR4Test.java @@ -0,0 +1,19 @@ +package org.hl7.fhir.r4.model; + +import ca.uhn.fhir.context.FhirContext; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class ModelR4Test { + + private static FhirContext ourCtx = FhirContext.forR4(); + + @Test + public void testbase64BinaryName() { + assertEquals("base64Binary", ourCtx.getElementDefinition("base64binary").getName()); + assertEquals("base64Binary", ourCtx.getElementDefinition("base64Binary").getName()); + } + + +} diff --git a/src/changes/changes.xml b/src/changes/changes.xml index b16733c2619..072f559de66 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -320,6 +320,10 @@ result in the 10th result being returned). This will now result in an empty response Bundle as would be expected. + + The casing of the base64Binary datatype was incorrect in the DSTU3 and R4 model classes. + This has been corrected. +