示例#1
0
 /** @see java.lang.Comparable#compareTo(java.lang.Object) */
 public int compareTo(TaskState task) {
   switch (currentSort) {
     case SORT_BY_DESCRIPTION:
       return (currentOrder == ASC_ORDER)
           ? (description.compareTo(task.description))
           : (task.description.compareTo(description));
     case SORT_BY_NAME:
       return (currentOrder == ASC_ORDER)
           ? (name.compareTo(task.name))
           : (task.name.compareTo(name));
     case SORT_BY_STATUS:
       return (currentOrder == ASC_ORDER)
           ? (getStatus().compareTo(task.getStatus()))
           : (task.getStatus().compareTo(getStatus()));
     case SORT_BY_STARTED_TIME:
       return (currentOrder == ASC_ORDER)
           ? ((int) (getStartTime() - task.getStartTime()))
           : ((int) (task.getStartTime() - getStartTime()));
     case SORT_BY_FINISHED_TIME:
       return (currentOrder == ASC_ORDER)
           ? ((int) (getFinishedTime() - task.getFinishedTime()))
           : ((int) (task.getFinishedTime() - getFinishedTime()));
     case SORT_BY_EXECUTIONLEFT:
       return (currentOrder == ASC_ORDER)
           ? (Integer.valueOf(getNumberOfExecutionLeft())
               .compareTo(Integer.valueOf(task.getNumberOfExecutionLeft())))
           : (Integer.valueOf(task.getNumberOfExecutionLeft())
               .compareTo(Integer.valueOf(getNumberOfExecutionLeft())));
     case SORT_BY_EXECUTIONONFAILURELEFT:
       return (currentOrder == ASC_ORDER)
           ? (Integer.valueOf(getNumberOfExecutionOnFailureLeft())
               .compareTo(Integer.valueOf(task.getNumberOfExecutionOnFailureLeft())))
           : (Integer.valueOf(task.getNumberOfExecutionOnFailureLeft())
               .compareTo(Integer.valueOf(getNumberOfExecutionOnFailureLeft())));
     case SORT_BY_HOST_NAME:
       return (currentOrder == ASC_ORDER)
           ? (getExecutionHostName().compareTo(task.getExecutionHostName()))
           : (task.getExecutionHostName().compareTo(getExecutionHostName()));
     case SORT_BY_EXEC_DURATION:
       return (currentOrder == ASC_ORDER)
           ? (int) (getExecutionDuration() - task.getExecutionDuration())
           : (int) (task.getExecutionDuration() - getExecutionDuration());
     default:
       return (currentOrder == ASC_ORDER)
           ? (getId().compareTo(task.getId()))
           : (task.getId().compareTo(getId()));
   }
 }
 @Override
 public boolean isTaskFinished(String jobId, String taskName)
     throws UnknownJobException, NotConnectedException, PermissionException, UnknownTaskException {
   boolean finished = false;
   try {
     TaskStateData taskStateData = restApi().jobtasks(sid, jobId, taskName);
     TaskState taskState = taskState(taskStateData);
     finished = !taskState.getStatus().isTaskAlive();
   } catch (Exception e) {
     throwUJEOrNCEOrPEOrUTE(e);
   }
   return finished;
 }