/** * 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; }