コード例 #1
0
 private void checkForError(Document document, Field field) {
   Property property = document.get(field);
   String value = property.getValue();
   if ("error".equalsIgnoreCase(value)) {
     property = property.copyWithMessage("Oops - <error> was provided");
     document.set(field, property);
   }
 }
コード例 #2
0
ファイル: FormCommand.java プロジェクト: tomcz/pico-webapp
  public Redirect execute(Request request) {
    Identity documentId = request.getIdentity("documentId");

    Document document = repository.get(documentId);

    setProperties(request, document);
    validator.validate(document);
    repository.set(document);

    if (document.isValid()) {
      return new Redirect(SuccessPresenter.class, "documentId", documentId);
    }
    return new Redirect(FormPresenter.class, "documentId", documentId);
  }