diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/AlgorithmRuleCode.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/AlgorithmRuleCode.java index e706e5dd..9bcbc9e9 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/AlgorithmRuleCode.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/AlgorithmRuleCode.java @@ -1,12 +1,13 @@ package ca.bc.gov.educ.api.ruleengine.dto; +import lombok.Data; import org.springframework.stereotype.Component; -import lombok.Data; +import java.io.Serializable; @Data @Component -public class AlgorithmRuleCode { +public class AlgorithmRuleCode implements Serializable { private String algoRuleCode; private String ruleImplementation; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/Assessment.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/Assessment.java index 994a749e..d37f6df2 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/Assessment.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/Assessment.java @@ -1,14 +1,14 @@ package ca.bc.gov.educ.api.ruleengine.dto; -import java.sql.Date; - +import lombok.Data; import org.springframework.stereotype.Component; -import lombok.Data; +import java.io.Serializable; +import java.sql.Date; @Data @Component -public class Assessment { +public class Assessment implements Serializable { private String assessmentCode; private String assessmentName; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/AssessmentRequirement.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/AssessmentRequirement.java index 3638d956..8d7d5cf4 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/AssessmentRequirement.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/AssessmentRequirement.java @@ -1,14 +1,14 @@ package ca.bc.gov.educ.api.ruleengine.dto; -import java.util.UUID; - +import lombok.Data; import org.springframework.stereotype.Component; -import lombok.Data; +import java.io.Serializable; +import java.util.UUID; @Data @Component -public class AssessmentRequirement { +public class AssessmentRequirement implements Serializable { private UUID assessmentRequirementId; private String assessmentCode; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/AssessmentRequirementCode.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/AssessmentRequirementCode.java index abe13a04..a3fd1ff1 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/AssessmentRequirementCode.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/AssessmentRequirementCode.java @@ -1,14 +1,14 @@ package ca.bc.gov.educ.api.ruleengine.dto; -import java.sql.Date; - +import lombok.Data; import org.springframework.stereotype.Component; -import lombok.Data; +import java.io.Serializable; +import java.sql.Date; @Data @Component -public class AssessmentRequirementCode { +public class AssessmentRequirementCode implements Serializable { private String assmtRequirementCode; private String label; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/CourseRequirement.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/CourseRequirement.java index 4f12a4f1..9b575029 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/CourseRequirement.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/CourseRequirement.java @@ -1,14 +1,14 @@ package ca.bc.gov.educ.api.ruleengine.dto; -import java.util.UUID; - +import lombok.Data; import org.springframework.stereotype.Component; -import lombok.Data; +import java.io.Serializable; +import java.util.UUID; @Data @Component -public class CourseRequirement { +public class CourseRequirement implements Serializable { private UUID courseRequirementId; private String courseCode; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/CourseRequirementCodeDTO.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/CourseRequirementCodeDTO.java index 0544a9dd..937f0fc1 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/CourseRequirementCodeDTO.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/CourseRequirementCodeDTO.java @@ -1,16 +1,16 @@ package ca.bc.gov.educ.api.ruleengine.dto; -import java.sql.Date; - -import org.springframework.stereotype.Component; - import lombok.Data; import lombok.EqualsAndHashCode; +import org.springframework.stereotype.Component; + +import java.io.Serializable; +import java.sql.Date; @Data @EqualsAndHashCode(callSuper = false) @Component -public class CourseRequirementCodeDTO { +public class CourseRequirementCodeDTO implements Serializable { private String courseRequirementCode; private String label; private String description; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/CourseRequirements.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/CourseRequirements.java index a887fc5e..0fa3bea1 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/CourseRequirements.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/CourseRequirements.java @@ -3,10 +3,11 @@ import lombok.Data; import org.springframework.stereotype.Component; +import java.io.Serializable; import java.util.List; @Data @Component -public class CourseRequirements { +public class CourseRequirements implements Serializable { List courseRequirementList; } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/CourseRestriction.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/CourseRestriction.java index a78aa4f9..a7da32e2 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/CourseRestriction.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/CourseRestriction.java @@ -1,14 +1,14 @@ package ca.bc.gov.educ.api.ruleengine.dto; -import java.util.UUID; - +import lombok.Data; import org.springframework.stereotype.Component; -import lombok.Data; +import java.io.Serializable; +import java.util.UUID; @Data @Component -public class CourseRestriction { +public class CourseRestriction implements Serializable { private UUID courseRestrictionId; private String mainCourse; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GradAlgorithmGraduationStatus.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GradAlgorithmGraduationStatus.java index 1e52e852..68da52e5 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GradAlgorithmGraduationStatus.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GradAlgorithmGraduationStatus.java @@ -1,15 +1,15 @@ package ca.bc.gov.educ.api.ruleengine.dto; import lombok.Data; +import org.springframework.stereotype.Component; +import java.io.Serializable; import java.sql.Date; import java.util.UUID; -import org.springframework.stereotype.Component; - @Data @Component -public class GradAlgorithmGraduationStatus { +public class GradAlgorithmGraduationStatus implements Serializable { private String pen; private String program; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GradProgramRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GradProgramRule.java index 8a7e0ce5..632851d1 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GradProgramRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GradProgramRule.java @@ -1,14 +1,14 @@ package ca.bc.gov.educ.api.ruleengine.dto; -import java.util.UUID; - +import lombok.Data; import org.springframework.stereotype.Component; -import lombok.Data; +import java.io.Serializable; +import java.util.UUID; @Data @Component -public class GradProgramRule { +public class GradProgramRule implements Serializable { private UUID id; private String ruleCode; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GradProgramRules.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GradProgramRules.java index 3169122a..bc5f4904 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GradProgramRules.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GradProgramRules.java @@ -3,10 +3,11 @@ import lombok.Data; import org.springframework.stereotype.Component; +import java.io.Serializable; import java.util.List; @Component @Data -public class GradProgramRules { +public class GradProgramRules implements Serializable { List gradProgramRuleList; } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GradRequirement.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GradRequirement.java index 87e85fc5..e46a389a 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GradRequirement.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GradRequirement.java @@ -5,13 +5,14 @@ import lombok.NoArgsConstructor; import org.springframework.stereotype.Component; +import java.io.Serializable; import java.util.Objects; @Component @Data @NoArgsConstructor @AllArgsConstructor -public class GradRequirement { +public class GradRequirement implements Serializable { String transcriptRule; String description; String rule; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GradSearchStudent.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GradSearchStudent.java index 07155123..503a3eff 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GradSearchStudent.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GradSearchStudent.java @@ -5,11 +5,13 @@ import lombok.NoArgsConstructor; import lombok.experimental.SuperBuilder; +import java.io.Serializable; + @Data @SuperBuilder @AllArgsConstructor @NoArgsConstructor -public class GradSearchStudent { +public class GradSearchStudent implements Serializable { private String studentID; private String pen; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GradStudent.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GradStudent.java index b490e3b3..0751ff22 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GradStudent.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GradStudent.java @@ -6,6 +6,8 @@ import lombok.NoArgsConstructor; import org.springframework.stereotype.Component; +import java.io.Serializable; + /** * The type for Grad Student. */ @@ -14,7 +16,7 @@ @Builder @AllArgsConstructor @NoArgsConstructor -public class GradStudent { +public class GradStudent implements Serializable { private String pen; private String archiveFlag; private String studSurname; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GraduationProgramCode.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GraduationProgramCode.java index 21d6d897..30f4e66b 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GraduationProgramCode.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/GraduationProgramCode.java @@ -1,16 +1,16 @@ package ca.bc.gov.educ.api.ruleengine.dto; -import java.util.Date; - -import org.springframework.stereotype.Component; - import lombok.Data; import lombok.EqualsAndHashCode; +import org.springframework.stereotype.Component; + +import java.io.Serializable; +import java.util.Date; @Data @EqualsAndHashCode(callSuper=false) @Component -public class GraduationProgramCode { +public class GraduationProgramCode implements Serializable { private String programCode; private String programName; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/LetterGrade.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/LetterGrade.java index f6e91f69..f9e2f0fb 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/LetterGrade.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/LetterGrade.java @@ -1,12 +1,13 @@ package ca.bc.gov.educ.api.ruleengine.dto; +import lombok.Data; import org.springframework.stereotype.Component; -import lombok.Data; +import java.io.Serializable; @Data @Component -public class LetterGrade { +public class LetterGrade implements Serializable { private String grade; private String gpaMarkValue; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/OptionalGradAlgorithmGraduationStatus.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/OptionalGradAlgorithmGraduationStatus.java index 36e2cfc1..a407b223 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/OptionalGradAlgorithmGraduationStatus.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/OptionalGradAlgorithmGraduationStatus.java @@ -1,15 +1,15 @@ package ca.bc.gov.educ.api.ruleengine.dto; -import java.util.List; -import java.util.UUID; - +import lombok.Data; import org.springframework.stereotype.Component; -import lombok.Data; +import java.io.Serializable; +import java.util.List; +import java.util.UUID; @Data @Component -public class OptionalGradAlgorithmGraduationStatus { +public class OptionalGradAlgorithmGraduationStatus implements Serializable { private String pen; private UUID optionalProgramID; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/OptionalProgram.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/OptionalProgram.java index 30a249b0..85fdabc1 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/OptionalProgram.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/OptionalProgram.java @@ -1,15 +1,15 @@ package ca.bc.gov.educ.api.ruleengine.dto; -import java.util.Date; -import java.util.UUID; - +import lombok.Data; import org.springframework.stereotype.Component; -import lombok.Data; +import java.io.Serializable; +import java.util.Date; +import java.util.UUID; @Data @Component -public class OptionalProgram { +public class OptionalProgram implements Serializable { private UUID optionalProgramID; private String optProgramCode; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/OptionalProgramRequirement.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/OptionalProgramRequirement.java index cef19f91..3307f5ba 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/OptionalProgramRequirement.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/OptionalProgramRequirement.java @@ -1,14 +1,14 @@ package ca.bc.gov.educ.api.ruleengine.dto; -import java.util.UUID; - +import lombok.Data; import org.springframework.stereotype.Component; -import lombok.Data; +import java.io.Serializable; +import java.util.UUID; @Data @Component -public class OptionalProgramRequirement { +public class OptionalProgramRequirement implements Serializable { private UUID optionalProgramRequirementID; private OptionalProgram optionalProgramID; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/OptionalProgramRequirementCode.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/OptionalProgramRequirementCode.java index 3d42672d..b50dce96 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/OptionalProgramRequirementCode.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/OptionalProgramRequirementCode.java @@ -1,12 +1,13 @@ package ca.bc.gov.educ.api.ruleengine.dto; +import lombok.Data; import org.springframework.stereotype.Component; -import lombok.Data; +import java.io.Serializable; @Data @Component -public class OptionalProgramRequirementCode { +public class OptionalProgramRequirementCode implements Serializable { private String optProReqCode; private String label; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/OptionalProgramRuleProcessor.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/OptionalProgramRuleProcessor.java index 030858b3..232bd46c 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/OptionalProgramRuleProcessor.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/OptionalProgramRuleProcessor.java @@ -3,12 +3,13 @@ import lombok.Data; import org.springframework.stereotype.Component; +import java.io.Serializable; import java.util.List; import java.util.UUID; @Data @Component -public class OptionalProgramRuleProcessor { +public class OptionalProgramRuleProcessor implements Serializable { private UUID optionalProgramID; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/ProgramAlgorithmRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/ProgramAlgorithmRule.java index 13114966..b0efc263 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/ProgramAlgorithmRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/ProgramAlgorithmRule.java @@ -1,14 +1,14 @@ package ca.bc.gov.educ.api.ruleengine.dto; -import java.util.UUID; - +import lombok.Data; import org.springframework.stereotype.Component; -import lombok.Data; +import java.io.Serializable; +import java.util.UUID; @Data @Component -public class ProgramAlgorithmRule { +public class ProgramAlgorithmRule implements Serializable { private UUID programAlgoRuleID; private String graduationProgramCode; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/ProgramRequirement.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/ProgramRequirement.java index 68306da2..554050d8 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/ProgramRequirement.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/ProgramRequirement.java @@ -1,14 +1,14 @@ package ca.bc.gov.educ.api.ruleengine.dto; -import java.util.UUID; - +import lombok.Data; import org.springframework.stereotype.Component; -import lombok.Data; +import java.io.Serializable; +import java.util.UUID; @Data @Component -public class ProgramRequirement { +public class ProgramRequirement implements Serializable { private UUID programRequirementID; private String graduationProgramCode; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/ProgramRequirementCode.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/ProgramRequirementCode.java index 5bdd2957..12c2bebf 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/ProgramRequirementCode.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/ProgramRequirementCode.java @@ -1,12 +1,13 @@ package ca.bc.gov.educ.api.ruleengine.dto; +import lombok.Data; import org.springframework.stereotype.Component; -import lombok.Data; +import java.io.Serializable; @Data @Component -public class ProgramRequirementCode { +public class ProgramRequirementCode implements Serializable { private String proReqCode; private String label; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/RequirementTypeCode.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/RequirementTypeCode.java index abb6f44a..65fb0fca 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/RequirementTypeCode.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/RequirementTypeCode.java @@ -1,14 +1,14 @@ package ca.bc.gov.educ.api.ruleengine.dto; -import java.util.Date; - +import lombok.Data; import org.springframework.stereotype.Component; -import lombok.Data; +import java.io.Serializable; +import java.util.Date; @Data @Component -public class RequirementTypeCode { +public class RequirementTypeCode implements Serializable { private String reqTypeCode; private String label; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/RuleData.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/RuleData.java index fb818f51..689f520a 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/RuleData.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/RuleData.java @@ -1,5 +1,7 @@ package ca.bc.gov.educ.api.ruleengine.dto; -public interface RuleData { +import java.io.Serializable; + +public interface RuleData extends Serializable { } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/School.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/School.java index 5bbcd167..c977ff45 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/School.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/School.java @@ -1,12 +1,13 @@ package ca.bc.gov.educ.api.ruleengine.dto; +import lombok.Data; import org.springframework.stereotype.Component; -import lombok.Data; +import java.io.Serializable; @Data @Component -public class School { +public class School implements Serializable { private String minCode; private String schoolName; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/SpecialCase.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/SpecialCase.java index b5a76ce6..348a4bcb 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/SpecialCase.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/SpecialCase.java @@ -1,14 +1,14 @@ package ca.bc.gov.educ.api.ruleengine.dto; -import java.sql.Date; - +import lombok.Data; import org.springframework.stereotype.Component; -import lombok.Data; +import java.io.Serializable; +import java.sql.Date; @Data @Component -public class SpecialCase { +public class SpecialCase implements Serializable { private String spCase; private String label; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/StudentAssessment.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/StudentAssessment.java index d54ba4c2..6f4d1812 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/StudentAssessment.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/StudentAssessment.java @@ -3,11 +3,12 @@ import lombok.Data; import org.springframework.stereotype.Component; +import java.io.Serializable; import java.util.Objects; @Data @Component -public class StudentAssessment { +public class StudentAssessment implements Serializable { private String pen; private String assessmentCode; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/StudentCareerProgram.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/StudentCareerProgram.java index 2644741e..f7ecb8b3 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/StudentCareerProgram.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/StudentCareerProgram.java @@ -4,12 +4,13 @@ import lombok.EqualsAndHashCode; import org.springframework.stereotype.Component; +import java.io.Serializable; import java.util.UUID; @Data @EqualsAndHashCode(callSuper = false) @Component -public class StudentCareerProgram { +public class StudentCareerProgram implements Serializable { private UUID id; private String careerProgramCode; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/StudentCourse.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/StudentCourse.java index 7418c5f9..ac99ca82 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/StudentCourse.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/StudentCourse.java @@ -6,12 +6,14 @@ import lombok.NoArgsConstructor; import org.springframework.stereotype.Component; +import java.io.Serializable; + @Component @Data @Builder @AllArgsConstructor @NoArgsConstructor -public class StudentCourse { +public class StudentCourse implements Serializable { private String pen; private String courseCode; @@ -84,15 +86,56 @@ public String getCourseLevel() { @Override public String toString() { - return "StudentCourse [pen=" + pen + ", courseCode=" + courseCode + ", courseName=" + courseName - + ", courseLevel=" + courseLevel + ", sessionDate=" + sessionDate + ", customizedCourseName=" - + customizedCourseName + ", gradReqMet=" + gradReqMet + ", gradReqMetDetail=" + gradReqMetDetail - + ", completedCoursePercentage=" + completedCoursePercentage + ", completedCourseLetterGrade=" - + completedCourseLetterGrade + ", interimPercent=" + interimPercent + ", interimLetterGrade=" - + interimLetterGrade + ", credits=" + credits + ", creditsUsedForGrad=" + creditsUsedForGrad - + ", relatedCourse=" + relatedCourse + ", relatedLevel=" + relatedLevel + ", hasRelatedCourse=" - + hasRelatedCourse + ", isNotCompleted=" + isNotCompleted + ", isProjected=" + isProjected - + ", isFailed=" + isFailed + ", isDuplicate=" + isDuplicate + ", isCareerPrep=" + isCareerPrep - + ", isLocallyDeveloped=" + isLocallyDeveloped + ", isUsed=" + isUsed + ", isRestricted=" + isRestricted +"]"; + return "StudentCourse{" + + "pen='" + pen + '\'' + + ", courseCode='" + courseCode + '\'' + + ", courseName='" + courseName + '\'' + + ", originalCredits=" + originalCredits + + ", courseLevel='" + courseLevel + '\'' + + ", sessionDate='" + sessionDate + '\'' + + ", customizedCourseName='" + customizedCourseName + '\'' + + ", gradReqMet='" + gradReqMet + '\'' + + ", gradReqMetDetail='" + gradReqMetDetail + '\'' + + ", completedCoursePercentage=" + completedCoursePercentage + + ", completedCourseLetterGrade='" + completedCourseLetterGrade + '\'' + + ", interimPercent=" + interimPercent + + ", interimLetterGrade='" + interimLetterGrade + '\'' + + ", bestSchoolPercent=" + bestSchoolPercent + + ", bestExamPercent=" + bestExamPercent + + ", schoolPercent=" + schoolPercent + + ", examPercent=" + examPercent + + ", equivOrChallenge='" + equivOrChallenge + '\'' + + ", fineArtsAppliedSkills='" + fineArtsAppliedSkills + '\'' + + ", metLitNumRequirement='" + metLitNumRequirement + '\'' + + ", credits=" + credits + + ", creditsUsedForGrad=" + creditsUsedForGrad + + ", relatedCourse='" + relatedCourse + '\'' + + ", relatedCourseName='" + relatedCourseName + '\'' + + ", relatedLevel='" + relatedLevel + '\'' + + ", hasRelatedCourse='" + hasRelatedCourse + '\'' + + ", isNotCompleted=" + isNotCompleted + + ", genericCourseType='" + genericCourseType + '\'' + + ", language='" + language + '\'' + + ", workExpFlag='" + workExpFlag + '\'' + + ", specialCase='" + specialCase + '\'' + + ", toWriteFlag='" + toWriteFlag + '\'' + + ", provExamCourse='" + provExamCourse + '\'' + + ", isProjected=" + isProjected + + ", isFailed=" + isFailed + + ", isDuplicate=" + isDuplicate + + ", isCareerPrep=" + isCareerPrep + + ", isLocallyDeveloped=" + isLocallyDeveloped + + ", isBoardAuthorityAuthorized=" + isBoardAuthorityAuthorized + + ", isIndependentDirectedStudies=" + isIndependentDirectedStudies + + ", isUsed=" + isUsed + + ", isRestricted=" + isRestricted + + ", isNotEligibleForElective=" + isNotEligibleForElective + + ", isUsedInMatchRule=" + isUsedInMatchRule + + ", isLessCreditCourse=" + isLessCreditCourse + + ", isValidationCourse=" + isValidationCourse + + ", isCutOffCourse=" + isCutOffCourse + + ", isGrade10Course=" + isGrade10Course + + ", leftOverCredits=" + leftOverCredits + + '}'; } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/StudentCourses.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/StudentCourses.java index 351418d0..2b84fb80 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/StudentCourses.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/StudentCourses.java @@ -3,11 +3,12 @@ import lombok.Data; import org.springframework.stereotype.Component; +import java.io.Serializable; import java.util.List; @Data @Component -public class StudentCourses { +public class StudentCourses implements Serializable { private List studentCourseList; @Override diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/StudentOptionalProgram.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/StudentOptionalProgram.java index 98fcf481..4be74b65 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/StudentOptionalProgram.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/dto/StudentOptionalProgram.java @@ -1,14 +1,14 @@ package ca.bc.gov.educ.api.ruleengine.dto; -import java.util.UUID; - +import lombok.Data; import org.springframework.stereotype.Component; -import lombok.Data; +import java.io.Serializable; +import java.util.UUID; @Data @Component -public class StudentOptionalProgram { +public class StudentOptionalProgram implements Serializable { private UUID id; private String pen; diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AdultCPCoursesRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AdultCPCoursesRule.java index 16899f2f..de46affd 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AdultCPCoursesRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AdultCPCoursesRule.java @@ -1,19 +1,19 @@ package ca.bc.gov.educ.api.ruleengine.rule; -import java.util.List; - -import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; import ca.bc.gov.educ.api.ruleengine.dto.RuleData; import ca.bc.gov.educ.api.ruleengine.dto.RuleProcessorData; import ca.bc.gov.educ.api.ruleengine.dto.StudentCourse; import ca.bc.gov.educ.api.ruleengine.util.RuleEngineApiUtils; +import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.List; @Data @Component @@ -32,8 +32,6 @@ public RuleData fire() { List studentCourseList = RuleProcessorRuleUtils.getUniqueStudentCourses( ruleProcessorData.getStudentCourses(), ruleProcessorData.isProjected()); - logger.debug("###################### Finding CAREER PROGRAM courses ######################"); - for (StudentCourse studentCourse : studentCourseList) { boolean isCPWEExceptionCourse = studentCourse.getCourseCode().equalsIgnoreCase("CPWE") && studentCourse.getCourseLevel().contains("12"); if (studentCourse.getCourseCode().startsWith("CP") @@ -43,7 +41,7 @@ public RuleData fire() { } } - ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses(studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); + ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses("AdultCPCoursesRule", studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); ruleProcessorData.setStudentCourses(studentCourseList); logger.debug("Career Program Courses: {}",(int) studentCourseList.stream().filter(StudentCourse::isCareerPrep).count()); @@ -54,6 +52,5 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("AdultCPCoursesRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AdultStudentGradeRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AdultStudentGradeRule.java index faa7a664..41f2132d 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AdultStudentGradeRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AdultStudentGradeRule.java @@ -1,6 +1,9 @@ package ca.bc.gov.educ.api.ruleengine.rule; -import ca.bc.gov.educ.api.ruleengine.dto.*; +import ca.bc.gov.educ.api.ruleengine.dto.GradRequirement; +import ca.bc.gov.educ.api.ruleengine.dto.ProgramRequirement; +import ca.bc.gov.educ.api.ruleengine.dto.RuleData; +import ca.bc.gov.educ.api.ruleengine.dto.RuleProcessorData; import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorUtils; import lombok.AllArgsConstructor; import lombok.Data; @@ -37,7 +40,7 @@ public RuleData fire() { logger.debug("#Checking SG Rule"); for (ProgramRequirement gradProgramRule : gradProgramRules) { - logger.debug("StudentGrade:" + ruleProcessorData.getGradStudent().getStudentGrade()); + logger.debug("StudentGrade: {}", ruleProcessorData.getGradStudent().getStudentGrade()); if ("AD".compareTo(ruleProcessorData.getGradStudent().getStudentGrade()) != 0) { gradProgramRule.getProgramRequirementCode().setPassed(false); @@ -63,6 +66,5 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("AdultStudentGradeRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AdultWorkExperienceRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AdultWorkExperienceRule.java index 4f5bbab9..05ef1284 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AdultWorkExperienceRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AdultWorkExperienceRule.java @@ -1,28 +1,20 @@ package ca.bc.gov.educ.api.ruleengine.rule; -import java.util.ArrayList; -import java.util.List; -import java.util.ListIterator; -import java.util.stream.Collectors; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.fasterxml.jackson.databind.ObjectMapper; - -import ca.bc.gov.educ.api.ruleengine.dto.CourseRequirement; -import ca.bc.gov.educ.api.ruleengine.dto.GradRequirement; -import ca.bc.gov.educ.api.ruleengine.dto.ProgramRequirement; -import ca.bc.gov.educ.api.ruleengine.dto.RuleData; -import ca.bc.gov.educ.api.ruleengine.dto.RuleProcessorData; -import ca.bc.gov.educ.api.ruleengine.dto.StudentCourse; +import ca.bc.gov.educ.api.ruleengine.dto.*; import ca.bc.gov.educ.api.ruleengine.util.RuleEngineApiUtils; import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; +import java.util.ListIterator; +import java.util.stream.Collectors; @Data @Component @@ -62,7 +54,7 @@ public RuleData fire() { for (ProgramRequirement gradProgramRule : gradProgramRules) { int numberOfWExCourses = 0; ListIterator courseIterator = studentCourses.listIterator(); - ObjectMapper objectMapper = new ObjectMapper(); + while (courseIterator.hasNext()) { StudentCourse tempCourse = courseIterator.next(); @@ -95,7 +87,7 @@ public RuleData fire() { tempCourse.setNotEligibleForElective(true); } } - AlgorithmSupportRule.copyAndAddIntoStudentCoursesList(tempCourse, finalCourseList, objectMapper); + AlgorithmSupportRule.copyAndAddIntoStudentCoursesList(tempCourse, finalCourseList); } if(numberOfWExCourses > 1L) { @@ -116,7 +108,6 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("AdultWorkExperienceRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AlgorithmSupportRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AlgorithmSupportRule.java index b8890ac4..b0d3cfa1 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AlgorithmSupportRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AlgorithmSupportRule.java @@ -2,14 +2,14 @@ import ca.bc.gov.educ.api.ruleengine.dto.*; import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; -import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.commons.lang3.SerializationUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import java.io.IOException; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; @Component public class AlgorithmSupportRule { @@ -28,7 +28,7 @@ public static void processEmptyCourseCondition(RuleProcessorData ruleProcessorDa && pr.getProgramRequirementCode().getRequirementCategory() != null && pr.getProgramRequirementCode().getRequirementCategory().equalsIgnoreCase("C") && "N/A".compareToIgnoreCase(pr.getProgramRequirementCode().getNotMetDesc()) != 0) - .toList(); + .collect(Collectors.toList()); if (failedRules.isEmpty()) { logger.debug("All the match rules met!"); @@ -61,7 +61,7 @@ public static void processEmptyAssessmentCondition(RuleProcessorData ruleProcess ruleProcessorData.getStudentCourses(), ruleProcessorData.isProjected()); ruleProcessorData.setStudentCourses(courseList); List failedRules = gradProgramRulesMatch.stream() - .filter(pr -> !pr.getProgramRequirementCode().isPassed() && pr.getProgramRequirementCode().getRequirementCategory().equalsIgnoreCase("A")).toList(); + .filter(pr -> !pr.getProgramRequirementCode().isPassed() && pr.getProgramRequirementCode().getRequirementCategory().equalsIgnoreCase("A")).collect(Collectors.toList()); if (failedRules.isEmpty()) { logger.debug("All the match rules met!"); @@ -224,81 +224,65 @@ public static void checkCredits1996(int totalCredits, int requiredCredits, Progr } } - public static void copyAndAddIntoProgramRulesList(ProgramRequirement programRule, List finalProgramRulesList, ObjectMapper objectMapper) { - try { - ProgramRequirement tempPR = objectMapper.readValue(objectMapper.writeValueAsString(programRule), ProgramRequirement.class); - if (tempPR != null && !finalProgramRulesList.contains(tempPR)) { - finalProgramRulesList.add(tempPR); - - //See if there are duplicates - List duplicateProgramRules = finalProgramRulesList.stream() - .filter(fprl -> fprl.getProgramRequirementCode().getProReqCode().compareTo(tempPR.getProgramRequirementCode().getProReqCode()) == 0) - .toList(); - - if (duplicateProgramRules.size() > 1) { - finalProgramRulesList.removeAll( - duplicateProgramRules.stream().filter(dpr -> !dpr.getProgramRequirementCode().isPassed()).toList() - ); - } + public static void copyAndAddIntoProgramRulesList(ProgramRequirement programRule, List finalProgramRulesList) { + ProgramRequirement tempPR = SerializationUtils.clone(programRule); + if (tempPR != null && !finalProgramRulesList.contains(tempPR)) { + finalProgramRulesList.add(tempPR); + + //See if there are duplicates + List duplicateProgramRules = finalProgramRulesList.stream() + .filter(fprl -> fprl.getProgramRequirementCode().getProReqCode().compareTo(tempPR.getProgramRequirementCode().getProReqCode()) == 0) + .collect(Collectors.toList()); + + if (duplicateProgramRules.size() > 1) { + finalProgramRulesList.removeAll( + duplicateProgramRules.stream().filter(dpr -> !dpr.getProgramRequirementCode().isPassed()).collect(Collectors.toList()) + ); } - logger.debug("TempPR: {}",tempPR); - logger.debug("Final Program rules list size: {}",finalProgramRulesList.size()); - } catch (IOException e) { - logger.error(ERROR_FORMAT_STR,e.getMessage()); } + logger.debug("TempPR: {}",tempPR); + logger.debug("Final Program rules list size: {}",finalProgramRulesList.size()); } - public static void copyAndAddIntoOptionalProgramRulesList(OptionalProgramRequirement optionalProgramRule, List finalOptionalProgramRulesList, ObjectMapper objectMapper) { - try { - OptionalProgramRequirement tempSPR = objectMapper.readValue(objectMapper.writeValueAsString(optionalProgramRule), - OptionalProgramRequirement.class); - if (tempSPR != null && !finalOptionalProgramRulesList.contains(optionalProgramRule)) { - //If Rule already exists in the list then remove and replace - OptionalProgramRequirement opr = finalOptionalProgramRulesList.stream() - .filter(pr -> pr.getOptionalProgramRequirementID().compareTo(tempSPR.getOptionalProgramRequirementID()) == 0) - .findAny().orElse(null); - - if (opr != null) { - // If Rule already added before, check if the added rule is failed, then replace with current one - // Otherwise, do not add anything - if (!opr.getOptionalProgramRequirementCode().isPassed()) { - finalOptionalProgramRulesList.remove(opr); - finalOptionalProgramRulesList.add(tempSPR); - } - } - // If rule not added yet, just add it - else { + public static void copyAndAddIntoOptionalProgramRulesList(OptionalProgramRequirement optionalProgramRule, List finalOptionalProgramRulesList) { + OptionalProgramRequirement tempSPR = SerializationUtils.clone(optionalProgramRule); + if (tempSPR != null && !finalOptionalProgramRulesList.contains(optionalProgramRule)) { + //If Rule already exists in the list then remove and replace + OptionalProgramRequirement opr = finalOptionalProgramRulesList.stream() + .filter(pr -> pr.getOptionalProgramRequirementID().compareTo(tempSPR.getOptionalProgramRequirementID()) == 0) + .findAny().orElse(null); + + if (opr != null) { + // If Rule already added before, check if the added rule is failed, then replace with current one + // Otherwise, do not add anything + if (!opr.getOptionalProgramRequirementCode().isPassed()) { + finalOptionalProgramRulesList.remove(opr); finalOptionalProgramRulesList.add(tempSPR); } } - logger.debug("TempPR: {}", tempSPR); - logger.debug("Final Program rules list size: {}", finalOptionalProgramRulesList.size()); - } catch (IOException e) { - logger.error(ERROR_FORMAT_STR,e.getMessage()); + // If rule not added yet, just add it + else { + finalOptionalProgramRulesList.add(tempSPR); + } } + logger.debug("TempPR: {}", tempSPR); + logger.debug("Final Program rules list size: {}", finalOptionalProgramRulesList.size()); } - public static void copyAndAddIntoStudentCoursesList(StudentCourse studentCourse, List finalCourseList, ObjectMapper objectMapper) { - try { - StudentCourse tempSC = objectMapper.readValue(objectMapper.writeValueAsString(studentCourse), StudentCourse.class); - if (tempSC != null) - finalCourseList.add(tempSC); - logger.debug("TempSC: {}", tempSC); - logger.debug("Final course List size: {}: ", finalCourseList.size()); - } catch (IOException e) { - logger.error(ERROR_FORMAT_STR,e.getMessage()); + public static void copyAndAddIntoStudentCoursesList(StudentCourse studentCourse, List finalCourseList) { + StudentCourse studentCourseTmp = SerializationUtils.clone(studentCourse); + if (studentCourseTmp != null) { + finalCourseList.add(studentCourseTmp); + logger.debug("Added Student Course: {}", studentCourseTmp); } + logger.debug("Final Student Course List size: {}", finalCourseList.size()); } - public static void copyAndAddIntoStudentAssessmentsList(StudentAssessment studentAssessment, List finalAssessmentList, ObjectMapper objectMapper) { - try { - StudentAssessment tempSA = objectMapper.readValue(objectMapper.writeValueAsString(studentAssessment), StudentAssessment.class); - if (tempSA != null) - finalAssessmentList.add(tempSA); - logger.debug("TempSC: {}",tempSA); - logger.debug("Final Assessment List size: : {}",finalAssessmentList.size()); - } catch (IOException e) { - logger.error(ERROR_FORMAT_STR,e.getMessage()); - } + public static void copyAndAddIntoStudentAssessmentsList(StudentAssessment studentAssessment, List finalAssessmentList) { + StudentAssessment tempSA = SerializationUtils.clone(studentAssessment); + if (tempSA != null) + finalAssessmentList.add(tempSA); + logger.debug("TempSC: {}",tempSA); + logger.debug("Final Assessment List size: : {}",finalAssessmentList.size()); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AssessmentDualDogwoodMatchCreditsRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AssessmentDualDogwoodMatchCreditsRule.java index 9cf17b16..125da4b3 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AssessmentDualDogwoodMatchCreditsRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AssessmentDualDogwoodMatchCreditsRule.java @@ -40,7 +40,6 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("AssessmentDualDogwoodMatchCreditsRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AssessmentFrenchImmersionMatchCreditsRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AssessmentFrenchImmersionMatchCreditsRule.java index 2ca24466..349a78a6 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AssessmentFrenchImmersionMatchCreditsRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AssessmentFrenchImmersionMatchCreditsRule.java @@ -40,7 +40,6 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("AssessmentFrenchImmersionMatchCreditsRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AssessmentRegistrationsRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AssessmentRegistrationsRule.java index 7146245d..c9661137 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AssessmentRegistrationsRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AssessmentRegistrationsRule.java @@ -1,21 +1,23 @@ package ca.bc.gov.educ.api.ruleengine.rule; -import java.text.ParseException; -import java.util.Date; -import java.util.List; -import java.util.Map; - -import ca.bc.gov.educ.api.ruleengine.dto.*; +import ca.bc.gov.educ.api.ruleengine.dto.OptionalProgramRuleProcessor; +import ca.bc.gov.educ.api.ruleengine.dto.RuleData; +import ca.bc.gov.educ.api.ruleengine.dto.RuleProcessorData; +import ca.bc.gov.educ.api.ruleengine.dto.StudentAssessment; +import ca.bc.gov.educ.api.ruleengine.util.RuleEngineApiUtils; import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import ca.bc.gov.educ.api.ruleengine.util.RuleEngineApiUtils; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; +import java.text.ParseException; +import java.util.Date; +import java.util.List; +import java.util.Map; @Data @Component @@ -33,8 +35,6 @@ public RuleData fire() { List studentAssessmentList = RuleProcessorRuleUtils.getUniqueStudentAssessments(ruleProcessorData.getStudentAssessments(),ruleProcessorData.isProjected()); - logger.debug("###################### Finding PROJECTED assessments (For Projected GRAD) ######################"); - for (StudentAssessment studentAssessment : studentAssessmentList) { String today = RuleEngineApiUtils.formatDate(new Date(), "yyyy-MM-dd"); String sessionDate = studentAssessment.getSessionDate() + "/01"; @@ -42,7 +42,7 @@ public RuleData fire() { Date temp = RuleEngineApiUtils.parseDate(sessionDate, "yyyy/MM/dd"); sessionDate = RuleEngineApiUtils.formatDate(temp, "yyyy-MM-dd"); } catch (ParseException pe) { - logger.error("ERROR: {0}", pe.getMessage()); + logger.error("ERROR: {}", pe.getMessage()); } int diff = RuleEngineApiUtils.getDifferenceInMonths(sessionDate, today); @@ -75,7 +75,7 @@ public RuleData fire() { ruleProcessorData.setExcludedAssessments(RuleProcessorRuleUtils.maintainExcludedAssessments(studentAssessmentList,ruleProcessorData.getExcludedAssessments(),ruleProcessorData.isProjected())); ruleProcessorData.setStudentAssessments(studentAssessmentList); - logger.debug("Projected Assessments (Registrations): {0} ",(int) studentAssessmentList.stream().filter(StudentAssessment::isProjected).count()); + logger.debug("Projected Assessments (Registrations): {} ",(int) studentAssessmentList.stream().filter(StudentAssessment::isProjected).count()); prepareAssessmentForOptionalPrograms(); return ruleProcessorData; } @@ -89,6 +89,5 @@ private void prepareAssessmentForOptionalPrograms() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("AssessmentRegistrationsRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AssessmentsMatchCreditsRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AssessmentsMatchCreditsRule.java index 64bb1bb9..2d06a67b 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AssessmentsMatchCreditsRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/AssessmentsMatchCreditsRule.java @@ -3,8 +3,6 @@ import ca.bc.gov.educ.api.ruleengine.dto.*; import ca.bc.gov.educ.api.ruleengine.util.RuleEngineApiUtils; import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; - -import com.fasterxml.jackson.databind.ObjectMapper; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -56,7 +54,7 @@ public RuleData fire() { List finalAssessmentList = new ArrayList<>(); List finalProgramRulesList = new ArrayList<>(); - ObjectMapper objectMapper = new ObjectMapper(); + for (StudentAssessment tempAssessment : assessmentList) { @@ -79,8 +77,8 @@ public RuleData fire() { logger.debug("Temp Program Rule: {}",tempProgramRule); processAssessments(tempAssessmentRequirement,tempProgramRule,requirementsMet,tempAssessment); - AlgorithmSupportRule.copyAndAddIntoStudentAssessmentsList(tempAssessment, finalAssessmentList, objectMapper); - AlgorithmSupportRule.copyAndAddIntoProgramRulesList(tempProgramRule, finalProgramRulesList, objectMapper); + AlgorithmSupportRule.copyAndAddIntoStudentAssessmentsList(tempAssessment, finalAssessmentList); + AlgorithmSupportRule.copyAndAddIntoProgramRulesList(tempProgramRule, finalProgramRulesList); } logger.debug("Final Program rules list: {}",finalProgramRulesList); @@ -167,7 +165,6 @@ private void processAssessments(List tempAssessmentRequir @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("AssessmentsMatchCreditsRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/BAACoursesRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/BAACoursesRule.java index 451021fa..a34b1d5c 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/BAACoursesRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/BAACoursesRule.java @@ -1,19 +1,18 @@ package ca.bc.gov.educ.api.ruleengine.rule; -import java.util.List; - -import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - import ca.bc.gov.educ.api.ruleengine.dto.RuleData; import ca.bc.gov.educ.api.ruleengine.dto.RuleProcessorData; import ca.bc.gov.educ.api.ruleengine.dto.StudentCourse; +import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.List; @Data @Component @@ -32,15 +31,13 @@ public RuleData fire() { List studentCourseList = RuleProcessorRuleUtils.getUniqueStudentCourses( ruleProcessorData.getStudentCourses(), ruleProcessorData.isProjected()); - logger.debug("###################### Finding Board/Authority Authorized (BAA) courses ######################"); - for (StudentCourse studentCourse : studentCourseList) { if (studentCourse.getCourseCode().startsWith("Y")) { studentCourse.setBoardAuthorityAuthorized(true); } } - ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses(studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); + ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses("BAACoursesRule", studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); ruleProcessorData.setStudentCourses(studentCourseList); logger.debug("Board/Authority Authorized: {}",(int) studentCourseList.stream().filter(StudentCourse::isBoardAuthorityAuthorized).count()); @@ -51,6 +48,5 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("BAACoursesRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/CPCoursesRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/CPCoursesRule.java index 3254979e..cb220f6f 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/CPCoursesRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/CPCoursesRule.java @@ -1,5 +1,8 @@ package ca.bc.gov.educ.api.ruleengine.rule; +import ca.bc.gov.educ.api.ruleengine.dto.RuleData; +import ca.bc.gov.educ.api.ruleengine.dto.RuleProcessorData; +import ca.bc.gov.educ.api.ruleengine.dto.StudentCourse; import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; import lombok.AllArgsConstructor; import lombok.Data; @@ -9,10 +12,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import ca.bc.gov.educ.api.ruleengine.dto.RuleData; -import ca.bc.gov.educ.api.ruleengine.dto.RuleProcessorData; -import ca.bc.gov.educ.api.ruleengine.dto.StudentCourse; - import java.util.List; @Data @@ -32,15 +31,13 @@ public RuleData fire() { List studentCourseList = RuleProcessorRuleUtils.getUniqueStudentCourses( ruleProcessorData.getStudentCourses(), ruleProcessorData.isProjected()); - logger.debug("###################### Finding CAREER PROGRAM courses ######################"); - for (StudentCourse studentCourse : studentCourseList) { if (studentCourse.getCourseCode().startsWith("CP")) { studentCourse.setCareerPrep(true); } } - ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses(studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); + ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses("CPCoursesRule", studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); ruleProcessorData.setStudentCourses(studentCourseList); logger.debug("Career Program Courses: {}",(int) studentCourseList.stream().filter(StudentCourse::isCareerPrep).count()); @@ -51,6 +48,5 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("CPCoursesRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/CareerProgramMatchRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/CareerProgramMatchRule.java index ec911e86..297dd923 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/CareerProgramMatchRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/CareerProgramMatchRule.java @@ -1,24 +1,21 @@ package ca.bc.gov.educ.api.ruleengine.rule; -import java.util.ArrayList; -import java.util.List; -import java.util.ListIterator; -import java.util.Map; -import java.util.stream.Collectors; - import ca.bc.gov.educ.api.ruleengine.dto.*; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import com.fasterxml.jackson.databind.ObjectMapper; - import ca.bc.gov.educ.api.ruleengine.util.RuleEngineApiUtils; import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; +import java.util.ListIterator; +import java.util.Map; +import java.util.stream.Collectors; @Data @Component @@ -56,7 +53,7 @@ public RuleData fire() { int totalCredits = 0; int requiredCredits = 0; List finalCourseList = new ArrayList<>(); - ObjectMapper objectMapper = new ObjectMapper(); + while (studentCourseIterator.hasNext()) { StudentCourse sc = studentCourseIterator.next(); @@ -90,7 +87,7 @@ public RuleData fire() { sc.setUsed(true); } } - AlgorithmSupportRule.copyAndAddIntoStudentCoursesList(sc, finalCourseList, objectMapper); + AlgorithmSupportRule.copyAndAddIntoStudentCoursesList(sc, finalCourseList); if ((totalCredits >= requiredCredits) && totalCredits != 0) { break; @@ -134,7 +131,6 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("CareerProgramMatchRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/DualDogwoodMatchCreditsRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/DualDogwoodMatchCreditsRule.java index 0f9d38af..1883c140 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/DualDogwoodMatchCreditsRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/DualDogwoodMatchCreditsRule.java @@ -39,7 +39,6 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("DualDogwoodMatchCreditsRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/DuplicateAssessmentsRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/DuplicateAssessmentsRule.java index 268c0309..ecffe039 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/DuplicateAssessmentsRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/DuplicateAssessmentsRule.java @@ -31,8 +31,6 @@ public class DuplicateAssessmentsRule implements Rule { @Override public RuleData fire() { - logger.debug("###################### Finding DUPLICATE Assessments ######################"); - List studentAssessmentList = RuleProcessorRuleUtils.getUniqueStudentAssessments(ruleProcessorData.getStudentAssessments(),ruleProcessorData.isProjected()); getModifiedAndSortedData(studentAssessmentList); @@ -79,7 +77,7 @@ public RuleData fire() { ruleProcessorData.setExcludedAssessments(RuleProcessorRuleUtils.maintainExcludedAssessments(studentAssessmentList,ruleProcessorData.getExcludedAssessments(),ruleProcessorData.isProjected())); ruleProcessorData.setStudentAssessments(studentAssessmentList); - logger.debug("Duplicate Assessments: {0}", + logger.debug("Duplicate Assessments: {}", (int) studentAssessmentList.stream().filter(StudentAssessment::isDuplicate).count()); if(ruleProcessorData.getGradProgram().getProgramCode().equalsIgnoreCase("SCCP") || ruleProcessorData.getGradProgram().getProgramCode().equalsIgnoreCase("1950") @@ -151,6 +149,5 @@ public void compareSpecialCases(char specialCase1, char specialCase2, List studentCourseList = RuleProcessorRuleUtils.getUniqueStudentCourses(ruleProcessorData.getStudentCourses(),ruleProcessorData.isProjected()); for (int i = 0; i < studentCourseList.size() - 1; i++) { @@ -60,7 +58,7 @@ public RuleData fire() { } } - ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses(studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); + ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses("DuplicateCoursesRule", studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); ruleProcessorData.setStudentCourses(studentCourseList); logger.debug("Duplicate Courses: {}",(int) studentCourseList.stream().filter(StudentCourse::isDuplicate).count()); return ruleProcessorData; @@ -80,6 +78,5 @@ private void compareSessionDates(List studentCourseList, int i, i @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("DuplicateCoursesRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/EquivalencyRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/EquivalencyRule.java index aaa25c3f..aea5720f 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/EquivalencyRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/EquivalencyRule.java @@ -3,7 +3,6 @@ import ca.bc.gov.educ.api.ruleengine.dto.*; import ca.bc.gov.educ.api.ruleengine.util.RuleEngineApiUtils; import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; -import com.fasterxml.jackson.databind.ObjectMapper; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -66,7 +65,7 @@ private void handleProgramRulesForAssessmentEquivalency() { List finalAssessmentList = new ArrayList<>(); List finalProgramRulesList = new ArrayList<>(); - ObjectMapper objectMapper = new ObjectMapper(); + for (StudentCourse st : courseList) { List matchedCourseRequirements = courseRequirementsForEquivalency.stream() @@ -84,7 +83,7 @@ private void handleProgramRulesForAssessmentEquivalency() { if (programRule != null && !programRule.getProgramRequirementCode().isPassed()) { logger.debug("Pseudo Assessment ==> Program rule[{}] - course code[{}] / [{}]", programRule.getProgramRequirementCode().getProReqCode(), st.getCourseCode(), st.getCourseLevel()); processAssessmentEquivalency(st, programRule, courseRequirement, ruleProcessorData.getGradStudent().getPen(), requirementsMet, finalAssessmentList); - AlgorithmSupportRule.copyAndAddIntoProgramRulesList(programRule, finalProgramRulesList, objectMapper); + AlgorithmSupportRule.copyAndAddIntoProgramRulesList(programRule, finalProgramRulesList); } }); } @@ -206,7 +205,7 @@ private void processOptionalProgramRulesForAssessmentEquivalency(OptionalProgram List finalAssessmentList = new ArrayList<>(); List finalOptionalProgramRulesList = new ArrayList<>(); - ObjectMapper objectMapper = new ObjectMapper(); + for (StudentCourse st : courseList) { List matchedCourseRequirements = courseRequirementsForEquivalency.stream() @@ -224,7 +223,7 @@ private void processOptionalProgramRulesForAssessmentEquivalency(OptionalProgram if (optionalProgramRule != null && !optionalProgramRule.getOptionalProgramRequirementCode().isPassed()) { logger.debug("Pseudo Assessment ==> Optional Program rule[{}] - course code[{}] / [{}]", optionalProgramRule.getOptionalProgramRequirementCode().getOptProReqCode(), st.getCourseCode(), st.getCourseLevel()); processAssessmentEquivalencyOptionalProgram(st, optionalProgramRule, courseRequirement, ruleProcessorData.getGradStudent().getPen(), requirementsMet, finalAssessmentList); - AlgorithmSupportRule.copyAndAddIntoOptionalProgramRulesList(optionalProgramRule, finalOptionalProgramRulesList, objectMapper); + AlgorithmSupportRule.copyAndAddIntoOptionalProgramRulesList(optionalProgramRule, finalOptionalProgramRulesList); } }); } @@ -328,7 +327,7 @@ private List getCourseRequirementsForAssessmentsEquivalency(L // Rule# 203, 403, 404 List failedRuleCodes = gradOptionalProgramRulesMatch .stream() - .filter((opr -> !opr.getOptionalProgramRequirementCode().isPassed())).collect(Collectors.toList()) + .filter((opr -> !opr.getOptionalProgramRequirementCode().isPassed())).toList() .stream() .map(fr -> fr.getOptionalProgramRequirementCode().getOptProReqCode()).collect(Collectors.toList()); @@ -361,6 +360,5 @@ private boolean validateAssessmentsEmptyOrFailedForOptionalProgram(List studentCourseList = RuleProcessorRuleUtils.getUniqueStudentCourses( ruleProcessorData.getStudentCourses(), ruleProcessorData.isProjected()); - logger.debug("###################### Finding Course Taken after program cutoff courses ######################"); if(ruleProcessorData.getGradProgram().getExpiryDate() == null) { return ruleProcessorData; } @@ -54,7 +53,7 @@ public RuleData fire() { } } - ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses(studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); + ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses("ExcludeAfterProgramCutoffRule", studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); ruleProcessorData.setStudentCourses(studentCourseList); logger.debug("Cut-off Courses: {}", @@ -69,6 +68,5 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("ExcludeAfterProgramCutoffRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/ExcludeGrade10LevelRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/ExcludeGrade10LevelRule.java index 455fe5f1..fc6922a5 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/ExcludeGrade10LevelRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/ExcludeGrade10LevelRule.java @@ -31,15 +31,13 @@ public RuleData fire() { List studentCourseList = RuleProcessorRuleUtils.getUniqueStudentCourses( ruleProcessorData.getStudentCourses(), ruleProcessorData.isProjected()); - logger.debug("###################### Finding CAREER PROGRAM courses ######################"); - for (StudentCourse studentCourse : studentCourseList) { if (studentCourse.getCourseLevel().compareTo("10")==0) { studentCourse.setGrade10Course(true); } } - ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses(studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); + ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses("ExcludeGrade10LevelRule", studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); ruleProcessorData.setStudentCourses(studentCourseList); logger.debug("Grade Level 10 Courses: {}",(int) studentCourseList.stream().filter(StudentCourse::isGrade10Course).count()); @@ -50,6 +48,5 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("ExcludeGrade10LevelRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/ExcludeLess4CreditsCoursesRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/ExcludeLess4CreditsCoursesRule.java index c756bbc7..d54737d9 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/ExcludeLess4CreditsCoursesRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/ExcludeLess4CreditsCoursesRule.java @@ -28,8 +28,6 @@ public class ExcludeLess4CreditsCoursesRule implements Rule { @Override public RuleData fire() { - logger.debug("###################### Finding 2 Credit Courses ######################"); - List studentCourseList = RuleProcessorRuleUtils.getUniqueStudentCourses( ruleProcessorData.getStudentCourses(), ruleProcessorData.isProjected()); @@ -40,10 +38,10 @@ public RuleData fire() { } } - ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses(studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); + ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses("ExcludeLess4CreditsCoursesRule", studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); ruleProcessorData.setStudentCourses(studentCourseList); - logger.debug( "Removed 2 Credit Courses: {0} ", + logger.debug( "Removed 2 Credit Courses: {} ", (int) studentCourseList.stream().filter(StudentCourse::isLessCreditCourse).count()); return ruleProcessorData; @@ -52,6 +50,5 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("ExcludeLess4CreditsCoursesRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/ExcludeValidationCoursesRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/ExcludeValidationCoursesRule.java index 4ce428f6..d4af81cb 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/ExcludeValidationCoursesRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/ExcludeValidationCoursesRule.java @@ -31,8 +31,6 @@ public RuleData fire() { List studentCourseList = RuleProcessorRuleUtils.getUniqueStudentCourses( ruleProcessorData.getStudentCourses(), ruleProcessorData.isProjected()); - logger.debug("###################### Finding CAREER PROGRAM courses ######################"); - for (StudentCourse studentCourse : studentCourseList) { String sessionDate = studentCourse.getSessionDate() + "/01"; String cName = studentCourse.getCourseCode()+studentCourse.getCourseLevel(); @@ -43,7 +41,7 @@ public RuleData fire() { } } - ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses(studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); + ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses("ExcludeValidationCoursesRule", studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); ruleProcessorData.setStudentCourses(studentCourseList); logger.debug("Validation Courses: {}", @@ -58,6 +56,5 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("ExcludeValidationCoursesRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/FailedAssessmentsRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/FailedAssessmentsRule.java index c831b292..3e6a3c97 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/FailedAssessmentsRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/FailedAssessmentsRule.java @@ -1,19 +1,18 @@ package ca.bc.gov.educ.api.ruleengine.rule; -import java.util.List; - -import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - import ca.bc.gov.educ.api.ruleengine.dto.RuleData; import ca.bc.gov.educ.api.ruleengine.dto.RuleProcessorData; import ca.bc.gov.educ.api.ruleengine.dto.StudentAssessment; +import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.List; @Data @Component @@ -31,8 +30,6 @@ public RuleData fire() { List studentAssessmentList = RuleProcessorRuleUtils.getUniqueStudentAssessments(ruleProcessorData.getStudentAssessments(),ruleProcessorData.isProjected()); - logger.debug("###################### Finding FAILED assessments ######################"); - for (StudentAssessment studentAssessment : studentAssessmentList) { boolean failed = ruleProcessorData.getSpecialCaseList().stream() @@ -58,7 +55,7 @@ public RuleData fire() { ruleProcessorData.setExcludedAssessments(RuleProcessorRuleUtils.maintainExcludedAssessments(studentAssessmentList,ruleProcessorData.getExcludedAssessments(),ruleProcessorData.isProjected())); ruleProcessorData.setStudentAssessments(studentAssessmentList); - logger.debug("Failed Assessments: {0}", + logger.debug("Failed Assessments: {}", (int) studentAssessmentList.stream().filter(StudentAssessment::isFailed).count()); return ruleProcessorData; @@ -66,6 +63,5 @@ public RuleData fire() { public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("FailedAssessmentsRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/FailedCoursesRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/FailedCoursesRule.java index 47413f37..b07de924 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/FailedCoursesRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/FailedCoursesRule.java @@ -1,19 +1,18 @@ package ca.bc.gov.educ.api.ruleengine.rule; -import java.util.List; - -import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - import ca.bc.gov.educ.api.ruleengine.dto.RuleData; import ca.bc.gov.educ.api.ruleengine.dto.RuleProcessorData; import ca.bc.gov.educ.api.ruleengine.dto.StudentCourse; +import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.List; @Data @Component @@ -31,8 +30,6 @@ public RuleData fire() { List studentCourseList = RuleProcessorRuleUtils.getUniqueStudentCourses(ruleProcessorData.getStudentCourses(),ruleProcessorData.isProjected()); - logger.debug("###################### Finding FAILED courses ######################"); - for (StudentCourse studentCourse : studentCourseList) { String finalLetterGrade = studentCourse.getCompletedCourseLetterGrade(); if(finalLetterGrade != null) { @@ -44,10 +41,10 @@ public RuleData fire() { studentCourse.setFailed(true); } } - ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses(studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); + ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses("FailedCoursesRule", studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); ruleProcessorData.setStudentCourses(studentCourseList); - logger.debug("Failed Courses: {0} ", + logger.debug("Failed Courses: {} ", (int) studentCourseList.stream().filter(StudentCourse::isFailed).count()); return ruleProcessorData; @@ -55,6 +52,5 @@ public RuleData fire() { public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("FailedCoursesRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/FrenchImmersionMatchRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/FrenchImmersionMatchRule.java index 5a1017c4..8a3595ae 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/FrenchImmersionMatchRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/FrenchImmersionMatchRule.java @@ -40,7 +40,6 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("FrenchImmersionMatchRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/FrenchImmersionMinElectiveCredits1986Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/FrenchImmersionMinElectiveCredits1986Rule.java index ccf0949b..5a3a0501 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/FrenchImmersionMinElectiveCredits1986Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/FrenchImmersionMinElectiveCredits1986Rule.java @@ -2,7 +2,6 @@ import ca.bc.gov.educ.api.ruleengine.dto.*; import ca.bc.gov.educ.api.ruleengine.util.RuleEngineApiUtils; -import com.fasterxml.jackson.databind.ObjectMapper; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -42,7 +41,7 @@ public RuleProcessorData fire() { .collect(Collectors.toList()); logger.debug("#### French Immersion Min Credit Elective Optional Program Rule size: {}",gradOptionalProgramMinCreditElectiveRulesMatch.size()); - ObjectMapper objectMapper = new ObjectMapper(); + List modifiedList = RuleEngineApiUtils.getClone(courseList.stream().filter(sc -> !sc.isUsed()).sorted(Comparator.comparing(StudentCourse::getCourseLevel).reversed()).collect(Collectors.toList())); @@ -60,7 +59,7 @@ public RuleProcessorData fire() { totalCreditsGrade11or12 = processCredits(pR,totalCreditsGrade11or12,sc,requirementsMet); } } - AlgorithmSupportRule.copyAndAddIntoStudentCoursesList(sc, finalCourseList2, objectMapper); + AlgorithmSupportRule.copyAndAddIntoStudentCoursesList(sc, finalCourseList2); if ((totalCreditsGrade11or12 == requiredCreditsGrad11or12) && totalCreditsGrade11or12 != 0) { break; @@ -74,7 +73,7 @@ public RuleProcessorData fire() { resMet.addAll(requirementsMet); obj.setRequirementsMetOptionalProgram(resMet); - finalCourseList2.addAll(courseList.stream().filter(StudentCourse::isUsed).collect(Collectors.toList())); + finalCourseList2.addAll(courseList.stream().filter(StudentCourse::isUsed).toList()); obj.setStudentCoursesOptionalProgram(RuleEngineApiUtils.getClone(finalCourseList2)); List failedRules = gradOptionalProgramMinCreditElectiveRulesMatch.stream() .filter(pr -> !pr.getOptionalProgramRequirementCode().isPassed()).collect(Collectors.toList()); @@ -134,7 +133,6 @@ public int processCredits(OptionalProgramRequirement pR, int totalCredits, Stude @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("FrenchImmersionMinElectiveCredits1986Rule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/FrenchImmersionMinElectiveCredits1996Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/FrenchImmersionMinElectiveCredits1996Rule.java index 1f90a516..aad73089 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/FrenchImmersionMinElectiveCredits1996Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/FrenchImmersionMinElectiveCredits1996Rule.java @@ -2,7 +2,6 @@ import ca.bc.gov.educ.api.ruleengine.dto.*; import ca.bc.gov.educ.api.ruleengine.util.RuleEngineApiUtils; -import com.fasterxml.jackson.databind.ObjectMapper; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -42,9 +41,9 @@ public RuleProcessorData fire() { .collect(Collectors.toList()); logger.debug("#### French Immersion Min Credit Elective Optional Program Rule size: {}",gradOptionalProgramMinCreditElectiveRulesMatch.size()); - ObjectMapper objectMapper = new ObjectMapper(); + - List modifiedList = RuleEngineApiUtils.getClone(courseList.stream().filter(sc -> !sc.isUsed()).sorted(Comparator.comparing(StudentCourse::getCourseLevel).reversed()).collect(Collectors.toList())); + List modifiedList = RuleEngineApiUtils.getClone(courseList.stream().filter(sc -> !sc.isUsed()).sorted(Comparator.comparing(StudentCourse::getCourseLevel).reversed()).toList()); List requirementsMet = new ArrayList<>(); List requirementsNotMet = new ArrayList<>(); @@ -60,7 +59,7 @@ public RuleProcessorData fire() { totalCreditsGrade11or12 = processCredits(pR,totalCreditsGrade11or12,sc,requirementsMet); } } - AlgorithmSupportRule.copyAndAddIntoStudentCoursesList(sc, finalCourseList2, objectMapper); + AlgorithmSupportRule.copyAndAddIntoStudentCoursesList(sc, finalCourseList2); if ((totalCreditsGrade11or12 == requiredCreditsGrad11or12) && totalCreditsGrade11or12 != 0) { break; @@ -134,7 +133,6 @@ public int processCredits(OptionalProgramRequirement pR, int totalCredits, Stude @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("FrenchImmersionMinElectiveCreditRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/FrenchImmersionMinElectiveCreditsRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/FrenchImmersionMinElectiveCreditsRule.java index b4cb7896..72147a24 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/FrenchImmersionMinElectiveCreditsRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/FrenchImmersionMinElectiveCreditsRule.java @@ -1,21 +1,18 @@ package ca.bc.gov.educ.api.ruleengine.rule; -import java.util.*; -import java.util.stream.Collectors; - import ca.bc.gov.educ.api.ruleengine.dto.*; +import ca.bc.gov.educ.api.ruleengine.util.RuleEngineApiUtils; import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import com.fasterxml.jackson.databind.ObjectMapper; - -import ca.bc.gov.educ.api.ruleengine.util.RuleEngineApiUtils; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; +import java.util.*; +import java.util.stream.Collectors; @Data @Component @@ -52,7 +49,7 @@ public RuleProcessorData fire() { logger.debug("#### French Immersion Min Credit Elective Optional Program Rule size: {}",gradOptionalProgramMinCreditElectiveRulesMatch.size()); List finalCourseList = new ArrayList<>(); List finalCourseList2 = new ArrayList<>(); - ObjectMapper objectMapper = new ObjectMapper(); + List matchedList = courseList .stream() .filter(StudentCourse::isUsed) @@ -74,7 +71,7 @@ public RuleProcessorData fire() { } } } - AlgorithmSupportRule.copyAndAddIntoStudentCoursesList(sc, finalCourseList, objectMapper); + AlgorithmSupportRule.copyAndAddIntoStudentCoursesList(sc, finalCourseList); if ((totalCredits == requiredCredits) && totalCredits != 0) { requirementAchieved = true; } @@ -109,7 +106,7 @@ public RuleProcessorData fire() { } } } - AlgorithmSupportRule.copyAndAddIntoStudentCoursesList(sc, finalCourseList2, objectMapper); + AlgorithmSupportRule.copyAndAddIntoStudentCoursesList(sc, finalCourseList2); if ((totalCreditsGrade11or12 == requiredCreditsGrad11or12) && totalCreditsGrade11or12 != 0) { requirementAchieved = true; @@ -186,7 +183,6 @@ public int processCredits(OptionalProgramRequirement pR, int totalCredits, Stude @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("FrenchImmersionMinElectiveCreditRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/IDSCoursesRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/IDSCoursesRule.java index 7c85fb43..af63ad08 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/IDSCoursesRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/IDSCoursesRule.java @@ -1,19 +1,18 @@ package ca.bc.gov.educ.api.ruleengine.rule; -import java.util.List; - -import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - import ca.bc.gov.educ.api.ruleengine.dto.RuleData; import ca.bc.gov.educ.api.ruleengine.dto.RuleProcessorData; import ca.bc.gov.educ.api.ruleengine.dto.StudentCourse; +import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.List; @Data @Component @@ -31,15 +30,13 @@ public RuleData fire() { List studentCourseList = RuleProcessorRuleUtils.getUniqueStudentCourses(ruleProcessorData.getStudentCourses(),ruleProcessorData.isProjected()); - logger.debug("###################### Finding Independent Directed Studies (IDS) courses ######################"); - for (StudentCourse studentCourse : studentCourseList) { if (studentCourse.getCourseCode().startsWith("IDS")) { studentCourse.setIndependentDirectedStudies(true); } } - ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses(studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); + ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses("IDSCoursesRule", studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); ruleProcessorData.setStudentCourses(studentCourseList); logger.debug("Independent Directed Studies Courses: {}", (int) studentCourseList.stream().filter(StudentCourse::isIndependentDirectedStudies).count()); @@ -50,6 +47,5 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("IDSCoursesRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/IncompleteAssessmentsRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/IncompleteAssessmentsRule.java index cfcb832a..4bcdcccd 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/IncompleteAssessmentsRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/IncompleteAssessmentsRule.java @@ -1,22 +1,21 @@ package ca.bc.gov.educ.api.ruleengine.rule; -import java.text.ParseException; -import java.util.Date; -import java.util.List; - -import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - import ca.bc.gov.educ.api.ruleengine.dto.RuleData; import ca.bc.gov.educ.api.ruleengine.dto.RuleProcessorData; import ca.bc.gov.educ.api.ruleengine.dto.StudentAssessment; import ca.bc.gov.educ.api.ruleengine.util.RuleEngineApiUtils; +import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.text.ParseException; +import java.util.Date; +import java.util.List; @Data @Component @@ -32,9 +31,7 @@ public RuleData fire() { List studentAssessmentList = RuleProcessorRuleUtils.getUniqueStudentAssessments(ruleProcessorData.getStudentAssessments(),ruleProcessorData.isProjected()); - logger.debug("###################### Finding INCOMPLETE Assessments ######################"); - - for (StudentAssessment studentAssessment : studentAssessmentList) { + for (StudentAssessment studentAssessment : studentAssessmentList) { String today = RuleEngineApiUtils.formatDate(new Date(), "yyyy-MM-dd"); String sessionDate = studentAssessment.getSessionDate() + "/01"; try { @@ -82,6 +79,5 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("IncompleteAssessmentsRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/IncompleteCoursesRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/IncompleteCoursesRule.java index ad5cebdc..77fe8941 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/IncompleteCoursesRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/IncompleteCoursesRule.java @@ -1,22 +1,21 @@ package ca.bc.gov.educ.api.ruleengine.rule; -import java.text.ParseException; -import java.util.Date; -import java.util.List; - -import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - import ca.bc.gov.educ.api.ruleengine.dto.RuleData; import ca.bc.gov.educ.api.ruleengine.dto.RuleProcessorData; import ca.bc.gov.educ.api.ruleengine.dto.StudentCourse; import ca.bc.gov.educ.api.ruleengine.util.RuleEngineApiUtils; +import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.text.ParseException; +import java.util.Date; +import java.util.List; @Data @Component @@ -32,8 +31,6 @@ public RuleData fire() { List studentCourseList = RuleProcessorRuleUtils.getUniqueStudentCourses(ruleProcessorData.getStudentCourses(),ruleProcessorData.isProjected()); - logger.debug("###################### Finding INCOMPLETE courses ######################"); - for (StudentCourse studentCourse : studentCourseList) { String today = RuleEngineApiUtils.formatDate(new Date(), "yyyy-MM-dd"); String sessionDate = studentCourse.getSessionDate() + "/01"; @@ -56,7 +53,7 @@ public RuleData fire() { } } - ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses(studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); + ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses("IncompleteCoursesRule", studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); ruleProcessorData.setStudentCourses(studentCourseList); logger.debug("Not Completed Courses: {}",(int) studentCourseList.stream().filter(StudentCourse::isNotCompleted).count()); return ruleProcessorData; @@ -65,6 +62,5 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("IncompleteCoursesRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/LDCoursesRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/LDCoursesRule.java index ab56509b..6a0e8644 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/LDCoursesRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/LDCoursesRule.java @@ -1,5 +1,8 @@ package ca.bc.gov.educ.api.ruleengine.rule; +import ca.bc.gov.educ.api.ruleengine.dto.RuleData; +import ca.bc.gov.educ.api.ruleengine.dto.RuleProcessorData; +import ca.bc.gov.educ.api.ruleengine.dto.StudentCourse; import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; import lombok.AllArgsConstructor; import lombok.Data; @@ -9,9 +12,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import ca.bc.gov.educ.api.ruleengine.dto.RuleData; -import ca.bc.gov.educ.api.ruleengine.dto.RuleProcessorData; -import ca.bc.gov.educ.api.ruleengine.dto.StudentCourse; import java.util.List; @Data @@ -30,14 +30,12 @@ public RuleData fire() { List studentCourseList = RuleProcessorRuleUtils.getUniqueStudentCourses(ruleProcessorData.getStudentCourses(),ruleProcessorData.isProjected()); - logger.debug("###################### Finding LOCALLY DEVELOPED courses ######################"); - for (StudentCourse studentCourse : studentCourseList) { if (studentCourse.getCourseCode().startsWith("X")) studentCourse.setLocallyDeveloped(true); } - ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses(studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); + ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses("LDCoursesRule", studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); ruleProcessorData.setStudentCourses(studentCourseList); logger.debug("Locally Developed Courses: {}",(int) studentCourseList.stream().filter(StudentCourse::isLocallyDeveloped) .count()); @@ -48,6 +46,5 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("LDCoursesRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MainProgramCompleteRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MainProgramCompleteRule.java index c07bdba6..32239feb 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MainProgramCompleteRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MainProgramCompleteRule.java @@ -87,6 +87,5 @@ private void processMainProgramCompleteRules(List nonGradReason @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("MainProgramCompleteRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1986Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1986Rule.java index 9318dafa..5154a8d6 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1986Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1986Rule.java @@ -3,7 +3,6 @@ import ca.bc.gov.educ.api.ruleengine.dto.*; import ca.bc.gov.educ.api.ruleengine.util.RuleEngineApiUtils; import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; -import com.fasterxml.jackson.databind.ObjectMapper; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -12,7 +11,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.*; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; import java.util.stream.Collectors; @Data @@ -58,7 +59,7 @@ public RuleData fire() { List finalCourseList = new ArrayList<>(); List finalProgramRulesList = new ArrayList<>(); - ObjectMapper objectMapper = new ObjectMapper(); + for (StudentCourse tempCourse : courseList) { logger.debug("Processing Course: Code= {} Level = {}", tempCourse.getCourseCode(), tempCourse.getCourseLevel()); @@ -88,8 +89,8 @@ public RuleData fire() { logger.debug("Temp Program Rule: {}", tempProgramRule); processCourse(tempCourse, tempCourseRequirement, tempProgramRule, requirementsMet); - AlgorithmSupportRule.copyAndAddIntoStudentCoursesList(tempCourse, finalCourseList, objectMapper); - AlgorithmSupportRule.copyAndAddIntoProgramRulesList(tempProgramRule, finalProgramRulesList, objectMapper); + AlgorithmSupportRule.copyAndAddIntoStudentCoursesList(tempCourse, finalCourseList); + AlgorithmSupportRule.copyAndAddIntoProgramRulesList(tempProgramRule, finalProgramRulesList); } logger.debug("Final Program rules list: {}",finalProgramRulesList); @@ -196,7 +197,6 @@ public void setDetailsForCourses(StudentCourse tempCourse, ProgramRequirement te @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("MatchCredit1986Rule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java index 667b2063..3f6dd3b9 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCredit1996Rule.java @@ -3,7 +3,6 @@ import ca.bc.gov.educ.api.ruleengine.dto.*; import ca.bc.gov.educ.api.ruleengine.util.RuleEngineApiUtils; import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; -import com.fasterxml.jackson.databind.ObjectMapper; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -80,7 +79,7 @@ public RuleData fire() { List finalCourseList = new ArrayList<>(); List finalProgramRulesList = new ArrayList<>(); - ObjectMapper objectMapper = new ObjectMapper(); + for (StudentCourse tempCourse : fineArtsCourseList) { logger.debug("Processing Course: Code= {} Level = {}", tempCourse.getCourseCode(), tempCourse.getCourseLevel()); @@ -127,8 +126,8 @@ && isFineArtsOrAppliedSkillsRule(pr.getProgramRequirementCode().getProReqCode()) logger.debug("Temp Program Rule: {}", tempProgramRule); processCourse(tempCourse, tempCourseRequirements, tempProgramRule, requirementsMet, gradProgramRulesMatch, map1996); - AlgorithmSupportRule.copyAndAddIntoStudentCoursesList(tempCourse, finalCourseList, objectMapper); - AlgorithmSupportRule.copyAndAddIntoProgramRulesList(tempProgramRule, finalProgramRulesList, objectMapper); + AlgorithmSupportRule.copyAndAddIntoStudentCoursesList(tempCourse, finalCourseList); + AlgorithmSupportRule.copyAndAddIntoProgramRulesList(tempProgramRule, finalProgramRulesList); } logger.debug("Final Program rules list: {}",finalProgramRulesList); processReqMet(finalProgramRulesList,finalCourseList,originalCourseRequirements,requirementsMet,gradProgramRulesMatch); @@ -174,8 +173,8 @@ && isFineArtsOrAppliedSkillsRule(pr.getProgramRequirementCode().getProReqCode()) logger.debug("Temp Program Rule: {}", tempProgramRule); processCourse(tempCourse, tempCourseRequirements, tempProgramRule, requirementsMet, gradProgramRulesMatch, map1996); - AlgorithmSupportRule.copyAndAddIntoStudentCoursesList(tempCourse, finalCourseList, objectMapper); - AlgorithmSupportRule.copyAndAddIntoProgramRulesList(tempProgramRule, finalProgramRulesList, objectMapper); + AlgorithmSupportRule.copyAndAddIntoStudentCoursesList(tempCourse, finalCourseList); + AlgorithmSupportRule.copyAndAddIntoProgramRulesList(tempProgramRule, finalProgramRulesList); } logger.debug("Final Program rules list: {}",finalProgramRulesList); @@ -273,7 +272,7 @@ public void processReqMet(List finalProgramRulesList, List "M".compareTo(gradProgramRule.getProgramRequirementCode().getRequirementTypeCode().getReqTypeCode()) != 0 || "C".compareTo(gradProgramRule.getProgramRequirementCode().getRequirementCategory()) != 0) - .toList()); + .collect(Collectors.toList())); logger.debug("Final Program rules list size 2: {}", finalProgramRulesList.size()); @@ -296,7 +295,7 @@ public void processReqMetAndNotMet(List finalProgramRulesLis finalProgramRulesList.addAll(unusedRules); } List failedRules = finalProgramRulesList.stream() - .filter(pr -> !pr.getProgramRequirementCode().isPassed()).toList(); + .filter(pr -> !pr.getProgramRequirementCode().isPassed()).collect(Collectors.toList()); if (failedRules.isEmpty()) { logger.debug("All the match rules met!"); @@ -322,7 +321,7 @@ public void processReqMetAndNotMet(List finalProgramRulesLis .stream() .filter(gradProgramRule -> "M".compareTo(gradProgramRule.getProgramRequirementCode().getRequirementTypeCode().getReqTypeCode()) != 0 || "C".compareTo(gradProgramRule.getProgramRequirementCode().getRequirementCategory()) != 0) - .toList()); + .collect(Collectors.toList())); logger.debug("Final Program rules list size 2: {}",finalProgramRulesList.size()); @@ -357,6 +356,5 @@ private boolean isFineArtsOrAppliedSkillsRule(String programRequirementCode) { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("Match4Credit1996Rule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCreditsRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCreditsRule.java index 38da33f0..21a7b206 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCreditsRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MatchCreditsRule.java @@ -3,7 +3,6 @@ import ca.bc.gov.educ.api.ruleengine.dto.*; import ca.bc.gov.educ.api.ruleengine.util.RuleEngineApiUtils; import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; -import com.fasterxml.jackson.databind.ObjectMapper; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -94,7 +93,7 @@ private void processRule(List courseList, List finalCourseList = new ArrayList<>(); List finalProgramRulesList = new ArrayList<>(); - ObjectMapper objectMapper = new ObjectMapper(); + ListIterator courseIterator = courseList.listIterator(); Map courseCreditException = new HashMap<>(); @@ -120,8 +119,8 @@ private void processRule(List courseList, List finalCourseList = new ArrayList<>(); List finalProgramRulesList = new ArrayList<>(); - ObjectMapper objectMapper = new ObjectMapper(); ListIterator courseIterator = courseList.listIterator(); Map courseCreditException = new HashMap<>(); @@ -82,12 +80,13 @@ public RuleData fire() { processCourse(tempCourse, tempCourseRequirement, tempProgramRule, requirementsMet, gradProgramRulesMatchIndigenous, courseCreditException); - AlgorithmSupportRule.copyAndAddIntoStudentCoursesList(tempCourse, finalCourseList, objectMapper); - AlgorithmSupportRule.copyAndAddIntoProgramRulesList(tempProgramRule, finalProgramRulesList, objectMapper); + AlgorithmSupportRule.copyAndAddIntoStudentCoursesList(tempCourse, finalCourseList); + AlgorithmSupportRule.copyAndAddIntoProgramRulesList(tempProgramRule, finalProgramRulesList); } processReqMetAndNotMet(finalProgramRulesList, requirementsNotMet, finalCourseList, originalCourseRequirements, requirementsMet, gradProgramRulesMatchIndigenous); + ruleProcessorData.getStudentCourses().addAll(ruleProcessorData.getExcludedCourses()); return ruleProcessorData; } @@ -102,7 +101,7 @@ private void processCourse(StudentCourse tempCourse, List tem && rm.getRule().equals(finalTempProgramRule.getProgramRequirementCode().getProReqCode())) .findAny() .orElse(null) == null) { - setDetailsForCourses(tempCourse, tempProgramRule, requirementsMet, gradProgramRulesMatch, null, courseCreditException); + setDetailsForCourses(tempCourse, tempProgramRule, requirementsMet, courseCreditException); } else { logger.debug("!!! Program Rule met Already: {}", tempProgramRule); } @@ -119,8 +118,7 @@ private void processCourse(StudentCourse tempCourse, List tem .findAny() .orElse(null); if (tempProgramRule != null) { - setDetailsForCourses(tempCourse, tempProgramRule, requirementsMet, gradProgramRulesMatch, - "ExceptionalCase", courseCreditException); + setDetailsForCourses(tempCourse, tempProgramRule, requirementsMet, courseCreditException); } } } @@ -180,9 +178,8 @@ public void processReqMetAndNotMet(List finalProgramRulesLis ruleProcessorData.setRequirementsMet(reqsMet); } - public void setDetailsForCourses(StudentCourse tempCourse, ProgramRequirement tempProgramRule, - List requirementsMet, List gradProgramRulesMatch, - String exceptionalCase, Map courseCreditException) { + private void setDetailsForCourses(StudentCourse tempCourse, ProgramRequirement tempProgramRule, + List requirementsMet, Map courseCreditException) { tempCourse.setUsed(true); tempCourse.setUsedInMatchRule(true); if (courseCreditException.get(tempProgramRule.getProgramRequirementCode().getProReqCode()) == null) { @@ -218,7 +215,6 @@ public void setDetailsForCourses(StudentCourse tempCourse, ProgramRequirement te @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("MatchIndigenousCreditsRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinAdultCoursesRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinAdultCoursesRule.java index dc91b893..6fe0b38d 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinAdultCoursesRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinAdultCoursesRule.java @@ -1,26 +1,21 @@ package ca.bc.gov.educ.api.ruleengine.rule; -import java.text.ParseException; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.stream.Collectors; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -import ca.bc.gov.educ.api.ruleengine.dto.ProgramRequirement; -import ca.bc.gov.educ.api.ruleengine.dto.GradRequirement; -import ca.bc.gov.educ.api.ruleengine.dto.RuleData; -import ca.bc.gov.educ.api.ruleengine.dto.RuleProcessorData; -import ca.bc.gov.educ.api.ruleengine.dto.StudentCourse; +import ca.bc.gov.educ.api.ruleengine.dto.*; import ca.bc.gov.educ.api.ruleengine.util.RuleEngineApiUtils; import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; @Data @Component @@ -172,7 +167,6 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("MinAdultCoursesRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1986Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1986Rule.java index 1bd04299..d6454d18 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1986Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1986Rule.java @@ -117,6 +117,5 @@ public void processReqMet(StudentCourse sc, ProgramRequirement gradProgramRule) @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("MinCredit1986Rule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1996Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1996Rule.java index 04da3379..d07624f6 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1996Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCredit1996Rule.java @@ -126,6 +126,5 @@ public void processReqMet(StudentCourse sc, ProgramRequirement gradProgramRule) @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("MinCredit1996Rule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCreditsElective12OtherRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCreditsElective12OtherRule.java index aa185ff8..e6a44396 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCreditsElective12OtherRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCreditsElective12OtherRule.java @@ -1,19 +1,18 @@ package ca.bc.gov.educ.api.ruleengine.rule; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - import ca.bc.gov.educ.api.ruleengine.dto.*; +import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; @Data @Component @@ -50,7 +49,7 @@ public RuleData fire() { return ruleProcessorData; } - List socialStudiesCourseCodeList = ruleProcessorData.getCourseRequirements().stream().filter(cr -> "502".equals(cr.getRuleCode().getCourseRequirementCode())).map(CourseRequirement::getCourseCode).toList(); + List socialStudiesCourseCodeList = ruleProcessorData.getCourseRequirements().stream().filter(cr -> "502".equals(cr.getRuleCode().getCourseRequirementCode())).map(CourseRequirement::getCourseCode).collect(Collectors.toList()); if (socialStudiesCourseCodeList.isEmpty()) { socialStudiesCourseCodeList = List.of(COURSE_CODE_SOCIAL_STUDIES); } @@ -182,14 +181,13 @@ public RuleData fire() { } private boolean existsRule505WithoutRule502(List reqsMet) { - List list = reqsMet.stream().filter(r -> "502".equalsIgnoreCase(r.getRule()) || "505".equalsIgnoreCase(r.getRule())).toList(); + List list = reqsMet.stream().filter(r -> "502".equalsIgnoreCase(r.getRule()) || "505".equalsIgnoreCase(r.getRule())).collect(Collectors.toList()); return list.size() == 1 && "505".equalsIgnoreCase(list.get(0).getRule()); } @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("MinCreditsElective12Rule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCreditsElective12Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCreditsElective12Rule.java index 4699f9f4..678a11e1 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCreditsElective12Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCreditsElective12Rule.java @@ -1,23 +1,18 @@ package ca.bc.gov.educ.api.ruleengine.rule; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - +import ca.bc.gov.educ.api.ruleengine.dto.*; +import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import ca.bc.gov.educ.api.ruleengine.dto.ProgramRequirement; -import ca.bc.gov.educ.api.ruleengine.dto.GradRequirement; -import ca.bc.gov.educ.api.ruleengine.dto.RuleData; -import ca.bc.gov.educ.api.ruleengine.dto.RuleProcessorData; -import ca.bc.gov.educ.api.ruleengine.dto.StudentCourse; -import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; @Data @Component @@ -120,7 +115,6 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("MinCreditsElective12Rule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCreditsRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCreditsRule.java index bf5f049f..533fc1e5 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCreditsRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinCreditsRule.java @@ -5,7 +5,6 @@ import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; - import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -128,6 +127,5 @@ public void processReqMet(StudentCourse sc, ProgramRequirement gradProgramRule) @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("MinCreditsRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1986Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1986Rule.java index 479084b4..c5f00b17 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1986Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1986Rule.java @@ -10,7 +10,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.*; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; import java.util.stream.Collectors; @Data @@ -92,7 +94,6 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("MinElectiveCredits1986Rule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java index 7bfc70c9..d7cc6b8e 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits1996Rule.java @@ -10,7 +10,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import java.util.*; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Map; import java.util.stream.Collectors; @Data @@ -113,7 +116,6 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("MinElectiveCredits1996Rule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits2023Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits2023Rule.java index a886323d..48da8339 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits2023Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCredits2023Rule.java @@ -123,6 +123,5 @@ private boolean hasMatchTypeRule(String gradReqMet) { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("MinElectiveCredits2023Rule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCreditsFrench1996Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCreditsFrench1996Rule.java index f5fcb678..3b5562ed 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCreditsFrench1996Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCreditsFrench1996Rule.java @@ -113,7 +113,6 @@ public RuleProcessorData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("MinElectiveCreditsFrench1996Rule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCreditsRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCreditsRule.java index 90f8492e..cd8a14ea 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCreditsRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/MinElectiveCreditsRule.java @@ -1,23 +1,18 @@ package ca.bc.gov.educ.api.ruleengine.rule; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - +import ca.bc.gov.educ.api.ruleengine.dto.*; +import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import ca.bc.gov.educ.api.ruleengine.dto.ProgramRequirement; -import ca.bc.gov.educ.api.ruleengine.dto.GradRequirement; -import ca.bc.gov.educ.api.ruleengine.dto.RuleData; -import ca.bc.gov.educ.api.ruleengine.dto.RuleProcessorData; -import ca.bc.gov.educ.api.ruleengine.dto.StudentCourse; -import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; @Data @Component @@ -100,7 +95,6 @@ private int processLeftOverCredits(StudentCourse sc, int requiredCredits, int to @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("MinElectiveCreditsRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/OptionalProgramMatchRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/OptionalProgramMatchRule.java index 0fa2dbea..ba20fb2d 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/OptionalProgramMatchRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/OptionalProgramMatchRule.java @@ -3,7 +3,6 @@ import ca.bc.gov.educ.api.ruleengine.dto.*; import ca.bc.gov.educ.api.ruleengine.util.RuleEngineApiUtils; import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; -import com.fasterxml.jackson.databind.ObjectMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @@ -45,7 +44,7 @@ public static void processOptionalProgramAssessmentMatchRule(OptionalProgramRule List finalAssessmentList = new ArrayList<>(); List finalOptionalProgramRulesList = new ArrayList<>(); - ObjectMapper objectMapper = new ObjectMapper(); + while (assessmentIterator.hasNext()) { StudentAssessment tempAssessment = assessmentIterator.next(); @@ -60,8 +59,8 @@ public static void processOptionalProgramAssessmentMatchRule(OptionalProgramRule logger.debug("TempAssmtReq: {}", tempAssessmentRequirement); OptionalProgramRequirement tempOptionalProgramRule = handleOptionalProgramRule(tempAssessmentRequirement, gradOptionalProgramRulesMatch, requirementsMet, tempAssessment, null); - AlgorithmSupportRule.copyAndAddIntoStudentAssessmentsList(tempAssessment, finalAssessmentList, objectMapper); - AlgorithmSupportRule.copyAndAddIntoOptionalProgramRulesList(tempOptionalProgramRule, finalOptionalProgramRulesList, objectMapper); + AlgorithmSupportRule.copyAndAddIntoStudentAssessmentsList(tempAssessment, finalAssessmentList); + AlgorithmSupportRule.copyAndAddIntoOptionalProgramRulesList(tempOptionalProgramRule, finalOptionalProgramRulesList); } obj.setStudentAssessmentsOptionalProgram(finalAssessmentList); @@ -228,7 +227,7 @@ public static void processOptionalProgramCourseMatchRule(OptionalProgramRuleProc List finalCourseList = new ArrayList<>(); List finalOptionalProgramRulesList = new ArrayList<>(); - ObjectMapper objectMapper = new ObjectMapper(); + while (courseIterator.hasNext()) { StudentCourse tempCourse = courseIterator.next(); @@ -246,8 +245,8 @@ public static void processOptionalProgramCourseMatchRule(OptionalProgramRuleProc OptionalProgramRequirement tempOptionalProgramRule = handleOptionalProgramCourseMatchRule(tempCourseRequirements, null, requirementsMet, tempCourse, gradOptionalProgramRulesMatch); - AlgorithmSupportRule.copyAndAddIntoStudentCoursesList(tempCourse, finalCourseList, objectMapper); - AlgorithmSupportRule.copyAndAddIntoOptionalProgramRulesList(tempOptionalProgramRule, finalOptionalProgramRulesList, objectMapper); + AlgorithmSupportRule.copyAndAddIntoStudentCoursesList(tempCourse, finalCourseList); + AlgorithmSupportRule.copyAndAddIntoOptionalProgramRulesList(tempOptionalProgramRule, finalOptionalProgramRulesList); } obj.setStudentCoursesOptionalProgram(finalCourseList); handleRule(gradOptionalProgramRulesMatch, finalOptionalProgramRulesList, requirementsNotMet, obj, requirementsMet); diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/OptionalProgramNoRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/OptionalProgramNoRule.java index d15577d7..d98eb765 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/OptionalProgramNoRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/OptionalProgramNoRule.java @@ -34,7 +34,7 @@ public RuleData fire() { if(program.compareTo("1996-PF")==0 && mapOptional.get("DD") != null) { obj = mapOptional.get("DD"); processOptionalProgramNoRules("DD",obj,mapOptional); - }else if(program.compareTo("2018-EN")==0 || program.compareTo("2004-EN")==0 || program.compareTo("2018-PF")==0 + } else if(program.compareTo("2018-EN")==0 || program.compareTo("2004-EN")==0 || program.compareTo("2018-PF")==0 ||program.compareTo("2004-PF")==0 || program.compareTo("1996-EN")==0 || program.compareTo("2023-EN")==0 || program.compareTo("2023-PF")==0) { if(mapOptional.get("AD") != null) { @@ -107,6 +107,5 @@ private void processOptionalProgramNoRules(String opPrgCode,OptionalProgramRuleP @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("OptionalProgramNoRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/ProgramCompletionDateRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/ProgramCompletionDateRule.java index a05dc0a3..1765e4f4 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/ProgramCompletionDateRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/ProgramCompletionDateRule.java @@ -1,21 +1,20 @@ package ca.bc.gov.educ.api.ruleengine.rule; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.stream.Collectors; - import ca.bc.gov.educ.api.ruleengine.dto.*; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - import ca.bc.gov.educ.api.ruleengine.util.RuleEngineApiUtils; import ca.bc.gov.educ.api.ruleengine.util.RuleProcessorRuleUtils; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; @Data @Component @@ -70,7 +69,6 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { - ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("ProgramCompletionDateRule: Rule Processor Data set."); - } + ruleProcessorData = (RuleProcessorData) inputData; + } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/RegistrationsDuplicateAssmtRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/RegistrationsDuplicateAssmtRule.java index bedf56d2..51b837ca 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/RegistrationsDuplicateAssmtRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/RegistrationsDuplicateAssmtRule.java @@ -32,7 +32,6 @@ public class RegistrationsDuplicateAssmtRule implements Rule { public RuleData fire() { List studentAssessmentsList = ruleProcessorData.getStudentAssessments(); - logger.debug("###################### Finding Duplicate Registrations ######################"); Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("PST"), Locale.CANADA); String today = RuleEngineApiUtils.formatDate(cal.getTime(), RuleEngineApiConstants.DEFAULT_DATE_FORMAT); boolean inProgressCourse1 = false; @@ -86,6 +85,5 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("RegistrationsDuplicateAssmtRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/RegistrationsDuplicateCrseRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/RegistrationsDuplicateCrseRule.java index c33f0c3e..78ec7636 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/RegistrationsDuplicateCrseRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/RegistrationsDuplicateCrseRule.java @@ -31,7 +31,6 @@ public class RegistrationsDuplicateCrseRule implements Rule { public RuleData fire() { List studentCourseList = ruleProcessorData.getStudentCourses(); - logger.debug("###################### Finding Duplicate Registrations ######################"); Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("PST"), Locale.CANADA); String today = RuleEngineApiUtils.formatDate(cal.getTime(), RuleEngineApiConstants.DEFAULT_DATE_FORMAT); boolean inProgressCourse1 = false; @@ -99,6 +98,5 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("RegistrationsDuplicateCrseRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/RegistrationsFailedCrseRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/RegistrationsFailedCrseRule.java index 99141e0c..3212289f 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/RegistrationsFailedCrseRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/RegistrationsFailedCrseRule.java @@ -32,7 +32,6 @@ public class RegistrationsFailedCrseRule implements Rule { public RuleData fire() { List studentCourseList = ruleProcessorData.getStudentCourses(); - logger.debug("###################### Finding Failed Registrations ######################"); Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("PST"), Locale.CANADA); boolean inProgressCourse = false; for (StudentCourse studentCourse : studentCourseList) { @@ -53,13 +52,14 @@ public RuleData fire() { .anyMatch(lg -> lg.getGrade().compareTo(finalLetterGrade) == 0 && lg.getPassFlag().compareTo("N") == 0); - if (failed) + if (failed) { studentCourse.setFailed(true); + } } } } - ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses(studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); + ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses("RegistrationsFailedCrseRule", studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); ruleProcessorData.setStudentCourses(studentCourseList); logger.debug("Registrations but Failed Courses: {}",(int) studentCourseList.stream().filter(sc-> sc.isDuplicate() && sc.isProjected()).count()); @@ -70,6 +70,5 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("RegistrationsDuplicateCrseRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/RegistrationsRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/RegistrationsRule.java index f4f19203..d56c6056 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/RegistrationsRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/RegistrationsRule.java @@ -32,8 +32,6 @@ public class RegistrationsRule implements Rule { public RuleData fire() { List studentCourseList = RuleProcessorRuleUtils.getUniqueStudentCourses(ruleProcessorData.getStudentCourses(),ruleProcessorData.isProjected()); - logger.debug("###################### Finding PROJECTED courses (For Projected GRAD) ######################"); - for (StudentCourse studentCourse : studentCourseList) { String today = RuleEngineApiUtils.formatDate(new Date(), "yyyy-MM-dd"); String sessionDate = studentCourse.getSessionDate() + "/01"; @@ -67,6 +65,5 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("RegistrationsRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/Remove2CreditCoursesRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/Remove2CreditCoursesRule.java index 57f39bee..c99361db 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/Remove2CreditCoursesRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/Remove2CreditCoursesRule.java @@ -28,8 +28,6 @@ public class Remove2CreditCoursesRule implements Rule { @Override public RuleData fire() { - logger.debug("###################### Finding 2 Credit Courses ######################"); - List studentCourseList = RuleProcessorRuleUtils.getUniqueStudentCourses( ruleProcessorData.getStudentCourses(), ruleProcessorData.isProjected()); @@ -40,10 +38,10 @@ public RuleData fire() { } } - ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses(studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); + ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses("Remove2CreditCoursesRule", studentCourseList,ruleProcessorData.getExcludedCourses(),ruleProcessorData.isProjected())); ruleProcessorData.setStudentCourses(studentCourseList); - logger.debug("Removed 2 Credit Courses: {0} ", + logger.debug("Removed 2 Credit Courses: {} ", (int) studentCourseList.stream().filter(StudentCourse::isLessCreditCourse).count()); return ruleProcessorData; @@ -52,6 +50,5 @@ public RuleData fire() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("DuplicateAssessmentsRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/RestrictedCoursesRule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/RestrictedCoursesRule.java index 0973af3d..1d41bc23 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/RestrictedCoursesRule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/RestrictedCoursesRule.java @@ -66,10 +66,10 @@ public RuleData fire() { } } } - ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses(studentCourses, ruleProcessorData.getExcludedCourses(), ruleProcessorData.isProjected())); + ruleProcessorData.setExcludedCourses(RuleProcessorRuleUtils.maintainExcludedCourses("RestrictedCoursesRule", studentCourses, ruleProcessorData.getExcludedCourses(), ruleProcessorData.isProjected())); ruleProcessorData.setStudentCourses(studentCourses); prepareCoursesForOptionalPrograms(); - logger.debug("Restricted Courses: {0} ", (int) studentCourses.stream().filter(StudentCourse::isRestricted).count()); + logger.debug("Restricted Courses: {} ", (int) studentCourses.stream().filter(StudentCourse::isRestricted).count()); return ruleProcessorData; } @@ -132,6 +132,5 @@ private void prepareCoursesForOptionalPrograms() { @Override public void setInputData(RuleData inputData) { ruleProcessorData = (RuleProcessorData) inputData; - logger.debug("RestrictedCoursesRule: Rule Processor Data set."); } } diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/Rule.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/Rule.java index 17ade00d..f18bd808 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/Rule.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/Rule.java @@ -1,11 +1,12 @@ package ca.bc.gov.educ.api.ruleengine.rule; +import ca.bc.gov.educ.api.ruleengine.dto.RuleData; import org.springframework.stereotype.Component; -import ca.bc.gov.educ.api.ruleengine.dto.RuleData; +import java.io.Serializable; @Component -public interface Rule { +public interface Rule extends Serializable { RuleData fire(); diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/RuleFactory.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/RuleFactory.java index d53fc698..2a4dbc55 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/RuleFactory.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/rule/RuleFactory.java @@ -1,12 +1,11 @@ package ca.bc.gov.educ.api.ruleengine.rule; -import java.util.Arrays; - +import ca.bc.gov.educ.api.ruleengine.dto.RuleProcessorData; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; -import ca.bc.gov.educ.api.ruleengine.dto.RuleProcessorData; +import java.util.Arrays; @Component public class RuleFactory { @@ -23,7 +22,6 @@ public static Rule createRule(String ruleImplementation, RuleProcessorData data) try { clazz = (Class) Class.forName("ca.bc.gov.educ.api.ruleengine.rule." + ruleImplementation); rule = clazz.getDeclaredConstructor(RuleProcessorData.class).newInstance(data); - logger.debug("Class Created: {}" , rule.getClass()); } catch (Exception e) { logger.debug("ERROR: No Such Class: {}" , ruleImplementation); logger.debug("Message: {}" , Arrays.toString(e.getStackTrace())); diff --git a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/util/RuleProcessorRuleUtils.java b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/util/RuleProcessorRuleUtils.java index 00bb6532..024e2f85 100644 --- a/api/src/main/java/ca/bc/gov/educ/api/ruleengine/util/RuleProcessorRuleUtils.java +++ b/api/src/main/java/ca/bc/gov/educ/api/ruleengine/util/RuleProcessorRuleUtils.java @@ -2,11 +2,11 @@ import ca.bc.gov.educ.api.ruleengine.dto.StudentAssessment; import ca.bc.gov.educ.api.ruleengine.dto.StudentCourse; -import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.commons.lang3.SerializationUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.IOException; +import java.io.Serializable; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -71,26 +71,24 @@ public static List getExcludedStudentCourses(List } @SuppressWarnings("unchecked") - public static T cloneObject(T input) throws IOException { - - ObjectMapper objectMapper = new ObjectMapper(); - - return (T) objectMapper - .readValue(objectMapper.writeValueAsString(input), input.getClass()); + public static T cloneObject(T input) { + return (T) SerializationUtils.clone((Serializable) input); } - public static List maintainExcludedCourses(List currentList,List existingExcludedList, boolean projected) { - List exclList = getExcludedStudentCourses(currentList, projected); - if(existingExcludedList == null) + public static List maintainExcludedCourses(String ruleName, List currentList, List existingExcludedList, boolean projected) { + List excludedStudentCourses = getExcludedStudentCourses(currentList, projected); + if(existingExcludedList == null) { existingExcludedList = new ArrayList<>(); + } - if(!exclList.isEmpty()) { - for(StudentCourse sc:exclList) { + if(!excludedStudentCourses.isEmpty()) { + for(StudentCourse sc:excludedStudentCourses) { StudentCourse tempCourse = existingExcludedList.stream() .filter(sp -> sp.getCourseCode().compareTo(sc.getCourseCode()) == 0 && sp.getCourseLevel().compareTo(sc.getCourseLevel())==0 && sp.getSessionDate().compareTo(sc.getSessionDate())==0 ) .findAny() .orElse(null); if(tempCourse == null) { + logger.debug("{} added the course to the excluded list {}", ruleName, sc); existingExcludedList.add(sc); } } @@ -100,12 +98,12 @@ public static List maintainExcludedCourses(List cu } public static List maintainExcludedAssessments(List currentList,List existingExcludedList, boolean projected) { - List exclList = getExcludedStudentAssessments(currentList, projected); + List excludedStudentAssessments = getExcludedStudentAssessments(currentList, projected); if(existingExcludedList == null) existingExcludedList = new ArrayList<>(); - if(!exclList.isEmpty()) { - for(StudentAssessment sc:exclList) { + if(!excludedStudentAssessments.isEmpty()) { + for(StudentAssessment sc:excludedStudentAssessments) { StudentAssessment tempAssmt = existingExcludedList.stream() .filter(sp -> sp.getAssessmentCode().compareTo(sc.getAssessmentCode()) == 0 && sp.getSessionDate().compareTo(sc.getSessionDate())==0) .findAny()