From 0d0e72983f4dfaa59ff5b28d4d1f86d381272eb7 Mon Sep 17 00:00:00 2001 From: Quyen Ly Date: Tue, 20 Feb 2024 15:09:36 +0700 Subject: [PATCH] MAINT-2493 Change annotation column languageCode to languageDialectCode --- .../core/data/domain/Annotation.java | 20 +++++++++---------- .../core/data/domain/AnnotationView.java | 2 +- .../core/data/domain/ReferenceSetMember.java | 2 +- .../core/data/services/AutoMerger.java | 10 +++++----- src/main/resources/application.properties | 2 +- .../data/services/BranchMergeServiceTest.java | 2 +- .../data/services/ConceptServiceTest.java | 8 ++++---- .../snowstorm/rest/ConceptControllerTest.java | 2 +- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/main/java/org/snomed/snowstorm/core/data/domain/Annotation.java b/src/main/java/org/snomed/snowstorm/core/data/domain/Annotation.java index 601046306..39e793dbb 100644 --- a/src/main/java/org/snomed/snowstorm/core/data/domain/Annotation.java +++ b/src/main/java/org/snomed/snowstorm/core/data/domain/Annotation.java @@ -19,7 +19,7 @@ public class Annotation extends ReferenceSetMember implements AnnotationView { @JsonView(value = View.Component.class) private String value; @JsonView(value = View.Component.class) - private String languageCode; + private String languageDialectCode; @Override public String getAnnotationId() { @@ -76,12 +76,12 @@ public void setValue(String value) { } @Override - public String getLanguageCode() { - return languageCode; + public String getLanguageDialectCode() { + return languageDialectCode; } - public void setLanguageCode(String languageCode) { - this.languageCode = languageCode; + public void setLanguageDialectCode(String languageDialectCode) { + this.languageDialectCode = languageDialectCode; } public Annotation fromRefsetMember(ReferenceSetMember fromMember) { @@ -95,7 +95,7 @@ public Annotation fromRefsetMember(ReferenceSetMember fromMember) { setReleased(fromMember.isReleased()); setTypeId(fromMember.getAdditionalField(AnnotationFields.TYPE_ID)); setValue(fromMember.getAdditionalField(AnnotationFields.VALUE)); - setLanguageCode(fromMember.getAdditionalField(AnnotationFields.LANGUAGE_CODE)); + setLanguageDialectCode(fromMember.getAdditionalField(AnnotationFields.LANGUAGE_DIALECT_CODE)); return this; } @@ -106,7 +106,7 @@ public ReferenceSetMember toRefsetMember() { ReferenceSetMember member = new ReferenceSetMember(annotationId, getEffectiveTimeI(), isActive(), moduleId, refsetId, getReferencedComponentId()); member.setAdditionalField(AnnotationFields.TYPE_ID, getTypeId()); member.setAdditionalField(AnnotationFields.VALUE, getValue()); - member.setAdditionalField(AnnotationFields.LANGUAGE_CODE, getLanguageCode()); + member.setAdditionalField(AnnotationFields.LANGUAGE_DIALECT_CODE, getLanguageDialectCode()); return member; } @@ -120,7 +120,7 @@ public boolean equals(Object o) { Objects.equals(getRefsetId(), that.getRefsetId()) && Objects.equals(getReferencedComponentId(), that.getReferencedComponentId()) && Objects.equals(getTypeId(), that.getTypeId()) && - Objects.equals(getLanguageCode(), that.getLanguageCode()) && + Objects.equals(getLanguageDialectCode(), that.getLanguageDialectCode()) && Objects.equals(getValue(), that.getValue()); } @@ -129,7 +129,7 @@ public int hashCode() { if (annotationId != null) { return annotationId.hashCode(); } - return Objects.hash(annotationId, active, getModuleId(), getRefsetId(), getReferencedComponentId(), getTypeId(), getLanguageCode(), getValue()); + return Objects.hash(annotationId, active, getModuleId(), getRefsetId(), getReferencedComponentId(), getTypeId(), getLanguageDialectCode(), getValue()); } @Override @@ -139,7 +139,7 @@ public String toString() { ", annotationTypeId='" + typeId + '\'' + ", annotationType=" + type + ", annotationValue='" + value + '\'' + - ", annotationLanguage='" + languageCode + '\'' + + ", annotationLanguageDialectCode='" + languageDialectCode + '\'' + ", effectiveTime='" + getEffectiveTimeI() + '\'' + ", released='" + isReleased() + '\'' + ", releasedEffectiveTime='" + getReleasedEffectiveTime() + '\'' + diff --git a/src/main/java/org/snomed/snowstorm/core/data/domain/AnnotationView.java b/src/main/java/org/snomed/snowstorm/core/data/domain/AnnotationView.java index 7f591528d..7dd6b4443 100644 --- a/src/main/java/org/snomed/snowstorm/core/data/domain/AnnotationView.java +++ b/src/main/java/org/snomed/snowstorm/core/data/domain/AnnotationView.java @@ -14,7 +14,7 @@ public interface AnnotationView { String getValue(); - String getLanguageCode(); + String getLanguageDialectCode(); String getModuleId(); diff --git a/src/main/java/org/snomed/snowstorm/core/data/domain/ReferenceSetMember.java b/src/main/java/org/snomed/snowstorm/core/data/domain/ReferenceSetMember.java index f9b091dac..215c97c69 100644 --- a/src/main/java/org/snomed/snowstorm/core/data/domain/ReferenceSetMember.java +++ b/src/main/java/org/snomed/snowstorm/core/data/domain/ReferenceSetMember.java @@ -62,7 +62,7 @@ public interface MRCMAttributeDomainFields { } public interface AnnotationFields { - String LANGUAGE_CODE = "languageCode"; + String LANGUAGE_DIALECT_CODE = "languageDialectCode"; String TYPE_ID = "typeId"; String VALUE = "value"; } diff --git a/src/main/java/org/snomed/snowstorm/core/data/services/AutoMerger.java b/src/main/java/org/snomed/snowstorm/core/data/services/AutoMerger.java index 9b4f8ecaf..d87ccc589 100644 --- a/src/main/java/org/snomed/snowstorm/core/data/services/AutoMerger.java +++ b/src/main/java/org/snomed/snowstorm/core/data/services/AutoMerger.java @@ -554,18 +554,18 @@ private void reapplyAnnotationMemberChanges(Map sour ) ); mergedReferenceSetMember.setAdditionalField( - ReferenceSetMember.AnnotationFields.LANGUAGE_CODE, + ReferenceSetMember.AnnotationFields.LANGUAGE_DIALECT_CODE, getValueChanged( - targetReferenceSetMemberOld.getAdditionalField(ReferenceSetMember.AnnotationFields.LANGUAGE_CODE), - targetReferenceSetMemberNew.getAdditionalField(ReferenceSetMember.AnnotationFields.LANGUAGE_CODE), - sourceReferenceSetMember.getAdditionalField(ReferenceSetMember.AnnotationFields.LANGUAGE_CODE) + targetReferenceSetMemberOld.getAdditionalField(ReferenceSetMember.AnnotationFields.LANGUAGE_DIALECT_CODE), + targetReferenceSetMemberNew.getAdditionalField(ReferenceSetMember.AnnotationFields.LANGUAGE_DIALECT_CODE), + sourceReferenceSetMember.getAdditionalField(ReferenceSetMember.AnnotationFields.LANGUAGE_DIALECT_CODE) ) ); } else { mergedReferenceSetMember.setRefsetId(sourceReferenceSetMember.getRefsetId()); mergedReferenceSetMember.setAdditionalField(ReferenceSetMember.AnnotationFields.TYPE_ID, sourceReferenceSetMember.getAdditionalField(ReferenceSetMember.AnnotationFields.TYPE_ID)); mergedReferenceSetMember.setAdditionalField(ReferenceSetMember.AnnotationFields.VALUE, sourceReferenceSetMember.getAdditionalField(ReferenceSetMember.AnnotationFields.VALUE)); - mergedReferenceSetMember.setAdditionalField(ReferenceSetMember.AnnotationFields.LANGUAGE_CODE, sourceReferenceSetMember.getAdditionalField(ReferenceSetMember.AnnotationFields.LANGUAGE_CODE)); + mergedReferenceSetMember.setAdditionalField(ReferenceSetMember.AnnotationFields.LANGUAGE_DIALECT_CODE, sourceReferenceSetMember.getAdditionalField(ReferenceSetMember.AnnotationFields.LANGUAGE_DIALECT_CODE)); } // Re-apply mutable fields diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index faea63118..0309ca6d2 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -171,7 +171,7 @@ refset.types.Language=900000000000506000|Language|c|acceptabilityId refset.types.AssociationReference=900000000000521006|Content|c|targetComponentId refset.types.AttributeValue=900000000000480006|Content|c|valueId refset.types.Simple=446609009|Content|| -refset.types.Annotation=1292992004|Content|scs|languageCode,typeId,value +refset.types.Annotation=1292992004|Content|scs|languageDialectCode,typeId,value refset.types.SimpleMapToSCT=1187636009|Map|s|mapSource refset.types.SimpleMapFromSCT=900000000000496009|Map|s|mapTarget refset.types.SimpleMapCorrelationToSCT=1193543008|Map|sc|mapSource,correlationId diff --git a/src/test/java/org/snomed/snowstorm/core/data/services/BranchMergeServiceTest.java b/src/test/java/org/snomed/snowstorm/core/data/services/BranchMergeServiceTest.java index 4ffc4309f..4c458dadd 100644 --- a/src/test/java/org/snomed/snowstorm/core/data/services/BranchMergeServiceTest.java +++ b/src/test/java/org/snomed/snowstorm/core/data/services/BranchMergeServiceTest.java @@ -4591,7 +4591,7 @@ void testRebasingAnnotationChanges() throws ServiceException, InterruptedExcepti annotation.setModuleId("900000000000207008"); annotation.setTypeId("123456"); annotation.setValue("In the third International Consensus Definitions for Sepsis and Septic Shock (Sepsis-3) published in 2016."); - annotation.setLanguageCode("en"); + annotation.setLanguageDialectCode("en"); // Create project branchService.create("MAIN/projectA"); diff --git a/src/test/java/org/snomed/snowstorm/core/data/services/ConceptServiceTest.java b/src/test/java/org/snomed/snowstorm/core/data/services/ConceptServiceTest.java index b781cbe05..27dce3305 100644 --- a/src/test/java/org/snomed/snowstorm/core/data/services/ConceptServiceTest.java +++ b/src/test/java/org/snomed/snowstorm/core/data/services/ConceptServiceTest.java @@ -243,7 +243,7 @@ void testCreateDeleteConcept() throws ServiceException { annotation.setModuleId("900000000000207008"); annotation.setTypeId("123456"); annotation.setValue("Annotation with language"); - annotation.setLanguageCode("en"); + annotation.setLanguageDialectCode("en"); conceptService.create(new Concept(conceptId).addAxiom(new Relationship(ISA, SNOMEDCT_ROOT)).addAnnotation(annotation), path); @@ -524,7 +524,7 @@ void testSaveConceptWithAnnotation() throws ServiceException { annotation1.setModuleId("900000000000207008"); annotation1.setTypeId("123456"); annotation1.setValue("Annotation with language"); - annotation1.setLanguageCode("en"); + annotation1.setLanguageDialectCode("en"); Annotation annotation2 = new Annotation(); annotation2.setModuleId("900000000000207008"); @@ -539,9 +539,9 @@ void testSaveConceptWithAnnotation() throws ServiceException { assertEquals(2, savedConcept.getAnnotations().size()); for (Annotation annotation : savedConcept.getAnnotations()) { assertEquals(Concepts.ANNOTATION_REFERENCE_SET, annotation.getRefsetId()); - if (annotation.getLanguageCode() != null) { + if (annotation.getLanguageDialectCode() != null) { assertEquals("123456", annotation.getTypeId()); - assertEquals("en", annotation.getLanguageCode()); + assertEquals("en", annotation.getLanguageDialectCode()); assertEquals("Annotation with language", annotation.getValue()); } else { assertEquals("123456789", annotation.getTypeId()); diff --git a/src/test/java/org/snomed/snowstorm/rest/ConceptControllerTest.java b/src/test/java/org/snomed/snowstorm/rest/ConceptControllerTest.java index 9f615fd1c..2dba36b4f 100644 --- a/src/test/java/org/snomed/snowstorm/rest/ConceptControllerTest.java +++ b/src/test/java/org/snomed/snowstorm/rest/ConceptControllerTest.java @@ -119,7 +119,7 @@ void setup() throws ServiceException, InterruptedException { annotation.setModuleId("900000000000207008"); annotation.setTypeId("123456"); annotation.setValue("In the third International Consensus Definitions for Sepsis and Septic Shock (Sepsis-3) published in 2016."); - annotation.setLanguageCode("en"); + annotation.setLanguageDialectCode("en"); concept.getAnnotations().add(annotation); conceptService.update(concept, "MAIN");