From ad04b4723de6f5e04c631d11494a0f8ac8e50acd Mon Sep 17 00:00:00 2001 From: Alexander Rybakov <83988488+arybakov-cgi@users.noreply.github.com> Date: Fri, 5 Jan 2024 12:33:09 -0700 Subject: [PATCH 1/3] GRAD2-1704 (#295) Rename column in API Student Graduation TRANSCRIPT_MESSAGE --- .../model/dto/TranscriptMessage.java | 13 ++++------- .../model/entity/TranscriptMessageEntity.java | 12 ++++------ .../TranscriptMessageTransformer.java | 15 ++++++------ ...4__DDL-RENAME_COLUMN-TranscriptMessage.sql | 5 ++++ .../TranscriptMessageControllerTest.java | 23 +++++++++---------- .../service/TranscriptMessageServiceTest.java | 8 +++---- 6 files changed, 37 insertions(+), 39 deletions(-) create mode 100644 api/src/main/resources/db/migration/1.0/V1.0.84__DDL-RENAME_COLUMN-TranscriptMessage.sql diff --git a/api/src/main/java/ca/bc/gov/educ/api/studentgraduation/model/dto/TranscriptMessage.java b/api/src/main/java/ca/bc/gov/educ/api/studentgraduation/model/dto/TranscriptMessage.java index f5e559f..f2c8618 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/studentgraduation/model/dto/TranscriptMessage.java +++ b/api/src/main/java/ca/bc/gov/educ/api/studentgraduation/model/dto/TranscriptMessage.java @@ -1,18 +1,15 @@ package ca.bc.gov.educ.api.studentgraduation.model.dto; -import java.util.UUID; - -import org.springframework.stereotype.Component; - import lombok.Data; import lombok.EqualsAndHashCode; +import org.springframework.stereotype.Component; -import jakarta.persistence.Column; +import java.util.UUID; @Data @EqualsAndHashCode(callSuper = false) @Component -public class TranscriptMessage extends BaseModel{ +public class TranscriptMessage extends BaseModel { private UUID transcriptMessageID; private String programCode; @@ -21,7 +18,7 @@ public class TranscriptMessage extends BaseModel{ private String gradDateMessage; private String honourNote; private String adIBProgramMessage; - private String programCadre; + private String frenchImmersionMessage; private String careerProgramMessage; private String gradProjectedMessage; private String honourProjectedNote; @@ -37,7 +34,7 @@ public String toString() { ", gradDateMessage='" + gradDateMessage + '\'' + ", honourNote='" + honourNote + '\'' + ", adIBProgramMessage='" + adIBProgramMessage + '\'' + - ", programCadre='" + programCadre + '\'' + + ", frenchImmersionMessage='" + frenchImmersionMessage + '\'' + ", careerProgramMessage='" + careerProgramMessage + '\'' + ", gradProjectedMessage='" + gradProjectedMessage + '\'' + ", honourProjectedNote='" + honourProjectedNote + '\'' + diff --git a/api/src/main/java/ca/bc/gov/educ/api/studentgraduation/model/entity/TranscriptMessageEntity.java b/api/src/main/java/ca/bc/gov/educ/api/studentgraduation/model/entity/TranscriptMessageEntity.java index 86d366a..d7af119 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/studentgraduation/model/entity/TranscriptMessageEntity.java +++ b/api/src/main/java/ca/bc/gov/educ/api/studentgraduation/model/entity/TranscriptMessageEntity.java @@ -1,16 +1,14 @@ package ca.bc.gov.educ.api.studentgraduation.model.entity; -import java.util.UUID; - import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.Id; import jakarta.persistence.Table; - -import org.hibernate.annotations.Immutable; - import lombok.Data; import lombok.EqualsAndHashCode; +import org.hibernate.annotations.Immutable; + +import java.util.UUID; @Data @EqualsAndHashCode(callSuper = false) @@ -41,8 +39,8 @@ public class TranscriptMessageEntity extends BaseEntity { @Column(name = "AD_IB_PROGRAM_MESSAGE", nullable = false) private String adIBProgramMessage; - @Column(name = "PROGRAM_CADRE", nullable = false) - private String programCadre; + @Column(name = "FRENCH_IMMERSION_MESSAGE", nullable = false) + private String frenchImmersionMessage; @Column(name = "CAREER_PROGRAM_MESSAGE", nullable = false) private String careerProgramMessage; diff --git a/api/src/main/java/ca/bc/gov/educ/api/studentgraduation/model/transformer/TranscriptMessageTransformer.java b/api/src/main/java/ca/bc/gov/educ/api/studentgraduation/model/transformer/TranscriptMessageTransformer.java index b7549c5..b3af3c7 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/studentgraduation/model/transformer/TranscriptMessageTransformer.java +++ b/api/src/main/java/ca/bc/gov/educ/api/studentgraduation/model/transformer/TranscriptMessageTransformer.java @@ -1,15 +1,14 @@ package ca.bc.gov.educ.api.studentgraduation.model.transformer; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; - +import ca.bc.gov.educ.api.studentgraduation.model.dto.TranscriptMessage; +import ca.bc.gov.educ.api.studentgraduation.model.entity.TranscriptMessageEntity; import org.modelmapper.ModelMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import ca.bc.gov.educ.api.studentgraduation.model.dto.TranscriptMessage; -import ca.bc.gov.educ.api.studentgraduation.model.entity.TranscriptMessageEntity; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; @Component @@ -27,13 +26,13 @@ public TranscriptMessage transformToDTO ( Optional tran if (transcriptMessageEntity.isPresent()) cae = transcriptMessageEntity.get(); - return modelMapper.map(cae, TranscriptMessage.class); + return transformToDTO(cae); } public List transformToDTO (Iterable gradMessagingEntities ) { List gradMessagingList = new ArrayList<>(); for (TranscriptMessageEntity gradMessagingEntity : gradMessagingEntities) { - TranscriptMessage gradMessaging = modelMapper.map(gradMessagingEntity, TranscriptMessage.class); + TranscriptMessage gradMessaging = transformToDTO(gradMessagingEntity); gradMessagingList.add(gradMessaging); } return gradMessagingList; diff --git a/api/src/main/resources/db/migration/1.0/V1.0.84__DDL-RENAME_COLUMN-TranscriptMessage.sql b/api/src/main/resources/db/migration/1.0/V1.0.84__DDL-RENAME_COLUMN-TranscriptMessage.sql new file mode 100644 index 0000000..3cd17f0 --- /dev/null +++ b/api/src/main/resources/db/migration/1.0/V1.0.84__DDL-RENAME_COLUMN-TranscriptMessage.sql @@ -0,0 +1,5 @@ +ALTER TABLE TRANSCRIPT_MESSAGE RENAME COLUMN PROGRAM_CADRE to FRENCH_IMMERSION_MESSAGE ; + + + + diff --git a/api/src/test/java/ca/bc/gov/educ/api/studentgraduation/controller/TranscriptMessageControllerTest.java b/api/src/test/java/ca/bc/gov/educ/api/studentgraduation/controller/TranscriptMessageControllerTest.java index 3e61378..c2a3897 100644 --- a/api/src/test/java/ca/bc/gov/educ/api/studentgraduation/controller/TranscriptMessageControllerTest.java +++ b/api/src/test/java/ca/bc/gov/educ/api/studentgraduation/controller/TranscriptMessageControllerTest.java @@ -1,9 +1,10 @@ package ca.bc.gov.educ.api.studentgraduation.controller; -import java.sql.Date; -import java.util.ArrayList; -import java.util.List; - +import ca.bc.gov.educ.api.studentgraduation.model.dto.TranscriptMessage; +import ca.bc.gov.educ.api.studentgraduation.service.TranscriptMessageService; +import ca.bc.gov.educ.api.studentgraduation.util.GradValidation; +import ca.bc.gov.educ.api.studentgraduation.util.MessageHelper; +import ca.bc.gov.educ.api.studentgraduation.util.ResponseHelper; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; @@ -11,11 +12,9 @@ import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; -import ca.bc.gov.educ.api.studentgraduation.model.dto.TranscriptMessage; -import ca.bc.gov.educ.api.studentgraduation.service.TranscriptMessageService; -import ca.bc.gov.educ.api.studentgraduation.util.GradValidation; -import ca.bc.gov.educ.api.studentgraduation.util.MessageHelper; -import ca.bc.gov.educ.api.studentgraduation.util.ResponseHelper; +import java.sql.Date; +import java.util.ArrayList; +import java.util.List; @ExtendWith(MockitoExtension.class) @@ -47,7 +46,7 @@ public void testGetAllMessagingCodeList() { obj.setGradDateMessage("GD"); obj.setHonourNote("Y"); obj.setGradMainMessage("abcd"); - obj.setProgramCadre("PR"); + obj.setFrenchImmersionMessage("PR"); obj.setCreateUser("GRADUATION"); obj.setUpdateUser("GRADUATION"); obj.setCreateDate(new Date(System.currentTimeMillis())); @@ -61,7 +60,7 @@ public void testGetAllMessagingCodeList() { obj.setGradDateMessage("GD"); obj.setHonourNote("Y"); obj.setGradMainMessage("abcd"); - obj.setProgramCadre("PR"); + obj.setFrenchImmersionMessage("PR"); obj.setCreateUser("GRADUATION"); obj.setUpdateUser("GRADUATION"); obj.setCreateDate(new Date(System.currentTimeMillis())); @@ -84,7 +83,7 @@ public void testGetSpecificMessagingCode() { obj.setGradDateMessage("GD"); obj.setHonourNote("Y"); obj.setGradMainMessage("abcd"); - obj.setProgramCadre("PR"); + obj.setFrenchImmersionMessage("PR"); obj.setCreateUser("GRADUATION"); obj.setUpdateUser("GRADUATION"); obj.setCreateDate(new Date(System.currentTimeMillis())); diff --git a/api/src/test/java/ca/bc/gov/educ/api/studentgraduation/service/TranscriptMessageServiceTest.java b/api/src/test/java/ca/bc/gov/educ/api/studentgraduation/service/TranscriptMessageServiceTest.java index 3566ffd..1bdea57 100644 --- a/api/src/test/java/ca/bc/gov/educ/api/studentgraduation/service/TranscriptMessageServiceTest.java +++ b/api/src/test/java/ca/bc/gov/educ/api/studentgraduation/service/TranscriptMessageServiceTest.java @@ -52,7 +52,7 @@ public void testGetAllMessagingCodeList() { obj.setGradDateMessage("GD"); obj.setHonourNote("Y"); obj.setGradMainMessage("abcd"); - obj.setProgramCadre("PR"); + obj.setFrenchImmersionMessage("PR"); obj.setCreateUser("GRADUATION"); obj.setUpdateUser("GRADUATION"); obj.setCreateDate(new Date(System.currentTimeMillis())); @@ -67,7 +67,7 @@ public void testGetAllMessagingCodeList() { obj.setGradDateMessage("GD"); obj.setHonourNote("Y"); obj.setGradMainMessage("abcd"); - obj.setProgramCadre("PR"); + obj.setFrenchImmersionMessage("PR"); obj.setCreateUser("GRADUATION"); obj.setUpdateUser("GRADUATION"); obj.setCreateDate(new Date(System.currentTimeMillis())); @@ -89,7 +89,7 @@ public void testGetSpecificTranscriptMessageCode() { obj.setGradDateMessage("GD"); obj.setHonourNote("Y"); obj.setGradMainMessage("abcd"); - obj.setProgramCadre("PR"); + obj.setFrenchImmersionMessage("PR"); obj.setCreateUser("GRADUATION"); obj.setUpdateUser("GRADUATION"); obj.setCreateDate(new Date(System.currentTimeMillis())); @@ -103,7 +103,7 @@ public void testGetSpecificTranscriptMessageCode() { objEntity.setGradDateMessage("GD"); objEntity.setHonourNote("Y"); objEntity.setGradMainMessage("abcd"); - objEntity.setProgramCadre("PR"); + objEntity.setFrenchImmersionMessage("PR"); objEntity.setCreateUser("GRADUATION"); objEntity.setUpdateUser("GRADUATION"); objEntity.setCreateDate(new Date(System.currentTimeMillis())); From 905672752577d6fc1a0b6fba4fa270cb6d50b5e8 Mon Sep 17 00:00:00 2001 From: githubmamatha <106563495+githubmamatha@users.noreply.github.com> Date: Wed, 10 Jan 2024 10:19:49 -0800 Subject: [PATCH 2/3] Grad2-2468 Clean up graduation message. (#297) --- .../1.0/V1.0.85__DML-UPDATE_DATA-TRANSCRIPT_MESSAGE.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 api/src/main/resources/db/migration/1.0/V1.0.85__DML-UPDATE_DATA-TRANSCRIPT_MESSAGE.sql diff --git a/api/src/main/resources/db/migration/1.0/V1.0.85__DML-UPDATE_DATA-TRANSCRIPT_MESSAGE.sql b/api/src/main/resources/db/migration/1.0/V1.0.85__DML-UPDATE_DATA-TRANSCRIPT_MESSAGE.sql new file mode 100644 index 0000000..82a2cff --- /dev/null +++ b/api/src/main/resources/db/migration/1.0/V1.0.85__DML-UPDATE_DATA-TRANSCRIPT_MESSAGE.sql @@ -0,0 +1,3 @@ +UPDATE TRANSCRIPT_MESSAGE +SET FRENCH_IMMERSION_MESSAGE = '' +WHERE GRADUATION_PROGRAM_CODE LIKE '%-PF' AND MESSAGE_TYPE_CODE = 'GRADUATED'; \ No newline at end of file From bf4999f6671996f4f713b06752761296385019dd Mon Sep 17 00:00:00 2001 From: Kamal Mohammed Date: Mon, 15 Jan 2024 10:00:14 -0700 Subject: [PATCH 3/3] Update pom.xml --- api/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/pom.xml b/api/pom.xml index 04474a6..5e314d4 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -6,7 +6,7 @@ ca.bc.gov.educ educ-grad-student-graduation-api - 1.8.41 + 1.8.42 educ-grad-student-graduation-api Ministry of Education GRAD STUDENT GRADUATION API