Package org.opencustomer.connector.scheduling

Examples of org.opencustomer.connector.scheduling.SchedulingManager


            }
        }
        else  if(saveOrUpdateEvent.getEntity() instanceof JobVO)
        {
            JobVO job = (JobVO)saveOrUpdateEvent.getEntity();
            SchedulingManager manager = SchedulingManager.getInstance();
            JobReminderMail reminderMail;
            try
            {
                reminderMail = new JobReminderMail();
                reminderMail.setUser(job.getAssignedUser());
            }
            catch (NoValidSenderException e1)
            {
                log.warn("no person for user: " + job.getAssignedUser());
                return;
            }
            catch (AddressException e1)
            {
                log.warn("cannot create reminder mail, incorrect sender address");
                return;
            }
           
            reminderMail.setJob(job);
            MailJob mailJob = new MailJob(reminderMail);
           
            for(Object obj :  manager.getAlarmManager().getAllAlarms())
            {
                AlarmEntry alarmEntry = (AlarmEntry) obj;
                String name;
                if(alarmEntry.getName().equals("JOB" + job.getId())){
                    if(log.isDebugEnabled())
                        log.debug("removing mail job for [job]: " + job);
                    manager.getAlarmManager().removeAlarm(alarmEntry);
                }
            }
            try
            {
                if(log.isInfoEnabled())
                    log.info("adding mailJob for [job]: " + job);
                String name;
                Calendar reminderDate = GregorianCalendar.getInstance();
                reminderDate.setTime(job.getDueDate());
                reminderDate.add(Calendar.MINUTE, -1 * Settings.getInstance().getAlarmBeforeJob());
                AlarmEntry alarmEntry = new AlarmEntry("JOB" + job.getId(),reminderDate.getTime(),mailJob);
                alarmEntry.setRingInNewThead();
                manager.getAlarmManager().addAlarm(alarmEntry);
            }
            catch (PastDateException e)
            {
                log.info("ignoring old job alarm: " + job);
            }
View Full Code Here


            return;
        }
        if(event.getObject() instanceof EventVO)
        {
            EventVO eventVO = (EventVO) event.getObject();
            SchedulingManager manager = SchedulingManager.getInstance();
           
            for(Object obj :  manager.getAlarmManager().getAllAlarms())
            {
                AlarmEntry alarmEntry = (AlarmEntry) obj;
                if(alarmEntry.getName().contains("EVENT"+eventVO.getId())){
                    if(log.isDebugEnabled())
                        log.debug("removing mail job for: " + eventVO);
                    manager.getAlarmManager().removeAlarm(alarmEntry);
                }
            }
        }
        else if(event.getObject() instanceof JobVO)
        {
            JobVO job = (JobVO) event.getObject();
            SchedulingManager manager = SchedulingManager.getInstance();
           
            for(Object obj :  manager.getAlarmManager().getAllAlarms())
            {
                AlarmEntry alarmEntry = (AlarmEntry) obj;
                if(alarmEntry.getName().contains("JOB" + job.getId())){
                    if(log.isDebugEnabled())
                        log.debug("removing mail job for: " + job);
                    manager.getAlarmManager().removeAlarm(alarmEntry);
                }
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.opencustomer.connector.scheduling.SchedulingManager

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.