@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()); }
protected FailureUrl getFailureUrl(final FailureUrlEditForm form) { final FailureUrl failureUrl = failureUrlService.getFailureUrl(createKeyMap(form)); if (failureUrl == null) { // TODO } return failureUrl; }
@Execute public HtmlResponse delete(final FailureUrlEditForm form) { // TODO verifyCrudMode(form, CrudMode.DELETE); failureUrlService.delete(getFailureUrl(form)); saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL)); return redirect(getClass()); }
// ----------------------------------------------------- // 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()); }); }); }); }
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)); }
@Execute public HtmlResponse deleteall() { verifyToken(() -> asListHtml()); failureUrlService.deleteAll(failureUrlPager); failureUrlPager.clear(); saveInfo(messages -> messages.addSuccessFailureUrlDeleteAll(GLOBAL)); return redirect(getClass()); }
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")); }
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")); }); }); }
@Execute public HtmlResponse deleteall(final FailureUrlEditForm form) { failureUrlService.deleteAll(failureUrlPager); saveInfo(messages -> messages.addSuccessFailureUrlDeleteAll(GLOBAL)); return redirect(getClass()); }