diff --git a/api/pom.xml b/api/pom.xml
index 8ea119d7..a8c08838 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -6,7 +6,7 @@
ca.bc.gov.educ
educ-grad-student-api
- 1.8.61
+ 1.8.62
educ-grad-student-api
Student Demographics API for GRAD team
diff --git a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/util/EducGradStudentApiUtils.java b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/util/EducGradStudentApiUtils.java
index 240c0cc7..0d7d14a3 100644
--- a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/util/EducGradStudentApiUtils.java
+++ b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/util/EducGradStudentApiUtils.java
@@ -13,6 +13,7 @@
import java.time.Period;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
+import java.util.Calendar;
import java.util.Date;
public class EducGradStudentApiUtils {
@@ -107,10 +108,10 @@ public static HttpHeaders getHeaders (String accessToken)
public static String parsingTraxDate(String sessionDate) {
String actualSessionDate = sessionDate + "/01";
- Date temp = new Date();
+ Date temp;
String sDates = null;
try {
- temp = EducGradStudentApiUtils.parseDate(actualSessionDate, "yyyy/MM/dd");
+ temp = toLastDayOfMonth(EducGradStudentApiUtils.parseDate(actualSessionDate, "yyyy/MM/dd"));
sDates = EducGradStudentApiUtils.formatDate(temp, EducGradStudentApiConstants.DEFAULT_DATE_FORMAT);
} catch (ParseException pe) {
logger.error("ERROR: {}", pe.getMessage());
@@ -136,7 +137,7 @@ public static Date parsingProgramCompletionDate(String sessionDate) {
Date temp;
Date sDate = null;
try {
- temp = EducGradStudentApiUtils.parseDate(actualSessionDate, EducGradStudentApiConstants.DATE_FORMAT);
+ temp = toLastDayOfMonth(EducGradStudentApiUtils.parseDate(actualSessionDate, EducGradStudentApiConstants.DATE_FORMAT));
String sDates = EducGradStudentApiUtils.formatDate(temp, EducGradStudentApiConstants.DATE_FORMAT);
sDate = EducGradStudentApiUtils.parseDate(sDates, EducGradStudentApiConstants.DATE_FORMAT);
} catch (ParseException pe) {
@@ -188,4 +189,14 @@ public static GradStatusEventPayloadDTO transform(GraduationStudentRecordEntity
.build();
}
+ static Date toLastDayOfMonth(Date date) {
+ if(date != null) {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(date);
+ cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
+ return cal.getTime();
+ }
+ return null;
+ }
+
}
diff --git a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/util/GradLocalDateDeserializer.java b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/util/GradLocalDateDeserializer.java
index 6ab38ded..388ac7e1 100644
--- a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/util/GradLocalDateDeserializer.java
+++ b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/util/GradLocalDateDeserializer.java
@@ -13,6 +13,7 @@
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
+import java.time.temporal.TemporalAdjusters;
import static ca.bc.gov.educ.api.gradstudent.util.EducGradStudentApiConstants.SECOND_DEFAULT_DATE_FORMAT;
@@ -40,7 +41,7 @@ public LocalDate deserialize(JsonParser jsonParser, DeserializationContext deser
if(slashCount > 0) {
formatter = DateTimeFormatter.ofPattern(SECOND_DEFAULT_DATE_FORMAT);
}
- return LocalDate.parse(dateAsString, formatter);
+ return LocalDate.parse(dateAsString, formatter).with(TemporalAdjusters.lastDayOfMonth());
} else if(jsonParser.hasToken(JsonToken.VALUE_NUMBER_INT)) {
long timestamp = jsonParser.getValueAsLong();
return LocalDate.ofInstant(Instant.ofEpochMilli(timestamp), ZoneId.systemDefault());
diff --git a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/util/GradLocalDateTimeDeserializer.java b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/util/GradLocalDateTimeDeserializer.java
index 8d2ae1e9..459630ac 100644
--- a/api/src/main/java/ca/bc/gov/educ/api/gradstudent/util/GradLocalDateTimeDeserializer.java
+++ b/api/src/main/java/ca/bc/gov/educ/api/gradstudent/util/GradLocalDateTimeDeserializer.java
@@ -14,6 +14,7 @@
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
+import java.time.temporal.TemporalAdjusters;
import static ca.bc.gov.educ.api.gradstudent.util.EducGradStudentApiConstants.*;
@@ -41,7 +42,7 @@ public LocalDateTime deserialize(JsonParser jsonParser, DeserializationContext d
if(slashCount > 0) {
formatter = DateTimeFormatter.ofPattern(SECOND_DEFAULT_DATE_FORMAT);
}
- return LocalDateTime.parse(dateAsString, formatter);
+ return LocalDateTime.parse(dateAsString, formatter).with(TemporalAdjusters.lastDayOfMonth());
} else if(jsonParser.hasToken(JsonToken.VALUE_NUMBER_INT)) {
long timestamp = jsonParser.getValueAsLong();
return LocalDateTime.ofInstant(Instant.ofEpochMilli(timestamp), ZoneId.systemDefault());
diff --git a/api/src/main/resources/db/migration/1.0/V1.0.67__DML-INSERT_TABLE-HISTORY_ACTIVITY_CODE.sql b/api/src/main/resources/db/migration/1.0/V1.0.67__DML-INSERT_TABLE-HISTORY_ACTIVITY_CODE.sql
new file mode 100644
index 00000000..fa6b6ffc
--- /dev/null
+++ b/api/src/main/resources/db/migration/1.0/V1.0.67__DML-INSERT_TABLE-HISTORY_ACTIVITY_CODE.sql
@@ -0,0 +1,19 @@
+INSERT INTO HISTORY_ACTIVITY_CODE
+(HISTORY_ACTIVITY_CODE,LABEL,DESCRIPTION,DISPLAY_ORDER,EFFECTIVE_DATE,EXPIRY_DATE)
+VALUES
+ ('INSTITUTEALERT','Institute Alert','Alerts received from Institute when either school or district data has changed',270,
+ TIMESTAMP'2024-06-21 00:00:00.0',NULL);
+
+
+INSERT INTO HISTORY_ACTIVITY_CODE
+(HISTORY_ACTIVITY_CODE,LABEL,DESCRIPTION,DISPLAY_ORDER,EFFECTIVE_DATE,EXPIRY_DATE)
+VALUES
+ ('PENALERT','PEN Alert','Alerts received from PEN when student demographic data has changed',280,
+ TIMESTAMP'2024-06-21 00:00:00.0',NULL);
+
+
+INSERT INTO HISTORY_ACTIVITY_CODE
+(HISTORY_ACTIVITY_CODE,LABEL,DESCRIPTION,DISPLAY_ORDER,EFFECTIVE_DATE,EXPIRY_DATE)
+VALUES
+ ('COREGALERT','Coreg Alert','Alerts received from Coreg when course data has changed',290,
+ TIMESTAMP'2024-06-21 00:00:00.0',NULL);