Package javax.faces.validator

Examples of javax.faces.validator.ValidatorException


      Date convertedDate = calendar.getTime();
     
      String weekday = _dayMap.get(calendar.get(Calendar.DAY_OF_WEEK));
      if (_getInvalidDaysOfWeek().contains(weekday))
      {
        throw new ValidatorException(
            _getWrongWeekDayMessage(context, component, value, weekday));
      }
     
      String month = _monthMap.get(calendar.get(Calendar.MONTH));
      if ( _getInvalidMonths().contains(month))
      {
        throw new ValidatorException(
            _getWrongMonthMessage(context, component, value, month));
      }
     
      DateListProvider dlp = getInvalidDays();
      List<Date> dates = null;
      if (dlp != null)
      {
        dates = dlp.getDateList(context, calendar, calendar.getTime(), calendar.getTime());
      }
     
      if(dates!=null)
      {
        for (Date date : dates)
        {
          //range is only one submitted day...
          if(!date.before(convertedDate) && !date.after(convertedDate))
          {
            throw new ValidatorException(
                _getWrongDayMessage(context, component, value, date));
          }
        }
      }
    }
View Full Code Here


      // range validation
      if(isMaximumSet() && isMinimumSet())
      {
        if(length<min || length>max)
        {
          throw new ValidatorException(
            _getNotInRangeMessage(context, component, value, min, max));
        }
      }
      // too short
      if(isMinimumSet())
      {
        if (length < min)
        {
          throw new ValidatorException(
            _getMinimumMessage(context, component, value, min));
        }
      }
      // too long
      if(isMaximumSet())
      {
        if (length > max)
        {
          throw new ValidatorException(
            _getMaximumMessage(context, component, value, max));
        }
      }
    }
  }
View Full Code Here

     
      if(isMaximumSet() && isMinimumSet())
      {
        if(longValue<min || longValue>max)
        {
          throw new ValidatorException(
            _getNotInRangeMessage(context, component, value, min, max));
        }
      }
     
      if(isMaximumSet())
      {
        if (longValue > max)
        {
          throw new ValidatorException(
            _getMaximumMessage(context, component, value, IntegerUtils.getString(max)));
        }
      }
     
      if(isMinimumSet())
      {
        if (longValue < min)
        {
            throw new ValidatorException(
              _getMinimumMessage(context, component, value, IntegerUtils.getString(min)));
        }
      }
    }
    catch (NumberFormatException nfe)
    {
      FacesMessage msg = _getNotCorrectType(context);
      throw new ValidatorException(msg);
    }
  }
View Full Code Here

        }

        if ((message.getSummary() != null || message.getDetail() != null) &&
            entryOfSource.getClientId() != null && !entryOfSource.getClientId().equals(entryOfTarget.getClientId()))
        {
            ValidatorException validatorException = new ValidatorException(message);

            boolean isSourceMetaDataUsed = false;

            if(entryOfTarget.getMetaDataEntry() == null)
            {
                prepareTargetMetaDataForSeverityAwareInterception(entryOfSource, entryOfTarget);
                isSourceMetaDataUsed = true;
            }
           
            if(ExtValUtils.executeAfterThrowingInterceptors(
                    entryOfTarget.getComponent(), entryOfTarget.getMetaDataEntry(),
                    entryOfTarget.getConvertedObject(), validatorException, this))
            {
                ExtValUtils.tryToAddViolationMessageForComponentId(entryOfTarget.getClientId(),
                        ExtValUtils.convertFacesMessage(validatorException.getFacesMessage()));
            }

            if(isSourceMetaDataUsed)
            {
                resetTargetMetaData(entryOfTarget);
View Full Code Here

        {
            //TODO
            if(ExtValUtils.executeAfterThrowingInterceptors(entryOfSource.getComponent(),
                    entryOfSource.getMetaDataEntry(),
                    entryOfSource.getConvertedObject(),
                    new ValidatorException(message),
                    this))
            {
                ExtValUtils.tryToThrowValidatorExceptionForComponent(entryOfSource.getComponent(), message, null);
            }
        }
View Full Code Here

      Date min = getMinimum();
      if (max != null && (converted.after(max)))
      {
        if (min != null)
        {
           throw new ValidatorException
                      (_getNotInRangeMessage(context, component, value, min, max));
        }
        else
        {
           throw new ValidatorException
                      (_getMaximumMessage(context, component, value, max));
        }
      }

      if (min != null && (converted.before(min)))
      {
        if (max != null)
        {
          throw new ValidatorException
                      (_getNotInRangeMessage(context, component, value, min, max));
        }
        else
        {
          FacesMessage msg = _getMinimumMessage(context, component, value, min);
          throw new ValidatorException(msg);
        }
      }
    }
  }
