@Override public OperationHistory getOperationHistoryByJobId(Subject subject, String historyJobId) { HistoryJobId jobIdObject = new HistoryJobId(historyJobId); Query query = entityManager.createNamedQuery(OperationHistory.QUERY_FIND_BY_JOB_ID); query.setParameter("jobName", jobIdObject.getJobName()); query.setParameter("jobGroup", jobIdObject.getJobGroup()); query.setParameter("createdTime", jobIdObject.getCreatedTime()); OperationHistory history; try { history = (OperationHistory) query.getSingleResult(); } catch (Exception e) { history = null; } if (history == null) { throw new RuntimeException("Cannot get history - it does not exist: " + historyJobId); } ensureViewPermission(subject, history); return history; }
/** * 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)); } }
public HistoryJobId(String jobIdString) { this(splitJobIdStringIntoParts(jobIdString)); }
/** * The single job ID which identifies this specific history item. It can later be parsed via * {@link HistoryJobId#HistoryJobId(String)}. * * @return job ID */ public HistoryJobId getJobId() { return new HistoryJobId(this.jobName, this.jobGroup, this.createdTime); }
String jobIdString = doomedHistory.getJobId().toString(); int resourceId = doomedHistory.getResource().getId(); CancelResults results = null;
@Override public int hashCode() { return getJobId().hashCode(); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if ((obj == null) || !(obj instanceof OperationHistory)) { return false; } final OperationHistory other = (OperationHistory) obj; return this.getJobId().equals(other.getJobId()); }
AgentClient agentClient = agentManager.getAgentClient(getOverlord(), resource.getId()); agentClient.getOperationAgentService().invokeOperation(resourceHistory.getJobId().toString(), resource.getId(), schedule.getOperationName(), schedule.getParameters()); } catch (Exception e) {