Created
December 23, 2012 05:42
-
-
Save danveloper/4362186 to your computer and use it in GitHub Desktop.
Enrollment processor for rules engine post
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EnrollmentProcessor { | |
static def enrollmentRulesFactory = new RulesEngineFactory<EnrollmentRulesEngine>(EnrollmentRulesEngine) | |
def studentService | |
def annualDormHallAssignment() { | |
def students = Student.list(/* do some filtering maybe to make sure they are enrolling for this year,etc. */) | |
def errors = [] | |
students.each { student -> | |
try { | |
def studentEnrollmentRulesEngine = enrollmentRulesFactory.getObject(student) | |
studentEnrollmentRulesEngine.apply() | |
studentService.save(student) | |
} catch (Exception e) { | |
errors << student | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment