Пример #1
0
 @Execute
 public HtmlResponse delete(final EditForm form) {
   verifyCrudMode(form.crudMode, CrudMode.DETAILS);
   validate(form, messages -> {}, () -> asDetailsHtml());
   verifyToken(() -> asDetailsHtml());
   final String id = form.id;
   failureUrlService
       .getFailureUrl(id)
       .alwaysPresent(
           entity -> {
             failureUrlService.delete(entity);
             saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
           });
   return redirect(getClass());
 }
Пример #2
0
 protected FailureUrl getFailureUrl(final FailureUrlEditForm form) {
   final FailureUrl failureUrl = failureUrlService.getFailureUrl(createKeyMap(form));
   if (failureUrl == null) {
     // TODO
   }
   return failureUrl;
 }
Пример #3
0
 @Execute
 public HtmlResponse delete(final FailureUrlEditForm form) {
   // TODO verifyCrudMode(form, CrudMode.DELETE);
   failureUrlService.delete(getFailureUrl(form));
   saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
   return redirect(getClass());
 }
Пример #4
0
 // -----------------------------------------------------
 //                                               Details
 //                                               -------
 @Execute
 public HtmlResponse details(final int crudMode, final String id) {
   verifyCrudMode(crudMode, CrudMode.DETAILS);
   return asHtml(path_AdminFailureurl_AdminFailureurlDetailsJsp)
       .useForm(
           EditForm.class,
           op -> {
             op.setup(
                 form -> {
                   failureUrlService
                       .getFailureUrl(id)
                       .ifPresent(
                           entity -> {
                             copyBeanToBean(
                                 entity,
                                 form,
                                 copyOp -> {
                                   copyOp.excludeNull();
                                 });
                             form.crudMode = crudMode;
                           })
                       .orElse(
                           () -> {
                             throwValidationError(
                                 messages ->
                                     messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id),
                                 () -> asListHtml());
                           });
                 });
           });
 }
Пример #5
0
  protected void searchPaging(final RenderData data, final FailureUrlSearchForm form) {
    data.register(
        "failureUrlItems", failureUrlService.getFailureUrlList(failureUrlPager)); // page navi

    // restore from pager
    copyBeanToBean(
        failureUrlPager, form.searchParams, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
  }
Пример #6
0
 @Execute
 public HtmlResponse deleteall() {
   verifyToken(() -> asListHtml());
   failureUrlService.deleteAll(failureUrlPager);
   failureUrlPager.clear();
   saveInfo(messages -> messages.addSuccessFailureUrlDeleteAll(GLOBAL));
   return redirect(getClass());
 }
Пример #7
0
  protected void searchPaging(final RenderData data, final SearchForm form) {
    RenderDataUtil.register(
        data, "failureUrlItems", failureUrlService.getFailureUrlList(failureUrlPager)); // page navi

    // restore from pager
    copyBeanToBean(
        failureUrlPager,
        form,
        op -> op.include("url", "errorCountMin", "errorCountMax", "errorName"));
  }
Пример #8
0
 private HtmlResponse asListHtml() {
   return asHtml(path_AdminFailureurl_AdminFailureurlJsp)
       .renderWith(
           data -> {
             RenderDataUtil.register(
                 data,
                 "failureUrlItems",
                 failureUrlService.getFailureUrlList(failureUrlPager)); // page navi
           })
       .useForm(
           SearchForm.class,
           setup -> {
             setup.setup(
                 form -> {
                   copyBeanToBean(
                       failureUrlPager,
                       form,
                       op -> op.include("url", "errorCountMin", "errorCountMax", "errorName"));
                 });
           });
 }
Пример #9
0
 @Execute
 public HtmlResponse deleteall(final FailureUrlEditForm form) {
   failureUrlService.deleteAll(failureUrlPager);
   saveInfo(messages -> messages.addSuccessFailureUrlDeleteAll(GLOBAL));
   return redirect(getClass());
 }