Package pl.net.bluesoft.rnd.pt.ext.sched.service

Examples of pl.net.bluesoft.rnd.pt.ext.sched.service.ProcessToolSchedulerService


  }
 
  /** Scheduler job for period notifications sending */
    public void scheduleNotificationsSend(BpmNotificationEngine engine)
    {
        ProcessToolSchedulerService service = getSchedulerService();
       
        JobDataMap dataMap = new JobDataMap();
        dataMap.put("bpmNotificationEngine", engine);

        String identity = "engine_notifications";

        JobDetail jobDetail = JobBuilder.newJob(HandleEmailsJob.class)
                .withIdentity(identity, HandleEmailsJob.class.getName())
                .usingJobData(dataMap)
                .build();

        Trigger trigger = TriggerBuilder.newTrigger()
                .withIdentity(identity, HandleEmailsJob.class.getName())
                .withSchedule(simpleSchedule().withIntervalInSeconds(30).repeatForever())
                .forJob(jobDetail)
                .build();

        logger.info("Scheduling notifications job handler");
       
        service.scheduleJob(jobDetail, trigger);
    }
View Full Code Here


                .setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY)
                .add(Subqueries.propertyIn("id", pdc)).list();
    }

    public void destroy() {
        ProcessToolSchedulerService service = getSchedulerService();
        service.cancelScheduledJobGroup(HandleDeadlineJob.class.getName());
    }
View Full Code Here

    private ProcessToolSchedulerService getSchedulerService() {
        return registry.getRegisteredService(ProcessToolSchedulerService.class);
    }

    private void scheduleDeadline(String processInternalId, ProcessDeadline pd) {
        ProcessToolSchedulerService service = getSchedulerService();
        Date currentDate = new Date(), dueDate = pd.getDueDate();
        if (DateUtils.isSameDay(dueDate, currentDate) || currentDate.before(dueDate) || !pd.isAlreadyProcessed()) {
            JobDataMap dataMap = new JobDataMap();
            dataMap.put("processInstanceId", processInternalId);
            dataMap.put("deadlineAttribute", pd);
            dataMap.put("deadlineEngine", this);

            String taskName = pd.getTaskName();
            String identity = "pi:" + processInternalId + ";task:" + taskName;

            JobDetail jobDetail = JobBuilder.newJob(HandleDeadlineJob.class)
                    .withIdentity(identity, HandleDeadlineJob.class.getName())
                    .usingJobData(dataMap)
                    .build();

            Trigger trigger = TriggerBuilder.newTrigger()
                    .withIdentity(identity, HandleDeadlineJob.class.getName())
                    .startAt(dueDate)
                    .forJob(jobDetail)
                    .build();

            logger.info("Scheduling deadline job handler at: " + dueDate + " for process instance: " + processInternalId
                    + " and task name: " + taskName);
            service.scheduleJob(jobDetail, trigger);
        }
    }
View Full Code Here

TOP

Related Classes of pl.net.bluesoft.rnd.pt.ext.sched.service.ProcessToolSchedulerService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.