@Override public void executeEvent(final CatchingEventUUID eventUUID) throws EventNotFoundException { final EventService eventService = EnvTool.getEventService(); final long id = Long.parseLong(eventUUID.getValue()); final Job job = eventService.getJob(id); if (EventConstants.TIMER.equals(job.getEventType())) { updateExpirationDate(job, new Date()); } }
private CatchingEvent getEvent(final Job job) { final String eventPosition = job.getEventPosition(); CatchingEventImpl event = null; final CatchingEventUUID uuid = new CatchingEventUUID(String.valueOf(job.getId())); Position position = null; if (EventConstants.START.equals(eventPosition)) { position = Position.START; } else if (EventConstants.INTERMEDIATE.equals(eventPosition)) { position = Position.INTERMEDIATE; } else if (EventConstants.BOUNDARY.equals(eventPosition)) { position = Position.BOUNDARY; } else if (EventConstants.DEADLINE.equals(eventPosition)) { position = Position.DEADLINE; } event = new CatchingEventImpl(uuid, position, Type.TIMER, job.getFireTime(), job.getActivityDefinitionUUID(), null, job.getInstanceUUID(), null, null); return event; }
@Override public void updateExpirationDate(final CatchingEventUUID eventUUID, final Date expiration) throws EventNotFoundException { final EventService eventService = EnvTool.getEventService(); final long id = Long.parseLong(eventUUID.getValue()); final Job job = eventService.getJob(id); if (job == null) { throw new EventNotFoundException("Event " + id + "does not exist."); } updateExpirationDate(job, expiration); }
@Override public CatchingEvent getEvent(final CatchingEventUUID eventUUID) throws EventNotFoundException { final EventService eventService = EnvTool.getEventService(); final long jobId = Long.parseLong(eventUUID.getValue()); final Job job = eventService.getJob(jobId); if (job == null) { throw new EventNotFoundException("Event " + jobId + "does not exist."); } return getEvent(job); }
@Override public void deleteEvent(final CatchingEventUUID eventUUID) throws EventNotFoundException { final EventService eventService = EnvTool.getEventService(); final long id = Long.parseLong(eventUUID.getValue()); final Job job = eventService.getJob(id); if (job == null) { throw new EventNotFoundException("Event " + id + "does not exist."); } eventService.removeJob(job); EnvTool.getEventExecutor().refreshEventMatcher(); }