Package org.openbravo.base.validation

Examples of org.openbravo.base.validation.ValidationException.addMessage()


   * @throws ValidationException
   */
  public void checkIsWritable() {
    if (isInactive()) {
      final ValidationException ve = new ValidationException();
      ve.addMessage(this, "Property " + this + " is inactive and can therefore not be changed.");
      throw ve;
    }
  }

  /**
 
View Full Code Here


      return;
    }

    if (!isPrimitive() && !(value instanceof BaseOBObjectDef)) {
      final ValidationException ve = new ValidationException();
      ve.addMessage(this, "Property " + this + " only allows reference instances of type "
          + BaseOBObjectDef.class.getName() + " but the value is an instanceof "
          + value.getClass().getName());
      throw ve;
    } else if (isPrimitive()) {
      // this specific conversion is allowed
View Full Code Here

      final boolean intToLong = getPrimitiveObjectType().isAssignableFrom(Long.class)
          && value.getClass().isAssignableFrom(Integer.class);

      if (!intToLong && !getPrimitiveObjectType().isInstance(value)) {
        final ValidationException ve = new ValidationException();
        ve.addMessage(this, "Property " + this + " only allows instances of "
            + getPrimitiveObjectType().getName() + " but the value is an instanceof "
            + value.getClass().getName());
        throw ve;
      }
View Full Code Here

      final PropertyValidator v = getValidator();
      if (v != null) {
        final String msg = v.validate(value);
        if (msg != null) {
          final ValidationException ve = new ValidationException();
          ve.addMessage(this, msg);
          throw ve;
        }
      }
    }
  }
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.