/**
  * Validate that objectId is the same for all tasks
  *
  * @param tasks
  * @return
  * @throws BusinessException
  */
 public static Long validateObjectId(List tasks) throws BusinessException {
   Long objectId = null;
   for (Object task1 : tasks) {
     Task task = (Task) task1;
     if (task.getObject() == null) {
       throw new BusinessException("objectId is null for task " + task.getTaskDescription());
     } else if (objectId != null && !objectId.equals(task.getObject().getId())) {
       throw new BusinessException(
           "objectId must be identical for all tasks in the job " + task.getTaskDescription());
     } else {
       objectId = task.getObject().getId();
     }
   }
   return objectId;
 }
 /**
  * Find task with max of worker required and return the number
  *
  * @param tasks
  * @return
  * @throws BusinessException
  */
 public static int extractMaxWorkersRequired(List tasks) throws BusinessException {
   int max = 0;
   for (Object task1 : tasks) {
     Task task = (Task) task1;
     if (task.getNumberOfWorkers() == null) {
       throw new BusinessException(
           "Number of workers is not set for task " + task.getTaskDescription());
     } else if (max < task.getNumberOfWorkers()) {
       max = task.getNumberOfWorkers();
     }
   }
   return max;
 }