public static void validateEstimatedTime(TaskDefinition vo) throws BusinessException { if (vo.getEstTime() == null || vo.getEstTime() <= 0) { throw new BusinessException("Estimated time must be defined and greater than zero"); } }
public static void validateTaskType(TaskDefinition vo) throws BusinessException { if (EqualsUtils.areEqual( Integer.valueOf(TaskTypeRef.getIdByCode(TaskTypeRef.ROUTINE_MAINT)), vo.getTaskTypeId())) { // first check if Meter based if (vo.getRunHoursThreshInc() != null) { // Meter based if (vo.getFrequencyId() != null || vo.getFreqMonths() != null || vo.getFreqDays() != null) throw new BusinessException( "Meter based frequency is not compatible with Time based settings!"); } else { // Frequency based if (vo.getFrequencyId() == null && vo.getFreqMonths() == null && vo.getFreqDays() == null) throw new BusinessException("Routine Tasks must have frequency!"); } } else { if (vo.getFrequencyId() != null || vo.getRunHoursThreshInc() != null || vo.getFreqDays() != null || vo.getFreqDays() != null) throw new BusinessException("Non Routine Tasks may not have frequency!"); } }