Skip to content

Commit

Permalink
MAINT-2493 Change annotation column languageCode to languageDialectCode
Browse files Browse the repository at this point in the history
  • Loading branch information
QuyenLy87 authored and pgwilliams committed Feb 26, 2024
1 parent 0c37107 commit 0d0e729
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 24 deletions.
20 changes: 10 additions & 10 deletions src/main/java/org/snomed/snowstorm/core/data/domain/Annotation.java
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
}

Expand All @@ -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;
}

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

Expand All @@ -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
Expand All @@ -139,7 +139,7 @@ public String toString() {
", annotationTypeId='" + typeId + '\'' +
", annotationType=" + type +
", annotationValue='" + value + '\'' +
", annotationLanguage='" + languageCode + '\'' +
", annotationLanguageDialectCode='" + languageDialectCode + '\'' +
", effectiveTime='" + getEffectiveTimeI() + '\'' +
", released='" + isReleased() + '\'' +
", releasedEffectiveTime='" + getReleasedEffectiveTime() + '\'' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public interface AnnotationView {

String getValue();

String getLanguageCode();
String getLanguageDialectCode();

String getModuleId();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -554,18 +554,18 @@ private void reapplyAnnotationMemberChanges(Map<String, ReferenceSetMember> 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
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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");
Expand All @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 0d0e729

Please sign in to comment.