Add model changes to IBaseCoding and related changes (#4587)

* Add IbaseCoding changes, and tinder changes

* Fix up tag definition

* converter addition

* Fix unit test and add changelog.

* Add jira to changelog.

---------

Co-authored-by: Tadgh <garygrantgraham@gmail.com>
This commit is contained in:
Luke deGruchy 2023-02-24 13:12:01 -05:00 committed by GitHub
parent 4af1a5016c
commit 9ede6b3b9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 56 additions and 3 deletions

View File

@ -59,6 +59,8 @@ public class Tag extends BaseElement implements IElement, IBaseCoding {
private String myLabel;
private String myScheme;
private String myTerm;
private String myVersion;
private boolean myUserSelected;
public Tag() {
}
@ -124,6 +126,16 @@ public class Tag extends BaseElement implements IElement, IBaseCoding {
return false;
} else if (!myTerm.equals(other.myTerm))
return false;
if (myVersion == null) {
if (other.getVersion() != null)
return false;
} else if (!myVersion.equals(other.getVersion()))
return false;
if (myUserSelected != other.getUserSelected())
return false;
return true;
}
@ -133,6 +145,8 @@ public class Tag extends BaseElement implements IElement, IBaseCoding {
int result = 1;
result = prime * result + ((myScheme == null) ? 0 : myScheme.hashCode());
result = prime * result + ((myTerm == null) ? 0 : myTerm.hashCode());
result = prime * result + ((myVersion == null) ? 0 : myVersion.hashCode());
result = prime * result + Boolean.hashCode(myUserSelected);
return result;
}
@ -174,6 +188,8 @@ public class Tag extends BaseElement implements IElement, IBaseCoding {
b.append("Scheme", myScheme);
b.append("Term", myTerm);
b.append("Label", myLabel);
b.append("Version", myVersion);
b.append("UserSelected", myUserSelected);
return b.toString();
}
@ -210,4 +226,22 @@ public class Tag extends BaseElement implements IElement, IBaseCoding {
return this;
}
@Override
public String getVersion() { return myVersion; }
@Override
public IBaseCoding setVersion(String theVersion) {
myVersion = theVersion;
return this;
}
@Override
public boolean getUserSelected() { return myUserSelected; }
@Override
public IBaseCoding setUserSelected(boolean theUserSelected) {
myUserSelected = theUserSelected;
return this;
}
}

View File

@ -28,10 +28,19 @@ public interface IBaseCoding extends IBase {
String getSystem();
boolean getUserSelected();
String getVersion();
IBaseCoding setCode(String theTerm);
IBaseCoding setDisplay(String theLabel);
IBaseCoding setSystem(String theScheme);
IBaseCoding setVersion(String theVersion);
IBaseCoding setUserSelected(boolean theUserSelected);
}

View File

@ -27,7 +27,7 @@ public class TagTest {
@Test
public void testHashCode() {
Tag tag1 = new Tag().setScheme("scheme").setTerm("term").setLabel("label");
assertEquals(1920714536, tag1.hashCode());
assertEquals(-1029266947, tag1.hashCode());
}
@Test

View File

@ -1,4 +1,5 @@
---
type: fix
issue: 4582
jira: SMILE-4688
title: "Upgrade dependency on core to 5.6.97 including hapi-fhir code enhancements and unit test fixes."

View File

@ -0,0 +1,4 @@
---
type: fix
issue: 4589
title: "Update IBaseCoding, Tag, and tinder Child to support new userSelected and version fields for resource tags."

View File

@ -397,7 +397,7 @@ public class CodingDt
* Indicates that this coding was chosen by a user directly - i.e. off a pick list of available items (codes or displays)
* </p>
*/
public Boolean getUserSelected() {
public boolean getUserSelected() {
return getUserSelectedElement().getValue();
}

View File

@ -203,7 +203,12 @@ public abstract class Child extends BaseElement {
return arrayType + "[]";
}
Class<?> rawType = (Class<?>) type2;
return rawType.getSimpleName();
if (this.getDeclaringClassNameComplete().equals("CodingDt") && theType.equals("BooleanDt")) {
return boolean.class.getSimpleName();
} else {
return rawType.getSimpleName();
}
}
public boolean isBoundCode() {