@Override public ResourceOperationSchedule getResourceOperationSchedule(Subject subject, String jobId) throws SchedulerException { JobId jobIdObject = new JobId(jobId); JobDetail jobDetail = scheduler.getJobDetail(jobIdObject.getJobName(), jobIdObject.getJobGroup()); ResourceOperationSchedule resourceOperationSchedule = getResourceOperationSchedule(subject, jobDetail); if (resourceOperationSchedule == null) { throw new SchedulerException("The job with ID [" + jobId + "] is no longer scheduled."); } return resourceOperationSchedule; }
/** * Returns the hash code of the string that is returned by {@link #toString()}. * * @see java.lang.Object#hashCode() */ @Override public int hashCode() { return toString().hashCode(); }
/** * Returns the single string that identifies the unique job ID. * * @see java.lang.Object#toString() */ @Override public String toString() { return joinPartsIntoJobIdString(jobName, jobGroup); }
public void addFilterJobId(JobId filterJobId) { this.filterJobName = filterJobId.getJobName(); this.filterJobGroup = filterJobId.getJobGroup(); }
public OperationScheduleComposite(int id, String jobName, String jobGroup, String operationName, long operationNextFireTime) { this.id = id; this.jobId = new JobId(jobName, jobGroup); this.operationName = operationName; this.operationNextFireTime = operationNextFireTime; }
@Override public void setJobGroup(String jobGroup) { super.setJobGroup(jobGroup); } }
public JobId(String jobIdString) { this(splitJobIdStringIntoParts(jobIdString)); }
@Override public void setJobName(String jobName) { super.setJobName(jobName); }
@Override public int hashCode() { return getJobId().hashCode(); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if ((obj == null) || !(obj instanceof OperationScheduleEntity)) { return false; } final OperationScheduleEntity other = (OperationScheduleEntity) obj; return this.getJobId().equals(other.getJobId()); }
/** * The single job ID which identifies the operation. It can later be parsed via {@link JobId#JobId(String)}. Note * that this job ID only identifies the scheduled operation; it does not identify any specific invocation of that * operation (see {@link HistoryJobId} for that). * * @return job ID */ @XmlElement public JobId getJobId() { return new JobId(this.jobName, this.jobGroup); }
@Override public GroupOperationSchedule getGroupOperationSchedule(Subject subject, String jobId) throws SchedulerException { JobId jobIdObject = new JobId(jobId); JobDetail jobDetail = scheduler.getJobDetail(jobIdObject.getJobName(), jobIdObject.getJobGroup()); GroupOperationSchedule groupOperationSchedule = getGroupOperationSchedule(subject, jobDetail); if (groupOperationSchedule == null) { throw new SchedulerException("The job with ID [" + jobId + "] is no longer scheduled."); } return groupOperationSchedule; }
/** * Compares the strings returned by {@link #toString()}, assuming <code>obj</code> is another {@link JobId}. * * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object obj) { if (this == obj) { return true; } if ((obj == null) || !(obj instanceof JobId)) { return false; } return this.toString().equals(obj.toString()); }
JobId jobId = new JobId(jobName); criteria.addFilterJobId(jobId);
/** * Returns the single string that contains the unique job ID which identifies a particular invocation of a * particular job. This string is used to determine this object's hash code and for equality checks. Note that * {@link HistoryJobId} objects are only ever equal to other {@link HistoryJobId} objects (they are never equal to * concrete instances of {@link JobId}). * * @see java.lang.Object#toString() */ public String toString() { return joinPartsIntoJobIdString(super.toString(), Long.toString(createdTime)); } }
/** * @return This returns all optional data and should be suitable for modification and subsequent update. */ protected ResourceOperationHistory findOperationHistory(String name, String group, OperationManagerLocal operationManager, ResourceOperationSchedule schedule) { JobId jobId = new JobId(name, group); ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria(); criteria.addFilterJobId(jobId); criteria.fetchOperationDefinition(true); criteria.fetchParameters(true); criteria.fetchResults(true); ResourceOperationHistory history; List<ResourceOperationHistory> list = operationManager.findResourceOperationHistoriesByCriteria( schedule.getSubject(), criteria); if (list == null || list.isEmpty()) { return null; } history = list.get(0); return history; } }
@Override public ResourceOperationSchedule getResourceOperationSchedule(Subject whoami, int scheduleId) { OperationScheduleEntity operationScheduleEntity = entityManager.find(OperationScheduleEntity.class, scheduleId); try { ResourceOperationSchedule resourceOperationSchedule = getResourceOperationSchedule(whoami, operationScheduleEntity.getJobId().toString()); return resourceOperationSchedule; } catch (SchedulerException e) { throw new RuntimeException("Failed to retrieve ResourceOperationSchedule with id [" + scheduleId + "].", e); } }
JobId filterJobId; try { filterJobId = new JobId(jobName); } catch (Exception e) {
@Override public GroupOperationSchedule getGroupOperationSchedule(Subject whoami, int scheduleId) { OperationScheduleEntity operationScheduleEntity = entityManager.find(OperationScheduleEntity.class, scheduleId); try { GroupOperationSchedule groupOperationSchedule = getGroupOperationSchedule(whoami, operationScheduleEntity .getJobId().toString()); return groupOperationSchedule; } catch (SchedulerException e) { throw new RuntimeException("Failed to retrieve GroupOperationSchedule with id [" + scheduleId + "].", e); } }