Ejemplo 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());
   }
 }
Ejemplo n.º 2
0
 @Override
 public void appendToResponse(WOResponse r, WOContext c) {
   NSTimestamp date = (NSTimestamp) objectPropertyValue();
   if (date != null) {
     try {
       dateString = dateFormatter().format(date);
     } catch (IllegalArgumentException nsfe) {
       // nothing?
     }
   } else {
     dateString = null;
   }
   super.appendToResponse(r, c);
 }