Esempio n. 1
0
 @Override
 public void takeValuesFromRequest(WORequest request, WOContext context) {
   super.takeValuesFromRequest(request, context);
   NSTimestamp date = null;
   try {
     if (dateString != null) {
       date = (NSTimestamp) dateFormatter().parseObject(dateString);
     }
     if (object() != null) {
       object().validateTakeValueForKeyPath(date, key());
     }
   } catch (java.text.ParseException npse) {
     log.debug("java.text.ParseException:" + npse);
     ERXValidationException v =
         ERXValidationFactory.defaultFactory()
             .createException(object(), key(), dateString, "InvalidDateFormatException");
     parent().validationFailedWithException(v, date, key());
   } catch (NSValidation.ValidationException v) {
     log.debug("NSValidation.ValidationException:" + v);
     parent().validationFailedWithException(v, date, key());
   } catch (Exception e) {
     log.debug("Exception:" + e);
     parent().validationFailedWithException(e, date, key());
   }
 }
Esempio n. 2
0
  /**
   * <span class="en"> Validates an enterprise object's email attribute (accessed via key).
   *
   * @param object the object to be validated
   * @param key the attribute's name
   * @param email the email value
   * @return the email if the validation didn't failed </span>
   *     <p><span class="ja"> エンタプライス・オブジェクトのメール・アトリビュートを検証します。(キーよりのアクセス)
   * @param object - 検証するオブジェクト
   * @param key - アトリビュート名
   * @param email - メール値
   * @return 検証が失敗しない場合のメールアドレス </span>
   */
  public String validateEmail(EOEnterpriseObject object, String key, String email) {
    if (email != null) {
      if (!isValidEmail(email))
        throw ERXValidationFactory.defaultFactory()
            .createException(object, key, email, "malformedEmail");
    }

    return email;
  }