LoadingJob

Last modified by Ludovic Dubost on 2009/10/18 22:11

Recruitment Emails Loading

Automatic loading of candidacy emails. Emails will be read from a mailbox, loaded and deleted.

0 0/5 * * * ?
The script is the code that will be executed when the job is triggered by the scheduler. It should be written in the Groovy language. The XWiki API is available through the xwiki and context pre-defined variables.
try {
 System.out.println("RECRUITMENT CONTACT LOADING: start");
def ldc = xwiki.parseGroovyFromPage("RecruitmentCode.LoadingGroovy")
 ldc.setContext(new Context(context), xwiki)
 ldc.setMailServerFromPage("Recruitment.Settings")
 ldc.loadContacts(10, true)
 System.out.println("RECRUITMENT CONTACT LOADING: end");
} catch (Throwable e) {
 System.out.println("RECRUITMENT CONTACT LOADING: exception while loading: " + e.getMessage());
 e.printStackTrace();
def econtext = context.context.getEngineContext()
def msglist = econtext.getAttribute("recruitment_loadcontacts_debug")
if (msglist==null) {
  msglist = new ArrayList()
  econtext.setAttribute("recruitment_loadcontacts_debug", msglist)
}
 msglist.add("RECRUITMENT CONTACT LOADING: exception while loading: " + e.getMessage());
}

Back to the job list