Package org.exoplatform.webui.exception

Examples of org.exoplatform.webui.exception.MessageException


         if (Character.isLetter(c) || Character.isDigit(c) || c == '_' || c == '-' || c == '.' || c == '*')
         {
            continue;
         }
         Object[] args = {label};
         throw new MessageException(new ApplicationMessage("NameValidator.msg.Invalid-char", args));
      }
   }
View Full Code Here


     
      String s = (String)uiInput.getValue();
      int atIndex = s.indexOf('@');
      if (atIndex == -1)
      {
         throw new MessageException(new ApplicationMessage("EmailAddressValidator.msg.Invalid-input", args,
            ApplicationMessage.WARNING));
      }
     
      String localPart = s.substring(0, atIndex);
      String domainName = s.substring(atIndex + 1);

      if (!validateLocalPart(localPart.toCharArray()) || !validateDomainName(domainName.toCharArray()))
      {
         throw new MessageException(new ApplicationMessage("EmailAddressValidator.msg.Invalid-input", args,
            ApplicationMessage.WARNING));
      }
   }
View Full Code Here

      }
      String s = (String)uiInput.getValue();
      if (Character.isDigit(s.charAt(0)) || s.charAt(0) == '-')
      {
         Object[] args = {label, uiInput.getBindingField()};
         throw new MessageException(new ApplicationMessage("FirstAndSpecialCharacterNameValidator.msg", args,
            ApplicationMessage.WARNING));
      }
      for (int i = 0; i < s.length(); i++)
      {
         char c = s.charAt(i);
         if (Character.isLetter(c) || Character.isDigit(c) || c == '_' || c == '-')
         {
            continue;
         }
         Object[] args = {label};
         throw new MessageException(new ApplicationMessage("IdentifierValidator.msg.Invalid-char", args,
            ApplicationMessage.WARNING));
      }
   }
View Full Code Here

     
      char[] buff = ((String)uiInput.getValue()).toCharArray();
      if(buff.length < min || buff.length > max)
      {
         Object[] args = {label, min.toString(), max.toString()};
         throw new MessageException(new ApplicationMessage("StringLengthValidator.msg.length-invalid", args,
            ApplicationMessage.WARNING));
      }
     
      if(!isAlphabet(buff[0]))
      {
         Object[] args = {label};
         throw new MessageException(new ApplicationMessage("FirstCharacterNameValidator.msg", args,
            ApplicationMessage.WARNING));
      }
     
      if(!isAlphabetOrDigit(buff[buff.length - 1]))
      {
         Object[] args = {label, buff[buff.length - 1]};
         throw new MessageException(new ApplicationMessage("LastCharacterUsernameValidator.msg", args,
            ApplicationMessage.WARNING));
      }
     
      for(int i = 1; i < buff.length -1; i++)
      {
         char c = buff[i];

         if (isAlphabetOrDigit(c))
         {
            continue;
         }

         if (isSymbol(c))
         {
            char next = buff[i + 1];
            if (isSymbol(next))
            {
               Object[] args = {label, buff[i], buff[i + 1]};
               throw new MessageException(new ApplicationMessage("ConsecutiveSymbolValidator.msg", args,
                  ApplicationMessage.WARNING));
            }
            else if (!isAlphabetOrDigit(next))
            {
               Object[] args = {label};
               throw new MessageException(new ApplicationMessage("UsernameValidator.msg.Invalid-char", args, ApplicationMessage.WARNING));
            }
         }
         else
         {
            Object[] args = {label};
            throw new MessageException(new ApplicationMessage("UsernameValidator.msg.Invalid-char", args, ApplicationMessage.WARNING));
         }
      }
   }
View Full Code Here

         sdf.setLenient(false);
         sdf.parse(s);
      }
      catch (Exception e)
      {
         throw new MessageException(new ApplicationMessage("DateTimeValidator.msg.Invalid-input", args, ApplicationMessage.WARNING));
      }
   }
View Full Code Here

      catch (Exception e)
      {
         label = uiInput.getName();
      }
      Object[] args = {label};
      throw new MessageException(new ApplicationMessage("EmptyFieldValidator.msg.empty-input", args));
   }
View Full Code Here

         char c = s.charAt(i);
         if (Character.isLetter(c) || Character.isSpaceChar(c))
         {
            continue;
         }
         throw new MessageException(new ApplicationMessage("NaturalLanguageValidator.msg.Invalid-char", args));
      }
   }
View Full Code Here

         if (Character.isLetter(c) || Character.isDigit(c) || c == '_' || c == '-' || Character.isSpaceChar(c))
         {
            continue;
         }
         Object[] args = {label};
         throw new MessageException(new ApplicationMessage("SpecialCharacterValidator.msg.Invalid-char", args,
            ApplicationMessage.WARNING));
      }
   }
View Full Code Here

      catch (Exception e)
      {
         label = uiInput.getName();
      }
      Object[] args = {label};
      throw new MessageException(new ApplicationMessage(key_, args, ApplicationMessage.WARNING));
   }
View Full Code Here

     
      String s = (String)uiInput.getValue();
     
      if(s.charAt(0) == '0' && s.length() > 1)
      {
         throw new MessageException(new ApplicationMessage("NumberFormatValidator.msg.Invalid-number", args));
      }
      else if(s.charAt(0) == '-' && s.length() > 1 && s.charAt(1) == '0')
      {
         throw new MessageException(new ApplicationMessage("NumberFormatValidator.msg.Invalid-number", args));
      }
     
      int value;
      try
      {
         value = Integer.parseInt(s);
      }
      catch(NumberFormatException e)
      {
         throw new MessageException(new ApplicationMessage("NumberFormatValidator.msg.Invalid-number", args));
      }
     
      if(value >= 0)
      {
         return;
      }
      throw new MessageException(new ApplicationMessage("PositiveNumberFormatValidator.msg.Invalid-number", args));
   }
View Full Code Here

TOP

Related Classes of org.exoplatform.webui.exception.MessageException

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.