diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_4_0/4604-tag-definition-boolean-primitive-solution.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_4_0/4604-tag-definition-boolean-primitive-solution.yaml new file mode 100644 index 00000000000..4e35a797823 --- /dev/null +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/6_4_0/4604-tag-definition-boolean-primitive-solution.yaml @@ -0,0 +1,5 @@ +--- +type: fix +issue: 4604 +jira: SMILE-4688 +title: "Doing a GET for a resource tag created before 4204 will return a null error on userSelected. This has been fixed by defaulting null to false." diff --git a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/TagDefinition.java b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/TagDefinition.java index 39a3c52f61b..279622bf0c7 100644 --- a/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/TagDefinition.java +++ b/hapi-fhir-jpaserver-model/src/main/java/ca/uhn/fhir/jpa/model/entity/TagDefinition.java @@ -86,7 +86,7 @@ public class TagDefinition implements Serializable { private String myVersion; @Column(name = "TAG_USER_SELECTED") - private boolean myUserSelected; + private Boolean myUserSelected; @Transient private transient Integer myHashCode; @@ -162,7 +162,11 @@ public class TagDefinition implements Serializable { } } - public Boolean getUserSelected() { return myUserSelected; } + public Boolean getUserSelected() { + // TODO: LD: this is not ideal as we are implicitly assuming null is false. + // Ideally we should fix IBaseCoding to return wrapper Boolean but that will involve another core/hapi release + return myUserSelected != null ? myUserSelected : false; + } public void setUserSelected(Boolean theUserSelected) { myUserSelected = theUserSelected != null && theUserSelected;