Support for long concept property values has been added.
This commit is contained in:
parent
a324e51efa
commit
396f358f2d
|
@ -29,6 +29,7 @@ import org.hibernate.validator.constraints.NotBlank;
|
|||
import javax.annotation.Nonnull;
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.left;
|
||||
import static org.apache.commons.lang3.StringUtils.length;
|
||||
|
@ -62,9 +63,11 @@ public class TermConceptProperty implements Serializable {
|
|||
@Column(name = "PROP_KEY", nullable = false, length = MAX_LENGTH)
|
||||
@NotBlank
|
||||
private String myKey;
|
||||
// FIXME: DM 2019-09-13 - We presently truncate down to 500. The longest value for EXTERNAL_COPYRIGHT_NOTICE is 2,597 so we should use a LOB instead of a String.
|
||||
@Column(name = "PROP_VAL", nullable = true, length = MAX_LENGTH)
|
||||
private String myValue;
|
||||
@Column(name = "PROP_VAL_LOB")
|
||||
@Lob()
|
||||
private byte[] myValueLob;
|
||||
@Column(name = "PROP_TYPE", nullable = false, length = MAX_PROPTYPE_ENUM_LENGTH)
|
||||
private TermConceptPropertyTypeEnum myType;
|
||||
|
||||
|
@ -145,6 +148,9 @@ public class TermConceptProperty implements Serializable {
|
|||
* property, and the code for a {@link TermConceptPropertyTypeEnum#CODING coding} property.
|
||||
*/
|
||||
public String getValue() {
|
||||
if (hasValueLob()) {
|
||||
return getValueLobAsString();
|
||||
}
|
||||
return myValue;
|
||||
}
|
||||
|
||||
|
@ -153,10 +159,40 @@ public class TermConceptProperty implements Serializable {
|
|||
* property, and the code for a {@link TermConceptPropertyTypeEnum#CODING coding} property.
|
||||
*/
|
||||
public TermConceptProperty setValue(String theValue) {
|
||||
if (theValue.length() > MAX_LENGTH) {
|
||||
setValueLob(theValue);
|
||||
} else {
|
||||
myValueLob = null;
|
||||
}
|
||||
myValue = left(theValue, MAX_LENGTH);
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean hasValueLob() {
|
||||
if (myValueLob != null && myValueLob.length > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public byte[] getValueLob() {
|
||||
return myValueLob;
|
||||
}
|
||||
|
||||
public String getValueLobAsString() {
|
||||
return new String(myValueLob, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
public TermConceptProperty setValueLob(byte[] theValueLob) {
|
||||
myValueLob = theValueLob;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TermConceptProperty setValueLob(String theValueLob) {
|
||||
myValueLob = theValueLob.getBytes(StandardCharsets.UTF_8);
|
||||
return this;
|
||||
}
|
||||
|
||||
public TermConceptProperty setCodeSystemVersion(TermCodeSystemVersion theCodeSystemVersion) {
|
||||
myCodeSystemVersion = theCodeSystemVersion;
|
||||
return this;
|
||||
|
@ -171,7 +207,7 @@ public class TermConceptProperty implements Serializable {
|
|||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
|
||||
.append("key", myKey)
|
||||
.append("value", myValue)
|
||||
.append("value", getValue())
|
||||
.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -90,9 +90,7 @@ public class TerminologyLoaderSvcLoincTest extends BaseLoaderTest {
|
|||
|
||||
// LOINC code with 3rd party copyright
|
||||
code = concepts.get("47239-9");
|
||||
// FIXME: DM 2019-09-13 - We presently truncate down to 500. The longest value for EXTERNAL_COPYRIGHT_NOTICE is 2,597 so we should use a LOB instead of a String.
|
||||
// String expectedExternalCopyrightNotice = "Copyright © 2006 World Health Organization. Used with permission. Publications of the World Health Organization can be obtained from WHO Press, World Health Organization, 20 Avenue Appia, 1211 Geneva 27, Switzerland (tel: +41 22 791 2476; fax: +41 22 791 4857; email: bookorders@who.int). Requests for permission to reproduce or translate WHO publications – whether for sale or for noncommercial distribution – should be addressed to WHO Press, at the above address (fax: +41 22 791 4806; email: permissions@who.int). The designations employed and the presentation of the material in this publication do not imply the expression of any opinion whatsoever on the part of the World Health Organization concerning the legal status of any country, territory, city or area or of its authorities, or concerning the delimitation of its frontiers or boundaries. Dotted lines on maps represent approximate border lines for which there may not yet be full agreement. The mention of specific companies or of certain manufacturers’ products does not imply that they are endorsed or recommended by the World Health Organization in preference to others of a similar nature that are not mentioned. Errors and omissions excepted, the names of proprietary products are distinguished by initial capital letters. All reasonable precautions have been taken by WHO to verify the information contained in this publication. However, the published material is being distributed without warranty of any kind, either express or implied. The responsibility for the interpretation and use of the material lies with the reader. In no event shall the World Health Organization be liable for damages arising from its use.";
|
||||
String expectedExternalCopyrightNotice = "Copyright © 2006 World Health Organization. Used with permission. Publications of the World Health Organization can be obtained from WHO Press, World Health Organization, 20 Avenue Appia, 1211 Geneva 27, Switzerland (tel: +41 22 791 2476; fax: +41 22 791 4857; email: bookorders@who.int). Requests for permission to reproduce or translate WHO publications – whether for sale or for noncommercial distribution – should be addressed to WHO Press, at the above address (fax: +41 22 791 4806; email: perm";
|
||||
String expectedExternalCopyrightNotice = "Copyright © 2006 World Health Organization. Used with permission. Publications of the World Health Organization can be obtained from WHO Press, World Health Organization, 20 Avenue Appia, 1211 Geneva 27, Switzerland (tel: +41 22 791 2476; fax: +41 22 791 4857; email: bookorders@who.int). Requests for permission to reproduce or translate WHO publications – whether for sale or for noncommercial distribution – should be addressed to WHO Press, at the above address (fax: +41 22 791 4806; email: permissions@who.int). The designations employed and the presentation of the material in this publication do not imply the expression of any opinion whatsoever on the part of the World Health Organization concerning the legal status of any country, territory, city or area or of its authorities, or concerning the delimitation of its frontiers or boundaries. Dotted lines on maps represent approximate border lines for which there may not yet be full agreement. The mention of specific companies or of certain manufacturers’ products does not imply that they are endorsed or recommended by the World Health Organization in preference to others of a similar nature that are not mentioned. Errors and omissions excepted, the names of proprietary products are distinguished by initial capital letters. All reasonable precautions have been taken by WHO to verify the information contained in this publication. However, the published material is being distributed without warranty of any kind, either express or implied. The responsibility for the interpretation and use of the material lies with the reader. In no event shall the World Health Organization be liable for damages arising from its use.";
|
||||
assertEquals(expectedExternalCopyrightNotice, code.getStringProperty("EXTERNAL_COPYRIGHT_NOTICE"));
|
||||
|
||||
// Answer list
|
||||
|
|
|
@ -29,7 +29,6 @@ import ca.uhn.fhir.jpa.migrate.tasks.api.BaseMigrationTasks;
|
|||
import ca.uhn.fhir.jpa.model.entity.*;
|
||||
import ca.uhn.fhir.util.VersionEnum;
|
||||
|
||||
import javax.persistence.Index;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
@ -165,6 +164,9 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
|
|||
// TermValueSetConceptDesignation
|
||||
version.startSectionWithMessage("Processing table: TRM_VALUESET_C_DESIGNATION");
|
||||
version.onTable("TRM_VALUESET_C_DESIGNATION").modifyColumn("VAL").nonNullable().withType(BaseTableColumnTypeTask.ColumnTypeEnum.STRING, 2000);
|
||||
|
||||
version.startSectionWithMessage("Processing table: TRM_CONCEPT_PROPERTY");
|
||||
version.onTable("TRM_CONCEPT_PROPERTY").addColumn("PROP_VAL_LOB").nullable().type(BaseTableColumnTypeTask.ColumnTypeEnum.CLOB);
|
||||
}
|
||||
|
||||
protected void init400() {
|
||||
|
|
|
@ -276,6 +276,11 @@
|
|||
outdated argument list based on the Bundle needs in DSTU1. We are not aware of any
|
||||
public use of this API, please let us know if this deprecation causes any issues.
|
||||
</action>
|
||||
<action type="add" issue="1517">
|
||||
Support for concept property values with a length exceeding 500 characters has been added in the terminology
|
||||
tables. In particular, this was added to facilitate the LOINC EXTERNAL_COPYRIGHT_NOTICE property, for which
|
||||
values can be quite long.
|
||||
</action>
|
||||
</release>
|
||||
<release version="4.0.3" date="2019-09-03" description="Igloo (Point Release)">
|
||||
<action type="fix">
|
||||
|
|
Loading…
Reference in New Issue