View Full Code Here

        }
        catch (EvaluationException ee)
        {
          if (ee.getCause() instanceof ValidatorException)
          {
            ValidatorException ve =
              (ValidatorException) ee.getCause();

            // If the validator throws an exception, we're
            // invalid, and we need to add a message
            setValid(false);
            FacesMessage message = ve.getFacesMessage();
            if (message != null)
            {
              message.setSeverity(FacesMessage.SEVERITY_ERROR);
              message = _wrapMessage(message);
              context.addMessage(getClientId(context), message);
View Full Code Here

       
        if (doubleValue > max)
        {
          if (min == Double.MIN_VALUE)//the default...
          {
             throw new ValidatorException
                        (_getNotInRangeMessage(context, component, value, min, max));
          }
          else
          {
             throw new ValidatorException
                        (_getMaximumMessage(context, component, value, max));
          }
        }

        if (doubleValue < min)
        {
          if (max == Double.MAX_VALUE)//the default...
          {
            throw new ValidatorException
                        (_getNotInRangeMessage(context, component, value, min, max));
          }
          else
          {
            FacesMessage msg = _getMinimumMessage(context, component, value, min);
            throw new ValidatorException(msg);
          }
        }
      }
      else
      {
View Full Code Here

      Date convertedDate = calendar.getTime();
     
      String weekday = _dayMap.get(calendar.get(Calendar.DAY_OF_WEEK));
      if (_getInvalidDaysOfWeek().contains(weekday))
      {
        throw new ValidatorException(
            _getWrongWeekDayMessage(context, component, value, weekday));
      }
     
      String month = _monthMap.get(calendar.get(Calendar.MONTH));
      if ( _getInvalidMonths().contains(month))
      {
        throw new ValidatorException(
            _getWrongMonthMessage(context, component, value, month));
      }
     
      DateListProvider dlp = getInvalidDays();
      List<Date> dates = null;
      if (dlp != null)
      {
        dates = dlp.getDateList(context, calendar, calendar.getTime(), calendar.getTime());
      }
     
      if(dates!=null)
      {
        for (Date date : dates)
        {
          //range is only one submitted day...
          if(!date.before(convertedDate) && !date.after(convertedDate))
          {
            throw new ValidatorException(
                _getWrongDayMessage(context, component, value, date));
          }
        }
      }
    }
View Full Code Here

       
        if (intValue > max)
        {
          if (min == Integer.MIN_VALUE)//the default...
          {
             throw new ValidatorException
                        (_getNotInRangeMessage(context, component, value, IntegerUtils.getString(min), IntegerUtils.getString(max)));
          }
          else
          {
             throw new ValidatorException
                        (_getMaximumMessage(context, component, value, IntegerUtils.getString(max)));
          }
        }

        if (intValue < min)
        {
          if (max == Integer.MAX_VALUE)//the default...
          {
            throw new ValidatorException
                        (_getNotInRangeMessage(context, component, value, IntegerUtils.getString(min), IntegerUtils.getString(max)));
          }
          else
          {
            FacesMessage msg = _getMinimumMessage(context, component, value, IntegerUtils.getString(min));
            throw new ValidatorException(msg);
          }
        }
      }
      else
      {
View Full Code Here

TOP

Related Classes of javax.faces.validator.ValidatorException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.