Fix casing in base64Binary type

This commit is contained in:
James Agnew 2019-01-23 08:33:37 -05:00
parent eee4c75300
commit 68fae08f20
5 changed files with 109 additions and 80 deletions

View File

@ -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<byte[]> {
private static final long serialVersionUID = 3L;

View File

@ -46,7 +46,13 @@ public class ModelDstu3Test {
@Test
public void testSetters() {
Claim claim = new Claim();
claim.setIdentifier(new ArrayList<Identifier>()).setCareTeam(new ArrayList<CareTeamComponent>());
claim.setIdentifier(new ArrayList<>()).setCareTeam(new ArrayList<>());
}
@Test
public void testbase64BinaryName() {
assertEquals("base64Binary", ourCtx.getElementDefinition("base64binary").getName());
assertEquals("base64Binary", ourCtx.getElementDefinition("base64Binary").getName());
}
@Test

View File

@ -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<byte[]> {
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<byte[]> {
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";
}
}

View File

@ -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());
}
}

View File

@ -320,6 +320,10 @@
result in the 10th result being returned). This will now result in an empty
response Bundle as would be expected.
</action>
<action type="fix">
The casing of the base64Binary datatype was incorrect in the DSTU3 and R4 model classes.
This has been corrected.
</action>
</release>
<release version="3.6.0" date="2018-11-12" description="Food">
<action type="add">