Examples of ValidationException


Examples of org.zanata.exception.ValidationException

            try {
                ValidationMessages valMessages =
                        Gwti18nReader.create(ValidationMessages.class);
                validationFactory = new ValidationFactory(valMessages);
            } catch (IOException e) {
                throw new ValidationException(
                        "Unable to load validation messages");
            }
        }
        return validationFactory;
    }
View Full Code Here

Examples of propel.core.validation.ValidationException

    if (!getLocalPartOnlyAllowed())
    {
      // then it must contain the at sign
      int atCount = StringUtils.count(email, CONSTANT.AT_SIGN_CHAR);
      if (atCount < 1)
        throw new ValidationException(String.format(EMAIL_DOES_NOT_CONTAIN_AT_SIGN, getName()));
      else if (atCount > 1)
        throw new ValidationException(String.format(EMAIL_CONTAINS_MANY_AT_SIGNS, getName()));
    }
  }
View Full Code Here

Examples of pt.opensoft.field.ValidationException

            throw e;
        } catch (SAXException e) {
            throw e;
        } catch (Exception e) {
            String message = e.getLocalizedMessage() == null ? e.getClass().getName() : e.getLocalizedMessage();
            throw new ValidationException("XML", message, element.getLine(), element.getColumn());
        }
    }
View Full Code Here

Examples of pt.webdetails.cdf.dd.model.core.validation.ValidationException

  {
    assert builder != null;

    if(StringUtils.isEmpty(builder._source))
    {
      throw new ValidationException(new RequiredAttributeError("Source"));
    }

    if(builder._type == null)
    {
      throw new ValidationException(new RequiredAttributeError("Type"));
    }

    this.name = StringUtils.defaultIfEmpty(builder._name, builder._source);
    this.app = StringUtils.defaultIfEmpty(builder._app, "");
    this.source = builder._source;
View Full Code Here

Examples of ptolemy.actor.gt.ValidationException

    }

    public void validate() throws ValidationException {
        if (isAttributeNameEnabled()) {
            if (_attributeName.get().equals("")) {
                throw new ValidationException(
                        "Attribute name must not be empty.");
            }

            try {
                _attributeName.getPattern();
            } catch (PatternSyntaxException e) {
                throw new ValidationException("Regular expression \""
                        + _attributeName + "\" cannot be compiled.", e);
            }
        }

        if (isAttributeTypeEnabled()) {
            if (_attributeType.get().equals("")) {
                throw new ValidationException("Port type must not be empty.");
            }

            try {
                _attributeType.getToken().getType();
            } catch (IllegalActionException e) {
                throw new ValidationException("Type expression \""
                        + _attributeType + "\" cannot be parsed.", e);
            }
        }

        if (isAttributeValueEnabled()) {
            try {
                _attributeValue.getToken();
            } catch (IllegalActionException e) {
                throw new ValidationException("Value expression \""
                        + _attributeValue + "\" cannot be parsed.", e);
            }
        }
    }
View Full Code Here

Examples of sg.edu.nus.comp.simTL.engine.exceptions.ValidationException

  public TIfStatement(EObject tElement, IContext context, ITemplate template) throws SimTLException {
    super(tElement);
    condition = new TMethodStatement(methodStatementEO, context, template);
    if(!(condition.getReferenceFromParent()
        instanceof Reference2Attribute)){
      throw new ValidationException(condition.toString() + "is no reference to an attribute in the parameter model!");
    } else if(!(condition.getReferenceFromParent().getReferencedValue()
        instanceof Boolean)){
      throw new ValidationException(condition.toString() + "doesn't reference a boolean value in parameter model!");
    }
  }
View Full Code Here

Examples of wwutil.model.ValidationException

        // Register a custom AnnotationFieldHandler that implements the functionality of MyDataConverter.
        jsoda.registerData1Handler(MyDataConverter.class, new AnnotationFieldHandler() {
            // checkModel() is called when a model class is registered to see if the annotated fields confirm to this annotation's requirement.
            public void checkModel(Annotation fieldAnnotation, Field field, Map<String, Field> allFieldMap) throws ValidationException {
                if (field.getType() != String.class)
                    throw new ValidationException("The field must be String type.  Field: " + field.getName());
            }

            // handle() is called when a model object is stored
            public void handle(Annotation fieldAnnotation, Object object, Field field, Map<String, Field> allFieldMap) throws Exception {
                String      value = (String)field.get(object);
                if (value != null) {
                    String  trimValue = (value.length() > 4 ? value.substring(0, 4) : value);
                    field.set(object, trimValue);
                }
            }
        });

        // Register a custom AnnotationFieldHandler that implements the functionality of MyValidator
        jsoda.registerValidationHandler(MyValidator.class, new AnnotationFieldHandler() {
            // checkModel() is called when a model class is registered to see if the annotated fields confirm to this annotation's requirement.
            public void checkModel(Annotation fieldAnnotation, Field field, Map<String, Field> allFieldMap) throws ValidationException {
                if (field.getType() != String.class)
                    throw new ValidationException("The field must be String type.  Field: " + field.getName());
            }

            // handle() is called when a model object is stored
            public void handle(Annotation fieldAnnotation, Object object, Field field, Map<String, Field> allFieldMap) throws Exception {
                String      value = (String)field.get(object);
                if (value != null) {
                    if (value.startsWith("foobar"))
                        throw new ValidationException("Field cannot start with foobar.  Field: " + field.getName());
                }
            }
        });

        // Register a custom AnnotationFieldHandler that implements the functionality of MyDataJoiner
        // Note it's registered as stage 2 handler, to run after the stage 1 handlers.
        jsoda.registerData2Handler(MyDataJoiner.class, new AnnotationFieldHandler() {
            // checkModel() is called when a model class is registered to see if the annotated fields confirm to this annotation's requirement.
            public void checkModel(Annotation fieldAnnotation, Field field, Map<String, Field> allFieldMap) throws ValidationException {
                if (field.getType() != String.class)
                    throw new ValidationException("The field must be String type.  Field: " + field.getName());
            }

            // handle() is called when a model object is stored
            public void handle(Annotation fieldAnnotation, Object object, Field field, Map<String, Field> allFieldMap) throws Exception {
                // Join the values from field1, field2, and field3, and convert it to upper case.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.