private String[] validateUIRules() { List<String> uiErrors = new ArrayList<String>(); if(form.lyrSpecColConfig().tabExceptionDays().dteExceptionDate().getValue() == null) { uiErrors.add("Please select a date."); } if(form.lyrSpecColConfig().tabExceptionDays().dteExceptionDate().getValue() != null && form.getLocalContext().getvoCollPublicHoliday() != null) { for(PublicHolidaysVo publicHoliday : form.getLocalContext().getvoCollPublicHoliday()) { if(publicHoliday == null) continue; if(form.getLocalContext().getvoPublicHoliday() != null && form.getLocalContext().getvoPublicHoliday().getID_PublicHolidays() != null && form.getLocalContext().getvoPublicHoliday().getID_PublicHolidays().equals(publicHoliday.getID_PublicHolidays())) continue; if(form.lyrSpecColConfig().tabExceptionDays().dteExceptionDate().getValue().equals(publicHoliday.getDate())) { uiErrors.add("Date entered is already inserted in Exception Dates list."); break; } } } String[] uiResults = new String[uiErrors.size()]; uiErrors.toArray(uiResults); return uiResults; }
public PublicHolidaysVo savePublicHolidays(PublicHolidaysVo voPublicHolidays) throws StaleObjectException { //Ensure the value object has been validated if (!voPublicHolidays.isValidated()) throw new DomainRuntimeException("Public Holidays has not been validated"); DomainFactory factory = getDomainFactory(); PublicHolidays domPublicHolidays = PublicHolidaysVoAssembler.extractPublicHolidays(factory, voPublicHolidays); factory.save(domPublicHolidays); return PublicHolidaysVoAssembler.create(domPublicHolidays); }