Skip to content

Instantly share code, notes, and snippets.

@danveloper
Created December 23, 2012 05:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danveloper/4362186 to your computer and use it in GitHub Desktop.
Save danveloper/4362186 to your computer and use it in GitHub Desktop.
Enrollment processor for rules engine post
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