String jobName = db.getDbReference() + "." + job.getName();
try {
Task task = null;
if (job.getType() == JobDefinition.TYPE_TMLSCRIPTMODULE) {
ScriptTask scriptTask = new ScriptTask();
scriptTask.setCancelJobOnFail(true);
scriptTask.setDatabase(db.getDbReference());
scriptTask.setModule(job.getResource());
task = scriptTask;
}
else if (job.getType() == JobDefinition.TYPE_JAVA) {
JavaTask javaTask = new JavaTask();
javaTask.setClassName(job.getResource());