/** * Finf highest skill level from the given task list * * @param tasks * @throws BusinessException */ public static int extractSkillLevel(List tasks) throws BusinessException { int skillLevel = 0; for (Object task1 : tasks) { Task task = (Task) task1; if (ConvertUtils.intVal(task.getSkillLevelId()) > skillLevel) { skillLevel = ConvertUtils.intVal(task.getSkillLevelId()); } } // not sure if its a violation if(skillLevel==0) throw new BusinessException("Failed to // determine job skill level. All supplied tasks have no skill level set!"); return skillLevel; }
/** * Finf highest priority from task list * * @param tasks * @return * @throws BusinessException */ public static int extractPriority(List tasks) throws BusinessException { int priorityId = 0; for (Object task1 : tasks) { Task task = (Task) task1; if (ConvertUtils.intVal(task.getPriorityId()) > priorityId) { priorityId = ConvertUtils.intVal(task.getPriorityId()); } } if (priorityId == 0) throw new BusinessException( "Failed to determine job priority. All supplied tasks have no priority set!"); return priorityId; }
/** * Calculate sum of estimated times for tasks in the given list * * @param tasks */ public static long extractEstimatedTime(List tasks) { long rtn = 0L; for (Object task1 : tasks) { Task task = (Task) task1; rtn += ConvertUtils.intVal(task.getEstTime()); } return rtn; }