diff --git a/api/pom.xml b/api/pom.xml
index 6aa798c5..0a9923ca 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -6,7 +6,7 @@
ca.bc.gov.educ
educ-grad-student-api
- 1.8.48
+ 1.8.51
educ-grad-student-api
Student Demographics API for GRAD team
diff --git a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/entity/BaseEntity.java b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/entity/BaseEntity.java
index 4210e389..d3b957bd 100644
--- a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/entity/BaseEntity.java
+++ b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/entity/BaseEntity.java
@@ -1,20 +1,13 @@
package ca.bc.gov.educ.api.gradstudent.model.entity;
-import java.util.Date;
-
-import jakarta.persistence.Column;
-import jakarta.persistence.MappedSuperclass;
-import jakarta.persistence.PrePersist;
-import jakarta.persistence.PreUpdate;
-import jakarta.persistence.Temporal;
-import jakarta.persistence.TemporalType;
-
+import ca.bc.gov.educ.api.gradstudent.util.EducGradStudentApiConstants;
import ca.bc.gov.educ.api.gradstudent.util.ThreadLocalStateUtil;
+import jakarta.persistence.*;
+import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;
-import ca.bc.gov.educ.api.gradstudent.util.EducGradStudentApiConstants;
-import lombok.Data;
+import java.time.LocalDateTime;
@Data
@MappedSuperclass
@@ -25,7 +18,7 @@ public class BaseEntity {
@Column(name = "CREATE_DATE", columnDefinition="datetime",nullable = false)
@Temporal(TemporalType.TIMESTAMP)
@DateTimeFormat(pattern = "yyyy-mm-dd hh:mm:ss")
- private Date createDate;
+ private LocalDateTime createDate;
@Column(name = "UPDATE_USER", nullable = false)
@@ -34,7 +27,7 @@ public class BaseEntity {
@Column(name = "UPDATE_DATE", columnDefinition="datetime",nullable = true)
@Temporal(TemporalType.TIMESTAMP)
@DateTimeFormat(pattern = "yyyy-mm-dd hh:mm:ss")
- private Date updateDate;
+ private LocalDateTime updateDate;
@PrePersist
protected void onCreate() {
@@ -50,14 +43,14 @@ protected void onCreate() {
this.updateUser = EducGradStudentApiConstants.DEFAULT_UPDATED_BY;
}
}
- this.createDate = new Date(System.currentTimeMillis());
- this.updateDate = new Date(System.currentTimeMillis());
+ this.createDate = LocalDateTime.now();
+ this.updateDate = LocalDateTime.now();
}
@PreUpdate
protected void onPersist() {
- this.updateDate = new Date();
+ this.updateDate = LocalDateTime.now();
if (StringUtils.isBlank(updateUser)) {
this.updateUser = ThreadLocalStateUtil.getCurrentUser();
if (StringUtils.isBlank(updateUser)) {
@@ -71,7 +64,7 @@ protected void onPersist() {
}
}
if (this.createDate == null) {
- this.createDate = new Date();
+ this.createDate = LocalDateTime.now();
}
}
}
diff --git a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/transformer/GraduationStatusTransformer.java b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/transformer/GraduationStatusTransformer.java
index e91ae9d8..93af1623 100644
--- a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/transformer/GraduationStatusTransformer.java
+++ b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/model/transformer/GraduationStatusTransformer.java
@@ -5,7 +5,6 @@
import ca.bc.gov.educ.api.gradstudent.model.dto.GraduationStudentRecordDistribution;
import ca.bc.gov.educ.api.gradstudent.model.dto.ProjectedRunClob;
import ca.bc.gov.educ.api.gradstudent.model.entity.GraduationStudentRecordEntity;
-import ca.bc.gov.educ.api.gradstudent.util.DateUtils;
import ca.bc.gov.educ.api.gradstudent.util.EducGradStudentApiUtils;
import ca.bc.gov.educ.api.gradstudent.util.GradValidation;
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -129,8 +128,8 @@ public List tToDForBatch(Iterable transformToDTO (Iterable result = commonService.getAllStudentStatusCodeList();
@@ -346,8 +346,8 @@ public void testGetSpecificStudentStatusCode() {
objEntity.setDescription("Data Correction by School");
objEntity.setCreateUser("GRADUATION");
objEntity.setUpdateUser("GRADUATION");
- objEntity.setCreateDate(new Date());
- objEntity.setUpdateDate(new Date());
+ objEntity.setCreateDate(LocalDateTime.now());
+ objEntity.setUpdateDate(LocalDateTime.now());
Optional ent = Optional.of(objEntity);
Mockito.when(studentStatusRepository.findById(reasonCode)).thenReturn(ent);
StudentStatus result = commonService.getSpecificStudentStatusCode(reasonCode);
@@ -376,8 +376,8 @@ public void testCreateStudentStatus() {
objEntity.setDescription("Data Correction by School");
objEntity.setCreateUser("GRADUATION");
objEntity.setUpdateUser("GRADUATION");
- objEntity.setCreateDate(new Date());
- objEntity.setUpdateDate(new Date());
+ objEntity.setCreateDate(LocalDateTime.now());
+ objEntity.setUpdateDate(LocalDateTime.now());
Mockito.when(studentStatusRepository.findById(obj.getCode())).thenReturn(Optional.empty());
Mockito.when(studentStatusRepository.save(objEntity)).thenReturn(objEntity);
StudentStatus result = commonService.createStudentStatus(obj);
@@ -399,8 +399,8 @@ public void testCreateStudentStatus_codeAlreadyExists() {
objEntity.setDescription("Data Correction by School");
objEntity.setCreateUser("GRADUATION");
objEntity.setUpdateUser("GRADUATION");
- objEntity.setCreateDate(new Date());
- objEntity.setUpdateDate(new Date());
+ objEntity.setCreateDate(LocalDateTime.now());
+ objEntity.setUpdateDate(LocalDateTime.now());
Optional ent = Optional.of(objEntity);
Mockito.when(studentStatusRepository.findById(obj.getCode())).thenReturn(ent);
StudentStatus result = commonService.createStudentStatus(obj);
@@ -422,8 +422,8 @@ public void testUpdateStudentStatus() {
objEntity.setDescription("Data Correction by School");
objEntity.setCreateUser("GRADUATION");
objEntity.setUpdateUser("GRADUATION");
- objEntity.setCreateDate(new Date());
- objEntity.setUpdateDate(new Date());
+ objEntity.setCreateDate(LocalDateTime.now());
+ objEntity.setUpdateDate(LocalDateTime.now());
Optional ent = Optional.of(objEntity);
Mockito.when(studentStatusRepository.findById(obj.getCode())).thenReturn(ent);
Mockito.when(studentStatusRepository.save(objEntity)).thenReturn(objEntity);
@@ -444,7 +444,7 @@ public void testUpdateStudentStatus_noCreatedUpdatedByData() {
objEntity.setCode("DC");
objEntity.setDescription("Data Correction by School");
objEntity.setCreateUser("GRADUATION");
- objEntity.setCreateDate(new Date());
+ objEntity.setCreateDate(LocalDateTime.now());
Optional ent = Optional.of(objEntity);
Mockito.when(studentStatusRepository.findById(obj.getCode())).thenReturn(ent);
Mockito.when(studentStatusRepository.save(objEntity)).thenReturn(objEntity);
@@ -466,8 +466,8 @@ public void testUpdateStudentStatus_codeAlreadyExists() {
objEntity.setDescription("Data Correction by School");
objEntity.setCreateUser("GRADUATION");
objEntity.setUpdateUser("GRADUATION");
- objEntity.setCreateDate(new Date());
- objEntity.setUpdateDate(new Date());
+ objEntity.setCreateDate(LocalDateTime.now());
+ objEntity.setUpdateDate(LocalDateTime.now());
Mockito.when(studentStatusRepository.findById(obj.getCode())).thenReturn(Optional.empty());
StudentStatus result = commonService.updateStudentStatus(obj);
assertThat(result).isNotNull();
@@ -492,8 +492,8 @@ private StudentStatusEntity createStudentStatuses() {
objEntity.setDescription("Active");
objEntity.setCreateUser("GRADUATION");
objEntity.setUpdateUser("GRADUATION");
- objEntity.setCreateDate(new Date());
- objEntity.setUpdateDate(new Date());
+ objEntity.setCreateDate(LocalDateTime.now());
+ objEntity.setUpdateDate(LocalDateTime.now());
return objEntity;
}
@@ -505,16 +505,16 @@ public void testGetAllHistoryActivityCodeList() {
obj.setDescription("Data Correction by School");
obj.setCreateUser("GRADUATION");
obj.setUpdateUser("GRADUATION");
- obj.setCreateDate(new Date());
- obj.setUpdateDate(new Date());
+ obj.setCreateDate(LocalDateTime.now());
+ obj.setUpdateDate(LocalDateTime.now());
gradHistoryActivityList.add(obj);
obj = new HistoryActivityCodeEntity();
obj.setCode("CC");
obj.setDescription("Courses not complete");
obj.setCreateUser("GRADUATION");
obj.setUpdateUser("GRADUATION");
- obj.setCreateDate(new Date());
- obj.setUpdateDate(new Date());
+ obj.setCreateDate(LocalDateTime.now());
+ obj.setUpdateDate(LocalDateTime.now());
gradHistoryActivityList.add(obj);
Mockito.when(historyActivityRepository.findAll()).thenReturn(gradHistoryActivityList);
commonService.getAllHistoryActivityCodeList();
@@ -535,8 +535,8 @@ public void testGetSpecificHistoryActivityCode() {
objEntity.setDescription("Data Correction by School");
objEntity.setCreateUser("GRADUATION");
objEntity.setUpdateUser("GRADUATION");
- objEntity.setCreateDate(new Date());
- objEntity.setUpdateDate(new Date());
+ objEntity.setCreateDate(LocalDateTime.now());
+ objEntity.setUpdateDate(LocalDateTime.now());
Optional ent = Optional.of(objEntity);
Mockito.when(historyActivityRepository.findById(reasonCode)).thenReturn(ent);
commonService.getSpecificHistoryActivityCode(reasonCode);