Exemplo n.º 1
0
 @Override
 public void checkInvalidValuesCalendar(BaseCalendar entity)
         throws ValidationException {
     if (baseCalendarDAO.thereIsOtherWithSameName(entity)) {
         InvalidValue[] invalidValues2 = { new InvalidValue(_(
                 "{0} already exists", entity.getName()),
                 BaseCalendar.class, "name", entity.getName(), entity) };
         throw new ValidationException(invalidValues2,
                 _("Could not save the new calendar"));
     }
 }
Exemplo n.º 2
0
    /**
     * Search for a {@link BaseCalendar} that has this name.
     *
     * @param baseCalendars
     *            List<BaseCalendar> to search into.
     * @param name
     *            Search condition
     * @return BaseCalendar with the name equal to the search condition.
     */
    private BaseCalendar findBaseCalendarParent(
            List<BaseCalendar> baseCalendars, String name) {

        for (BaseCalendar baseCalendar:  baseCalendars){

            if (Objects.equals(baseCalendar.getName(), name)){

                return baseCalendar;

            }
        }

        return null;
    }