return outputBean;
}
private JsonBean getJobs(RequestContext ctx) {
String sjid = ctx.getLastURLElement();
JobBean bean;
AuditLoggerManager.getInstance()
.logAuditEvent(ctx.getUserName(), ctx.getRequest().getRemoteAddr(),
"get", "job", sjid);
Locale locale = ctx.getAcceptLanguageHeader();
Repository repository = RepositoryManager.getInstance().getRepository();
if (sjid.equals("all")) {
List<MJob> jobs = repository.findJobs();
bean = new JobBean(jobs);
// Add associated resources into the bean
for( MJob job : jobs) {
long connectorId = job.getConnectorId();
if(!bean.hasConnectorBundle(connectorId)) {
bean.addConnectorBundle(connectorId,
ConnectorManager.getInstance().getResourceBundle(connectorId, locale));
}
}
} else {
long jid = Long.valueOf(sjid);
MJob job = repository.findJob(jid);
long connectorId = job.getConnectorId();
bean = new JobBean(job);
bean.addConnectorBundle(connectorId,
ConnectorManager.getInstance().getResourceBundle(connectorId, locale));
}
// Sent framework resource bundle in all cases
bean.setFrameworkBundle(FrameworkManager.getInstance().getBundle(locale));
return bean;
}