Search in sources :

Example 1 with BatchjobsSchedulerDto

use of org.mifos.application.admin.servicefacade.BatchjobsSchedulerDto in project head by mifos.

the class BatchjobsServiceFacadeWebTier method getBatchjobsScheduler.

@Override
public BatchjobsSchedulerDto getBatchjobsScheduler(ServletContext context) throws SchedulerException {
    MifosScheduler mifosScheduler = (MifosScheduler) context.getAttribute(MifosScheduler.class.getName());
    Scheduler scheduler = mifosScheduler.getScheduler();
    BatchjobsSchedulerDto batchjobsScheduler = new BatchjobsSchedulerDto(!scheduler.isInStandbyMode());
    return batchjobsScheduler;
}
Also used : Scheduler(org.quartz.Scheduler) MifosScheduler(org.mifos.framework.components.batchjobs.MifosScheduler) BatchjobsSchedulerDto(org.mifos.application.admin.servicefacade.BatchjobsSchedulerDto) MifosScheduler(org.mifos.framework.components.batchjobs.MifosScheduler)

Example 2 with BatchjobsSchedulerDto

use of org.mifos.application.admin.servicefacade.BatchjobsSchedulerDto in project head by mifos.

the class BatchjobsController method produceModelAndView.

private ModelAndView produceModelAndView(HttpServletRequest request, List<String> errorMessages) {
    ServletContext context = request.getSession().getServletContext();
    List<BatchjobsDto> batchjobs;
    BatchjobsSchedulerDto batchjobsScheduler;
    try {
        batchjobs = batchjobsServiceFacade.getBatchjobs(context);
    } catch (Exception tse) {
        errorMessages.add("Error when retrieving batch jobs information: " + tse.getMessage());
        batchjobs = new ArrayList<BatchjobsDto>();
    }
    try {
        batchjobsScheduler = batchjobsServiceFacade.getBatchjobsScheduler(context);
    } catch (Exception tse) {
        errorMessages.add("Error when retrieving batch jobs information: " + tse.getMessage());
        batchjobsScheduler = new BatchjobsSchedulerDto(false);
    }
    Map<String, Object> model = new HashMap<String, Object>();
    model.put("request", request);
    model.put("batchjobs", batchjobs);
    if (batchjobsScheduler == null) {
        model.put("scheduler", "");
    } else {
        model.put("scheduler", batchjobsScheduler.isStatus());
    }
    model.put("date0", new Date(0));
    model.put("executedTasks", rawJobList);
    if (rawJobList.length > 0) {
        rawJobList = new String[0];
    }
    Map<String, Object> status = new HashMap<String, Object>();
    status.put("errorMessages", errorMessages);
    ModelAndView modelAndView = new ModelAndView("batchjobs", "model", model);
    modelAndView.addObject("status", status);
    return modelAndView;
}
Also used : HashMap(java.util.HashMap) BatchjobsSchedulerDto(org.mifos.application.admin.servicefacade.BatchjobsSchedulerDto) ArrayList(java.util.ArrayList) ModelAndView(org.springframework.web.servlet.ModelAndView) ServletContext(javax.servlet.ServletContext) BatchjobsDto(org.mifos.application.admin.servicefacade.BatchjobsDto) AccessDeniedException(org.springframework.security.access.AccessDeniedException) Date(java.util.Date)

Aggregations

BatchjobsSchedulerDto (org.mifos.application.admin.servicefacade.BatchjobsSchedulerDto)2 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 ServletContext (javax.servlet.ServletContext)1 BatchjobsDto (org.mifos.application.admin.servicefacade.BatchjobsDto)1 MifosScheduler (org.mifos.framework.components.batchjobs.MifosScheduler)1 Scheduler (org.quartz.Scheduler)1 AccessDeniedException (org.springframework.security.access.AccessDeniedException)1 ModelAndView (org.springframework.web.servlet.ModelAndView)1