diff --git a/src/main/java/org/codelibs/fess/app/web/admin/badword/AdminBadwordAction.java b/src/main/java/org/codelibs/fess/app/web/admin/badword/AdminBadwordAction.java index 93122611f..2d0732ec5 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/badword/AdminBadwordAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/badword/AdminBadwordAction.java @@ -46,10 +46,8 @@ import org.dbflute.optional.OptionalThing; import org.lastaflute.web.Execute; import org.lastaflute.web.callback.ActionRuntime; import org.lastaflute.web.response.HtmlResponse; -import org.lastaflute.web.response.next.HtmlNext; import org.lastaflute.web.response.render.RenderData; import org.lastaflute.web.util.LaResponseUtil; -import org.lastaflute.web.validation.VaErrorHook; /** * @author Keiichi Watanabe @@ -83,10 +81,8 @@ public class AdminBadwordAction extends FessAdminAction { // Search Execute // ============== @Execute - public HtmlResponse index(final SearchForm form) { - return asHtml(path_AdminBadword_AdminBadwordJsp).renderWith(data -> { - searchPaging(data, form); - }); + public HtmlResponse index() { + return asListHtml(); } @Execute @@ -131,9 +127,9 @@ public class AdminBadwordAction extends FessAdminAction { // Entry Page // ---------- @Execute - //(token = TxToken.SAVE) public HtmlResponse createnew() { - return asHtml(path_AdminBadword_AdminBadwordEditJsp).useForm(CreateForm.class, op -> { + saveToken(); + return asEditHtml().useForm(CreateForm.class, op -> { op.setup(form -> { form.initialize(); form.crudMode = CrudMode.CREATE; @@ -142,27 +138,23 @@ public class AdminBadwordAction extends FessAdminAction { } @Execute - //(token = TxToken.SAVE) public HtmlResponse edit(final EditForm form) { - validate(form, messages -> {}, toEditHtml()); - HtmlNext next; - switch (form.crudMode) { - case CrudMode.EDIT: // back - form.crudMode = CrudMode.DETAILS; - next = path_AdminBadword_AdminBadwordDetailsJsp; - break; - default: - form.crudMode = CrudMode.EDIT; - next = path_AdminBadword_AdminBadwordEditJsp; - break; - } + validate(form, messages -> {}, () -> asListHtml()); final String id = form.id; suggestBadWordService.getSuggestBadWord(id).ifPresent(entity -> { copyBeanToBean(entity, form, op -> {}); }).orElse(() -> { - throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), toEditHtml()); + throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml()); }); - return asHtml(next); + saveToken(); + if (form.crudMode.intValue() == CrudMode.EDIT) { + // back + form.crudMode = CrudMode.DETAILS; + return asDetailsHtml(); + } else { + form.crudMode = CrudMode.EDIT; + return asEditHtml(); + } } // ----------------------------------------------------- @@ -171,7 +163,8 @@ public class AdminBadwordAction extends FessAdminAction { @Execute public HtmlResponse details(final int crudMode, final String id) { verifyCrudMode(crudMode, CrudMode.DETAILS); - return asHtml(path_AdminBadword_AdminBadwordDetailsJsp).useForm(EditForm.class, op -> { + saveToken(); + return asDetailsHtml().useForm(EditForm.class, op -> { op.setup(form -> { suggestBadWordService.getSuggestBadWord(id).ifPresent(entity -> { copyBeanToBean(entity, form, copyOp -> { @@ -179,7 +172,7 @@ public class AdminBadwordAction extends FessAdminAction { }); form.crudMode = crudMode; }).orElse(() -> { - throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), toEditHtml()); + throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml()); }); }); }); @@ -189,14 +182,14 @@ public class AdminBadwordAction extends FessAdminAction { // Download // ------- @Execute - //(token = TxToken.SAVE) public HtmlResponse downloadpage(final SearchForm form) { - return asHtml(path_AdminBadword_AdminBadwordDownloadJsp); + saveToken(); + return asDownloadHtml(); } @Execute - //(token = TxToken.VALIDATE) public HtmlResponse download(final SearchForm form) { + verifyTokenKeep(() -> downloadpage(form)); final HttpServletResponse response = LaResponseUtil.getResponse(); response.setContentType("application/octet-stream"); response.setHeader("Content-Disposition", "attachment; filename=\"" + "badword.csv" + "\""); @@ -207,16 +200,16 @@ public class AdminBadwordAction extends FessAdminAction { } catch (final Exception e) { e.printStackTrace(); } - return asHtml(path_AdminBadword_AdminBadwordDownloadJsp); + return redirect(getClass()); } // ----------------------------------------------------- // Upload // ------- @Execute - //(token = TxToken.SAVE) public HtmlResponse uploadpage(final UploadForm form) { - return asHtml(path_AdminBadword_AdminBadwordUploadJsp); + saveToken(); + return asUploadHtml(); } // ----------------------------------------------------- @@ -225,13 +218,14 @@ public class AdminBadwordAction extends FessAdminAction { @Execute public HtmlResponse create(final CreateForm form) { verifyCrudMode(form.crudMode, CrudMode.CREATE); - validate(form, messages -> {}, toEditHtml()); - createSuggestBadWord(form).ifPresent(entity -> { + validate(form, messages -> {}, () -> asEditHtml()); + verifyToken(() -> asEditHtml()); + getSuggestBadWord(form).ifPresent(entity -> { suggestBadWordService.store(entity); suggestHelper.addBadWord(entity.getSuggestWord()); saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL)); }).orElse(() -> { - throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL), toEditHtml()); + throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL), () -> asEditHtml()); }); return redirect(getClass()); } @@ -239,13 +233,14 @@ public class AdminBadwordAction extends FessAdminAction { @Execute public HtmlResponse update(final EditForm form) { verifyCrudMode(form.crudMode, CrudMode.EDIT); - validate(form, messages -> {}, toEditHtml()); - createSuggestBadWord(form).ifPresent(entity -> { + validate(form, messages -> {}, () -> asEditHtml()); + verifyToken(() -> asEditHtml()); + getSuggestBadWord(form).ifPresent(entity -> { suggestBadWordService.store(entity); suggestHelper.storeAllBadWords(); saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL)); }).orElse(() -> { - throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), toEditHtml()); + throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), () -> asEditHtml()); }); return redirect(getClass()); } @@ -253,21 +248,22 @@ public class AdminBadwordAction extends FessAdminAction { @Execute public HtmlResponse delete(final EditForm form) { verifyCrudMode(form.crudMode, CrudMode.DETAILS); - validate(form, messages -> {}, toEditHtml()); + validate(form, messages -> {}, () -> asDetailsHtml()); + verifyToken(() -> asDetailsHtml()); final String id = form.id; suggestBadWordService.getSuggestBadWord(id).ifPresent(entity -> { suggestBadWordService.delete(entity); suggestHelper.deleteBadWord(entity.getSuggestWord()); saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL)); }).orElse(() -> { - throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), toEditHtml()); + throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml()); }); return redirect(getClass()); } @Execute - //(token = TxToken.VALIDATE) public HtmlResponse upload(final UploadForm form) { + verifyToken(() -> uploadpage(form)); BufferedInputStream is = null; File tempFile = null; FileOutputStream fos = null; @@ -319,6 +315,7 @@ public class AdminBadwordAction extends FessAdminAction { } } saveInfo(messages -> messages.addSuccessUploadSuggestBadWord(GLOBAL)); + saveToken(); return redirect(getClass()); } @@ -347,7 +344,7 @@ public class AdminBadwordAction extends FessAdminAction { return OptionalEntity.empty(); } - protected OptionalEntity createSuggestBadWord(final CreateForm form) { + protected OptionalEntity getSuggestBadWord(final CreateForm form) { final String username = systemHelper.getUsername(); final long currentTime = systemHelper.getCurrentTimeAsLong(); return getEntity(form, username, currentTime).map(entity -> { @@ -365,13 +362,37 @@ public class AdminBadwordAction extends FessAdminAction { if (crudMode != expectedMode) { throwValidationError(messages -> { messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode)); - }, toEditHtml()); + }, () -> asListHtml()); } } - protected VaErrorHook toEditHtml() { - return () -> { - return asHtml(path_AdminBadword_AdminBadwordEditJsp); - }; + // =================================================================================== + // JSP + // ========= + private HtmlResponse asListHtml() { + return asHtml(path_AdminBadword_AdminBadwordJsp).renderWith(data -> { + data.register("suggestBadWordItems", suggestBadWordService.getSuggestBadWordList(suggestBadWordPager)); + }).useForm(SearchForm.class, setup -> { + setup.setup(form -> { + copyBeanToBean(suggestBadWordPager, form, op -> op.include("id")); + }); + }); } + + private HtmlResponse asEditHtml() { + return asHtml(path_AdminBadword_AdminBadwordEditJsp); + } + + private HtmlResponse asDetailsHtml() { + return asHtml(path_AdminBadword_AdminBadwordDetailsJsp); + } + + private HtmlResponse asUploadHtml() { + return asHtml(path_AdminBadword_AdminBadwordUploadJsp); + } + + private HtmlResponse asDownloadHtml() { + return asHtml(path_AdminBadword_AdminBadwordDownloadJsp); + } + } diff --git a/src/main/java/org/codelibs/fess/app/web/admin/boostdoc/AdminBoostdocAction.java b/src/main/java/org/codelibs/fess/app/web/admin/boostdoc/AdminBoostdocAction.java index cb9678947..881d054ff 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/boostdoc/AdminBoostdocAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/boostdoc/AdminBoostdocAction.java @@ -162,9 +162,9 @@ public class AdminBoostdocAction extends FessAdminAction { @Execute public HtmlResponse create(final CreateForm form) { verifyCrudMode(form.crudMode, CrudMode.CREATE); - verifyToken(() -> asEditHtml()); validate(form, messages -> {}, () -> asEditHtml()); - createBoostDocumentRule(form).ifPresent(entity -> { + verifyToken(() -> asEditHtml()); + getBoostDocumentRule(form).ifPresent(entity -> { boostDocumentRuleService.store(entity); saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL)); }).orElse(() -> { @@ -176,9 +176,9 @@ public class AdminBoostdocAction extends FessAdminAction { @Execute public HtmlResponse update(final EditForm form) { verifyCrudMode(form.crudMode, CrudMode.EDIT); - verifyToken(() -> asEditHtml()); validate(form, messages -> {}, () -> asEditHtml()); - createBoostDocumentRule(form).ifPresent(entity -> { + verifyToken(() -> asEditHtml()); + getBoostDocumentRule(form).ifPresent(entity -> { boostDocumentRuleService.store(entity); saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL)); }).orElse(() -> { @@ -190,8 +190,8 @@ public class AdminBoostdocAction extends FessAdminAction { @Execute public HtmlResponse delete(final EditForm form) { verifyCrudMode(form.crudMode, CrudMode.DETAILS); - verifyToken(() -> asDetailsHtml()); validate(form, messages -> {}, () -> asDetailsHtml()); + verifyToken(() -> asDetailsHtml()); final String id = form.id; boostDocumentRuleService.getBoostDocumentRule(id).ifPresent(entity -> { boostDocumentRuleService.delete(entity); @@ -228,7 +228,7 @@ public class AdminBoostdocAction extends FessAdminAction { return OptionalEntity.empty(); } - protected OptionalEntity createBoostDocumentRule(final CreateForm form) { + protected OptionalEntity getBoostDocumentRule(final CreateForm form) { final String username = systemHelper.getUsername(); final long currentTime = systemHelper.getCurrentTimeAsLong(); return getEntity(form, username, currentTime).map(entity -> { diff --git a/src/main/java/org/codelibs/fess/app/web/admin/crawlinginfo/AdminCrawlinginfoAction.java b/src/main/java/org/codelibs/fess/app/web/admin/crawlinginfo/AdminCrawlinginfoAction.java index a4702d7f1..0a22ed5c9 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/crawlinginfo/AdminCrawlinginfoAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/crawlinginfo/AdminCrawlinginfoAction.java @@ -28,7 +28,6 @@ import org.lastaflute.web.Execute; import org.lastaflute.web.callback.ActionRuntime; import org.lastaflute.web.response.HtmlResponse; import org.lastaflute.web.response.render.RenderData; -import org.lastaflute.web.validation.VaErrorHook; /** * @author shinsuke @@ -62,17 +61,15 @@ public class AdminCrawlinginfoAction extends FessAdminAction { // ============== @Execute public HtmlResponse deleteall(final EditForm form) { - validate(form, messages -> {}, toIndexHtml()); + validate(form, messages -> {}, () -> asListHtml()); crawlingSessionService.deleteOldSessions(jobHelper.getRunningSessionIdSet()); saveInfo(messages -> messages.addSuccessCrawlingSessionDeleteAll(GLOBAL)); return redirect(getClass()); } @Execute - public HtmlResponse index(final SearchForm form) { - return asHtml(path_AdminCrawlinginfo_AdminCrawlinginfoJsp).renderWith(data -> { - searchPaging(data, form); - }); + public HtmlResponse index() { + return asListHtml(); } @Execute @@ -123,6 +120,7 @@ public class AdminCrawlinginfoAction extends FessAdminAction { @Execute public HtmlResponse details(final int crudMode, final String id) { verifyCrudMode(crudMode, CrudMode.DETAILS); + saveToken(); return asHtml(path_AdminCrawlinginfo_AdminCrawlinginfoDetailsJsp).useForm(EditForm.class, op -> { op.setup(form -> { crawlingSessionService.getCrawlingSession(id).ifPresent(entity -> { @@ -131,7 +129,7 @@ public class AdminCrawlinginfoAction extends FessAdminAction { }); form.crudMode = crudMode; }).orElse(() -> { - throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), toIndexHtml()); + throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml()); }); }); }).renderWith(data -> { @@ -145,7 +143,8 @@ public class AdminCrawlinginfoAction extends FessAdminAction { @Execute public HtmlResponse delete(final EditForm form) { verifyCrudMode(form.crudMode, CrudMode.DETAILS); - validate(form, messages -> {}, toIndexHtml()); + validate(form, messages -> {}, () -> asDetailsHtml()); + verifyToken(() -> asDetailsHtml()); final String id = form.id; crawlingSessionService.getCrawlingSession(id).alwaysPresent(entity -> { crawlingSessionService.delete(entity); @@ -165,13 +164,25 @@ public class AdminCrawlinginfoAction extends FessAdminAction { if (crudMode != expectedMode) { throwValidationError(messages -> { messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode)); - }, toIndexHtml()); + }, () -> asListHtml()); } } - protected VaErrorHook toIndexHtml() { - return () -> { - return asHtml(path_AdminCrawlinginfo_AdminCrawlinginfoJsp); - }; + // =================================================================================== + // JSP + // ========= + + private HtmlResponse asListHtml() { + return asHtml(path_AdminCrawlinginfo_AdminCrawlinginfoJsp).renderWith(data -> { + data.register("crawlingSessionItems", crawlingSessionService.getCrawlingSessionList(crawlingSessionPager)); // page navi + }).useForm(SearchForm.class, setup -> { + setup.setup(form -> { + copyBeanToBean(crawlingSessionPager, form, op -> op.include("id")); + }); + }); + } + + private HtmlResponse asDetailsHtml() { + return asHtml(path_AdminCrawlinginfo_AdminCrawlinginfoDetailsJsp); } } \ No newline at end of file diff --git a/src/main/java/org/codelibs/fess/app/web/admin/dataconfig/AdminDataconfigAction.java b/src/main/java/org/codelibs/fess/app/web/admin/dataconfig/AdminDataconfigAction.java index ca21f9e2b..537d86faf 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/dataconfig/AdminDataconfigAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/dataconfig/AdminDataconfigAction.java @@ -39,10 +39,8 @@ import org.dbflute.optional.OptionalThing; import org.lastaflute.web.Execute; import org.lastaflute.web.callback.ActionRuntime; import org.lastaflute.web.response.HtmlResponse; -import org.lastaflute.web.response.next.HtmlNext; import org.lastaflute.web.response.render.RenderData; import org.lastaflute.web.util.LaRequestUtil; -import org.lastaflute.web.validation.VaErrorHook; /** * @author codelibs @@ -79,10 +77,8 @@ public class AdminDataconfigAction extends FessAdminAction { // Search Execute // ============== @Execute - public HtmlResponse index(final SearchForm form) { - return asHtml(path_AdminDataconfig_AdminDataconfigJsp).renderWith(data -> { - searchPaging(data, form); - }); + public HtmlResponse index() { + return asListHtml(); } @Execute @@ -127,9 +123,9 @@ public class AdminDataconfigAction extends FessAdminAction { // Entry Page // ---------- @Execute - //(token = TxToken.SAVE) public HtmlResponse createnew() { - return asHtml(path_AdminDataconfig_AdminDataconfigEditJsp).useForm(CreateForm.class, op -> { + saveToken(); + return asEditHtml().useForm(CreateForm.class, op -> { op.setup(form -> { form.initialize(); form.crudMode = CrudMode.CREATE; @@ -143,36 +139,30 @@ public class AdminDataconfigAction extends FessAdminAction { @Execute //(token = TxToken.SAVE) public HtmlResponse edit(final EditForm form) { - validate(form, messages -> {}, toEditHtml()); - HtmlNext next; - switch (form.crudMode) { - case CrudMode.EDIT: // back - form.crudMode = CrudMode.DETAILS; - next = path_AdminDataconfig_AdminDataconfigDetailsJsp; - break; - default: - form.crudMode = CrudMode.EDIT; - next = path_AdminDataconfig_AdminDataconfigEditJsp; - break; - } - form.crudMode = CrudMode.EDIT; + validate(form, messages -> {}, () -> asListHtml()); final String id = form.id; dataConfigService.getDataConfig(id).ifPresent(entity -> { copyBeanToBean(entity, form, op -> {}); }).orElse(() -> { - throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), toEditHtml()); - }); - return asHtml(next).renderWith(data -> { - registerRolesAndLabels(data); - registerHandlerNames(data); + throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml()); }); + if (form.crudMode.intValue() == CrudMode.EDIT) { + // back + form.crudMode = CrudMode.DETAILS; + return asDetailsHtml(); + } else { + form.crudMode = CrudMode.EDIT; + return asEditHtml(); + } } @Execute public HtmlResponse createnewjob(final EditForm form) { - validate(form, messages -> {}, toEditHtml()); + validate(form, messages -> {}, () -> asDetailsHtml()); + verifyToken(() -> asDetailsHtml()); final ScheduledJob scheduledJob = new ScheduledJob(); scheduledJob.setCrawler(true); + saveToken(); return asHtml(path_AdminScheduler_AdminSchedulerEditJsp).useForm( org.codelibs.fess.app.web.admin.scheduler.CreateForm.class, op -> { @@ -198,7 +188,8 @@ public class AdminDataconfigAction extends FessAdminAction { @Execute public HtmlResponse details(final int crudMode, final String id) { verifyCrudMode(crudMode, CrudMode.DETAILS); - return asHtml(path_AdminDataconfig_AdminDataconfigDetailsJsp).useForm(EditForm.class, op -> { + saveToken(); + return asDetailsHtml().useForm(EditForm.class, op -> { op.setup(form -> { dataConfigService.getDataConfig(id).ifPresent(entity -> { copyBeanToBean(entity, form, copyOp -> { @@ -206,7 +197,7 @@ public class AdminDataconfigAction extends FessAdminAction { }); form.crudMode = crudMode; }).orElse(() -> { - throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), toEditHtml()); + throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml()); }); }); }).renderWith(data -> { @@ -221,12 +212,13 @@ public class AdminDataconfigAction extends FessAdminAction { @Execute public HtmlResponse create(final CreateForm form) { verifyCrudMode(form.crudMode, CrudMode.CREATE); - validate(form, messages -> {}, toEditHtml()); - createDataConfig(form).ifPresent(entity -> { + validate(form, messages -> {}, () -> asEditHtml()); + verifyToken(() -> asEditHtml()); + getDataConfig(form).ifPresent(entity -> { dataConfigService.store(entity); saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL)); }).orElse(() -> { - throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL), toEditHtml()); + throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL), () -> asEditHtml()); }); return redirect(getClass()); } @@ -234,12 +226,13 @@ public class AdminDataconfigAction extends FessAdminAction { @Execute public HtmlResponse update(final EditForm form) { verifyCrudMode(form.crudMode, CrudMode.EDIT); - validate(form, messages -> {}, toEditHtml()); - createDataConfig(form).ifPresent(entity -> { + validate(form, messages -> {}, () -> asEditHtml()); + verifyToken(() -> asEditHtml()); + getDataConfig(form).ifPresent(entity -> { dataConfigService.store(entity); saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL)); }).orElse(() -> { - throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), toEditHtml()); + throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), () -> asEditHtml()); }); return redirect(getClass()); } @@ -247,13 +240,14 @@ public class AdminDataconfigAction extends FessAdminAction { @Execute public HtmlResponse delete(final EditForm form) { verifyCrudMode(form.crudMode, CrudMode.DETAILS); - validate(form, messages -> {}, toEditHtml()); + validate(form, messages -> {}, () -> asDetailsHtml()); + verifyToken(() -> asDetailsHtml()); final String id = form.id; dataConfigService.getDataConfig(id).ifPresent(entity -> { dataConfigService.delete(entity); saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL)); }).orElse(() -> { - throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), toEditHtml()); + throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml()); }); return redirect(getClass()); } @@ -283,7 +277,7 @@ public class AdminDataconfigAction extends FessAdminAction { return OptionalEntity.empty(); } - protected OptionalEntity createDataConfig(final CreateForm form) { + protected OptionalEntity getDataConfig(final CreateForm form) { final String username = systemHelper.getUsername(); final long currentTime = systemHelper.getCurrentTimeAsLong(); return getEntity(form, username, currentTime).map(entity -> { @@ -318,16 +312,30 @@ public class AdminDataconfigAction extends FessAdminAction { if (crudMode != expectedMode) { throwValidationError(messages -> { messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode)); - }, toEditHtml()); + }, () -> asListHtml()); } } - protected VaErrorHook toEditHtml() { - return () -> { - return asHtml(path_AdminDataconfig_AdminDataconfigEditJsp).renderWith(data -> { - registerRolesAndLabels(data); - registerHandlerNames(data); + // =================================================================================== + // JSP + // ========= + + private HtmlResponse asListHtml() { + return asHtml(path_AdminDataconfig_AdminDataconfigJsp).renderWith(data -> { + data.register("dataConfigItems", dataConfigService.getDataConfigList(dataConfigPager)); + }).useForm(SearchForm.class, setup -> { + setup.setup(form -> { + copyBeanToBean(dataConfigPager, form, op -> op.include("id")); }); - }; + }); } + + private HtmlResponse asEditHtml() { + return asHtml(path_AdminDataconfig_AdminDataconfigEditJsp); + } + + private HtmlResponse asDetailsHtml() { + return asHtml(path_AdminDataconfig_AdminDataconfigDetailsJsp); + } + } diff --git a/src/main/java/org/codelibs/fess/app/web/admin/design/AdminDesignAction.java b/src/main/java/org/codelibs/fess/app/web/admin/design/AdminDesignAction.java index 943074496..cb14cb992 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/design/AdminDesignAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/design/AdminDesignAction.java @@ -115,7 +115,6 @@ public class AdminDesignAction extends FessAdminAction implements Serializable { @Execute public HtmlResponse upload(final DesignForm form) { - validate(form, messages -> {}, toMainHtml()); final String uploadedFileName = form.designFile.getFileName(); String fileName = form.designFileName; if (StringUtil.isBlank(fileName)) { @@ -166,6 +165,7 @@ public class AdminDesignAction extends FessAdminAction implements Serializable { logger.error("Failed to write an image file: {}", fileName, e); throwValidationError(messages -> messages.addErrorsFailedToWriteDesignImageFile(GLOBAL), toMainHtml()); } + validate(form, messages -> {}, toMainHtml()); return redirect(getClass()); } @@ -188,7 +188,7 @@ public class AdminDesignAction extends FessAdminAction implements Serializable { if (file == null) { throwValidationError(messages -> messages.addErrorsTargetFileDoesNotExist(GLOBAL, form.fileName), toMainHtml()); } - + validate(form, messages -> {}, toMainHtml()); return asStream(file.getName()).stream(out -> { try (FileInputStream fis = new FileInputStream(file)) { out.write(fis); diff --git a/src/main/java/org/codelibs/fess/app/web/admin/dict/AdminDictAction.java b/src/main/java/org/codelibs/fess/app/web/admin/dict/AdminDictAction.java index f15176387..74a5046f0 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/dict/AdminDictAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/dict/AdminDictAction.java @@ -52,7 +52,7 @@ public class AdminDictAction extends FessAdminAction { // Search Execute // ============== @Execute - public HtmlResponse index(final ListForm form) { + public HtmlResponse index() { return asHtml(path_AdminDict_AdminDictJsp).renderWith(data -> { final DictionaryFile[] dictFiles = dictionaryManager.getDictionaryFiles(); data.register("dictFiles", dictFiles); diff --git a/src/main/java/org/codelibs/fess/app/web/admin/dict/kuromoji/AdminDictKuromojiAction.java b/src/main/java/org/codelibs/fess/app/web/admin/dict/kuromoji/AdminDictKuromojiAction.java index 18475abb1..a79205d21 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/dict/kuromoji/AdminDictKuromojiAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/dict/kuromoji/AdminDictKuromojiAction.java @@ -38,9 +38,7 @@ import org.lastaflute.web.Execute; import org.lastaflute.web.callback.ActionRuntime; import org.lastaflute.web.response.ActionResponse; import org.lastaflute.web.response.HtmlResponse; -import org.lastaflute.web.response.next.HtmlNext; import org.lastaflute.web.response.render.RenderData; -import org.lastaflute.web.validation.VaErrorHook; /** * @author shinsuke @@ -74,7 +72,7 @@ public class AdminDictKuromojiAction extends FessAdminAction { // ============== @Execute public HtmlResponse index(final SearchForm form) { - validate(form, messages -> {}, toIndexHtml()); + validate(form, messages -> {}, () -> asDictIndexHtml()); return asHtml(path_AdminDictKuromoji_AdminDictKuromojiJsp).renderWith(data -> { searchPaging(data, form); }); @@ -82,7 +80,7 @@ public class AdminDictKuromojiAction extends FessAdminAction { @Execute public HtmlResponse list(final OptionalThing pageNumber, final SearchForm form) { - validate(form, messages -> {}, toIndexHtml()); + validate(form, messages -> {}, () -> asDictIndexHtml()); pageNumber.ifPresent(num -> { kuromojiPager.setCurrentPageNumber(pageNumber.get()); }).orElse(() -> { @@ -95,7 +93,7 @@ public class AdminDictKuromojiAction extends FessAdminAction { @Execute public HtmlResponse search(final SearchForm form) { - validate(form, messages -> {}, toIndexHtml()); + validate(form, messages -> {}, () -> asDictIndexHtml()); copyBeanToBean(form, kuromojiPager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE)); return asHtml(path_AdminDictKuromoji_AdminDictKuromojiJsp).renderWith(data -> { searchPaging(data, form); @@ -104,7 +102,7 @@ public class AdminDictKuromojiAction extends FessAdminAction { @Execute public HtmlResponse reset(final SearchForm form) { - validate(form, messages -> {}, toIndexHtml()); + validate(form, messages -> {}, () -> asDictIndexHtml()); kuromojiPager.clear(); return asHtml(path_AdminDictKuromoji_AdminDictKuromojiJsp).renderWith(data -> { searchPaging(data, form); @@ -128,8 +126,8 @@ public class AdminDictKuromojiAction extends FessAdminAction { // Entry Page // ---------- @Execute - //(token = TxToken.SAVE) public HtmlResponse createnew(final String dictId) { + saveToken(); return asHtml(path_AdminDictKuromoji_AdminDictKuromojiEditJsp).useForm(CreateForm.class, op -> { op.setup(form -> { form.initialize(); @@ -140,26 +138,22 @@ public class AdminDictKuromojiAction extends FessAdminAction { } @Execute - //(token = TxToken.SAVE) public HtmlResponse edit(final EditForm form) { - validate(form, messages -> {}, toEditHtml()); - HtmlNext next; - switch (form.crudMode) { - case CrudMode.EDIT: // back - form.crudMode = CrudMode.DETAILS; - next = path_AdminDictKuromoji_AdminDictKuromojiDetailsJsp; - break; - default: - form.crudMode = CrudMode.EDIT; - next = path_AdminDictKuromoji_AdminDictKuromojiEditJsp; - break; - } + validate(form, messages -> {}, () -> asListHtml(form.dictId)); kuromojiService.getKuromojiItem(form.dictId, form.id).ifPresent(entity -> { copyBeanToBean(entity, form, op -> {}); }).orElse(() -> { - throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.getDisplayId()), toEditHtml()); + throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.getDisplayId()), () -> asListHtml(form.dictId)); }); - return asHtml(next); + saveToken(); + if (form.crudMode.intValue() == CrudMode.EDIT) { + // back + form.crudMode = CrudMode.DETAILS; + return asDetailsHtml(); + } else { + form.crudMode = CrudMode.EDIT; + return asEditHtml(); + } } // ----------------------------------------------------- @@ -167,8 +161,9 @@ public class AdminDictKuromojiAction extends FessAdminAction { // ------- @Execute public HtmlResponse details(final String dictId, final int crudMode, final long id) { - verifyCrudMode(crudMode, CrudMode.DETAILS); - return asHtml(path_AdminDictKuromoji_AdminDictKuromojiDetailsJsp).useForm(EditForm.class, op -> { + verifyCrudMode(crudMode, CrudMode.DETAILS, dictId); + saveToken(); + return asDetailsHtml().useForm(EditForm.class, op -> { op.setup(form -> { kuromojiService.getKuromojiItem(dictId, id).ifPresent(entity -> { copyBeanToBean(entity, form, copyOp -> { @@ -176,7 +171,7 @@ public class AdminDictKuromojiAction extends FessAdminAction { }); form.crudMode = crudMode; }).orElse(() -> { - throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, dictId + ":" + id), toEditHtml()); + throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, dictId + ":" + id), () -> asListHtml(dictId)); }); form.dictId = dictId; }); @@ -187,8 +182,8 @@ public class AdminDictKuromojiAction extends FessAdminAction { // Download // ------- @Execute - //(token = TxToken.VALIDATE) public HtmlResponse downloadpage(final String dictId) { + saveToken(); return asHtml(path_AdminDictKuromoji_AdminDictKuromojiDownloadJsp).useForm(DownloadForm.class, op -> { op.setup(form -> { form.dictId = dictId; @@ -197,15 +192,15 @@ public class AdminDictKuromojiAction extends FessAdminAction { kuromojiService.getKuromojiFile(dictId).ifPresent(file -> { data.register("path", file.getPath()); }).orElse(() -> { - throwValidationError(messages -> messages.addErrorsFailedToDownloadKuromojiFile(GLOBAL), toIndexHtml()); + throwValidationError(messages -> messages.addErrorsFailedToDownloadKuromojiFile(GLOBAL), () -> asDictIndexHtml()); }); }); } @Execute - //(token = TxToken.VALIDATE) public ActionResponse download(final DownloadForm form) { validate(form, messages -> {}, () -> downloadpage(form.dictId)); + verifyTokenKeep(() -> downloadpage(form.dictId)); return kuromojiService.getKuromojiFile(form.dictId).map(file -> { return asStream(new File(file.getPath()).getName()).stream(out -> { try (InputStream inputStream = file.getInputStream()) { @@ -222,8 +217,8 @@ public class AdminDictKuromojiAction extends FessAdminAction { // Upload // ------- @Execute - //(token = TxToken.VALIDATE) public HtmlResponse uploadpage(final String dictId) { + saveToken(); return asHtml(path_AdminDictKuromoji_AdminDictKuromojiUploadJsp).useForm(UploadForm.class, op -> { op.setup(form -> { form.dictId = dictId; @@ -232,15 +227,15 @@ public class AdminDictKuromojiAction extends FessAdminAction { kuromojiService.getKuromojiFile(dictId).ifPresent(file -> { data.register("path", file.getPath()); }).orElse(() -> { - throwValidationError(messages -> messages.addErrorsFailedToDownloadKuromojiFile(GLOBAL), toIndexHtml()); + throwValidationError(messages -> messages.addErrorsFailedToDownloadKuromojiFile(GLOBAL), () -> asDictIndexHtml()); }); }); } @Execute - //(token = TxToken.VALIDATE) public HtmlResponse upload(final UploadForm form) { validate(form, messages -> {}, () -> uploadpage(form.dictId)); + verifyToken(() -> uploadpage(form.dictId)); return kuromojiService.getKuromojiFile(form.dictId).map(file -> { try (InputStream inputStream = form.kuromojiFile.getInputStream()) { file.update(inputStream); @@ -263,39 +258,42 @@ public class AdminDictKuromojiAction extends FessAdminAction { // ------------- @Execute public HtmlResponse create(final CreateForm form) { - verifyCrudMode(form.crudMode, CrudMode.CREATE); - validate(form, messages -> {}, toEditHtml()); + verifyCrudMode(form.crudMode, CrudMode.CREATE, form.dictId); + validate(form, messages -> {}, () -> asEditHtml()); + verifyToken(() -> asEditHtml()); createKuromojiItem(form).ifPresent(entity -> { kuromojiService.store(form.dictId, entity); saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL)); }).orElse(() -> { - throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL), toEditHtml()); + throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL), () -> asEditHtml()); }); return redirectWith(getClass(), moreUrl("list/1").params("dictId", form.dictId)); } @Execute public HtmlResponse update(final EditForm form) { - verifyCrudMode(form.crudMode, CrudMode.EDIT); - validate(form, messages -> {}, toEditHtml()); + verifyCrudMode(form.crudMode, CrudMode.EDIT, form.dictId); + validate(form, messages -> {}, () -> asEditHtml()); + verifyToken(() -> asEditHtml()); createKuromojiItem(form).ifPresent(entity -> { kuromojiService.store(form.dictId, entity); saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL)); }).orElse(() -> { - throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.getDisplayId()), toEditHtml()); + throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.getDisplayId()), () -> asEditHtml()); }); return redirectWith(getClass(), moreUrl("list/1").params("dictId", form.dictId)); } @Execute public HtmlResponse delete(final EditForm form) { - verifyCrudMode(form.crudMode, CrudMode.DETAILS); - validate(form, messages -> {}, toEditHtml()); + verifyCrudMode(form.crudMode, CrudMode.DETAILS, form.dictId); + verifyToken(() -> asDetailsHtml()); + validate(form, messages -> {}, () -> asDetailsHtml()); kuromojiService.getKuromojiItem(form.dictId, form.id).ifPresent(entity -> { kuromojiService.delete(form.dictId, entity); saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL)); }).orElse(() -> { - throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.getDisplayId()), toEditHtml()); + throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.getDisplayId()), () -> asDetailsHtml()); }); return redirectWith(getClass(), moreUrl("list/1").params("dictId", form.dictId)); } @@ -336,23 +334,38 @@ public class AdminDictKuromojiAction extends FessAdminAction { // =================================================================================== // Small Helper // ============ - protected void verifyCrudMode(final int crudMode, final int expectedMode) { + protected void verifyCrudMode(final int crudMode, final int expectedMode, final String dictId) { if (crudMode != expectedMode) { throwValidationError(messages -> { messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode)); - }, toEditHtml()); + }, () -> asListHtml(dictId)); } } - protected VaErrorHook toIndexHtml() { - return () -> { - return redirect(AdminDictAction.class); - }; + // =================================================================================== + // JSP + // ========= + + protected HtmlResponse asDictIndexHtml() { + return redirect(AdminDictAction.class); + } + + private HtmlResponse asListHtml(final String dictId) { + return asHtml(path_AdminDictKuromoji_AdminDictKuromojiJsp).renderWith(data -> { + data.register("kuromojiItemItems", kuromojiService.getKuromojiList(dictId, kuromojiPager)); + }).useForm(SearchForm.class, setup -> { + setup.setup(form -> { + copyBeanToBean(kuromojiPager, form, op -> op.include("id")); + }); + }); } - protected VaErrorHook toEditHtml() { - return () -> { - return asHtml(path_AdminDictKuromoji_AdminDictKuromojiEditJsp); - }; + private HtmlResponse asEditHtml() { + return asHtml(path_AdminDictKuromoji_AdminDictKuromojiEditJsp); } + + private HtmlResponse asDetailsHtml() { + return asHtml(path_AdminDictKuromoji_AdminDictKuromojiDetailsJsp); + } + } diff --git a/src/main/java/org/codelibs/fess/app/web/admin/duplicatehost/AdminDuplicatehostAction.java b/src/main/java/org/codelibs/fess/app/web/admin/duplicatehost/AdminDuplicatehostAction.java index 0db5ea57d..4762d2233 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/duplicatehost/AdminDuplicatehostAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/duplicatehost/AdminDuplicatehostAction.java @@ -171,7 +171,7 @@ public class AdminDuplicatehostAction extends FessAdminAction { public HtmlResponse create(final CreateForm form) { verifyCrudMode(form.crudMode, CrudMode.CREATE); validate(form, messages -> {}, toEditHtml()); - createDuplicateHost(form).ifPresent(entity -> { + getDuplicateHost(form).ifPresent(entity -> { duplicateHostService.store(entity); saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL)); }).orElse(() -> { @@ -184,7 +184,7 @@ public class AdminDuplicatehostAction extends FessAdminAction { public HtmlResponse update(final EditForm form) { verifyCrudMode(form.crudMode, CrudMode.EDIT); validate(form, messages -> {}, toEditHtml()); - createDuplicateHost(form).ifPresent(entity -> { + getDuplicateHost(form).ifPresent(entity -> { duplicateHostService.store(entity); saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL)); }).orElse(() -> { @@ -232,7 +232,7 @@ public class AdminDuplicatehostAction extends FessAdminAction { return OptionalEntity.empty(); } - protected OptionalEntity createDuplicateHost(final CreateForm form) { + protected OptionalEntity getDuplicateHost(final CreateForm form) { final String username = systemHelper.getUsername(); final long currentTime = systemHelper.getCurrentTimeAsLong(); return getEntity(form, username, currentTime).map(entity -> { diff --git a/src/main/java/org/codelibs/fess/app/web/admin/elevateword/AdminElevatewordAction.java b/src/main/java/org/codelibs/fess/app/web/admin/elevateword/AdminElevatewordAction.java index d26b6d3d1..3e0d761ca 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/elevateword/AdminElevatewordAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/elevateword/AdminElevatewordAction.java @@ -223,7 +223,7 @@ public class AdminElevatewordAction extends FessAdminAction { public HtmlResponse create(final CreateForm form) { verifyCrudMode(form.crudMode, CrudMode.CREATE); validate(form, messages -> {}, toEditHtml()); - createSuggestElevateWord(form).ifPresent(entity -> { + getSuggestElevateWord(form).ifPresent(entity -> { suggestElevateWordService.store(entity); saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL)); }).orElse(() -> { @@ -236,7 +236,7 @@ public class AdminElevatewordAction extends FessAdminAction { public HtmlResponse update(final EditForm form) { verifyCrudMode(form.crudMode, CrudMode.EDIT); validate(form, messages -> {}, toEditHtml()); - createSuggestElevateWord(form).ifPresent(entity -> { + getSuggestElevateWord(form).ifPresent(entity -> { suggestElevateWordService.store(entity); saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL)); }).orElse(() -> { @@ -340,7 +340,7 @@ public class AdminElevatewordAction extends FessAdminAction { return OptionalEntity.empty(); } - protected OptionalEntity createSuggestElevateWord(final CreateForm form) { + protected OptionalEntity getSuggestElevateWord(final CreateForm form) { final String username = systemHelper.getUsername(); final long currentTime = systemHelper.getCurrentTimeAsLong(); return getEntity(form, username, currentTime).map(entity -> { diff --git a/src/main/java/org/codelibs/fess/app/web/admin/fileauth/AdminFileauthAction.java b/src/main/java/org/codelibs/fess/app/web/admin/fileauth/AdminFileauthAction.java index 181e650bb..0b24b8339 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/fileauth/AdminFileauthAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/fileauth/AdminFileauthAction.java @@ -192,7 +192,7 @@ public class AdminFileauthAction extends FessAdminAction { public HtmlResponse create(final CreateForm form) { verifyCrudMode(form.crudMode, CrudMode.CREATE); validate(form, messages -> {}, toEditHtml()); - createFileAuthentication(form).ifPresent(entity -> { + getFileAuthentication(form).ifPresent(entity -> { fileAuthenticationService.store(entity); saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL)); }).orElse(() -> { @@ -205,7 +205,7 @@ public class AdminFileauthAction extends FessAdminAction { public HtmlResponse update(final EditForm form) { verifyCrudMode(form.crudMode, CrudMode.EDIT); validate(form, messages -> {}, toEditHtml()); - createFileAuthentication(form).ifPresent(entity -> { + getFileAuthentication(form).ifPresent(entity -> { fileAuthenticationService.store(entity); saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL)); }).orElse(() -> { @@ -253,7 +253,7 @@ public class AdminFileauthAction extends FessAdminAction { return OptionalEntity.empty(); } - protected OptionalEntity createFileAuthentication(final CreateForm form) { + protected OptionalEntity getFileAuthentication(final CreateForm form) { final String username = systemHelper.getUsername(); final long currentTime = systemHelper.getCurrentTimeAsLong(); return getEntity(form, username, currentTime).map(entity -> { diff --git a/src/main/java/org/codelibs/fess/app/web/admin/fileconfig/AdminFileconfigAction.java b/src/main/java/org/codelibs/fess/app/web/admin/fileconfig/AdminFileconfigAction.java index b205354ac..a9d11adfa 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/fileconfig/AdminFileconfigAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/fileconfig/AdminFileconfigAction.java @@ -210,7 +210,7 @@ public class AdminFileconfigAction extends FessAdminAction { public HtmlResponse create(final CreateForm form) { verifyCrudMode(form.crudMode, CrudMode.CREATE); validate(form, messages -> {}, toEditHtml()); - createFileConfig(form).ifPresent(entity -> { + getFileConfig(form).ifPresent(entity -> { fileConfigService.store(entity); saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL)); }).orElse(() -> { @@ -223,7 +223,7 @@ public class AdminFileconfigAction extends FessAdminAction { public HtmlResponse update(final EditForm form) { verifyCrudMode(form.crudMode, CrudMode.EDIT); validate(form, messages -> {}, toEditHtml()); - createFileConfig(form).ifPresent(entity -> { + getFileConfig(form).ifPresent(entity -> { fileConfigService.store(entity); saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL)); }).orElse(() -> { @@ -271,7 +271,7 @@ public class AdminFileconfigAction extends FessAdminAction { return OptionalEntity.empty(); } - protected OptionalEntity createFileConfig(final CreateForm form) { + protected OptionalEntity getFileConfig(final CreateForm form) { final String username = systemHelper.getUsername(); final long currentTime = systemHelper.getCurrentTimeAsLong(); return getEntity(form, username, currentTime).map(entity -> { diff --git a/src/main/java/org/codelibs/fess/app/web/admin/group/AdminGroupAction.java b/src/main/java/org/codelibs/fess/app/web/admin/group/AdminGroupAction.java index 47a6491b1..4f3c53991 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/group/AdminGroupAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/group/AdminGroupAction.java @@ -173,7 +173,7 @@ public class AdminGroupAction extends FessAdminAction { public HtmlResponse create(final CreateForm form) { verifyCrudMode(form.crudMode, CrudMode.CREATE); validate(form, messages -> {}, toEditHtml()); - createGroup(form).ifPresent(entity -> { + getGroup(form).ifPresent(entity -> { groupService.store(entity); saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL)); }).orElse(() -> { @@ -186,7 +186,7 @@ public class AdminGroupAction extends FessAdminAction { public HtmlResponse update(final EditForm form) { verifyCrudMode(form.crudMode, CrudMode.EDIT); validate(form, messages -> {}, toEditHtml()); - createGroup(form).ifPresent(entity -> { + getGroup(form).ifPresent(entity -> { groupService.store(entity); saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL)); }).orElse(() -> { @@ -233,7 +233,7 @@ public class AdminGroupAction extends FessAdminAction { return OptionalEntity.empty(); } - protected OptionalEntity createGroup(final CreateForm form) { + protected OptionalEntity getGroup(final CreateForm form) { return getEntity(form).map(entity -> { copyBeanToBean(form, entity, op -> op.exclude(Constants.COMMON_CONVERSION_RULE)); return entity; diff --git a/src/main/java/org/codelibs/fess/app/web/admin/keymatch/AdminKeymatchAction.java b/src/main/java/org/codelibs/fess/app/web/admin/keymatch/AdminKeymatchAction.java index 5c99d2b75..115d5b1d2 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/keymatch/AdminKeymatchAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/keymatch/AdminKeymatchAction.java @@ -172,7 +172,7 @@ public class AdminKeymatchAction extends FessAdminAction { public HtmlResponse create(final CreateForm form) { verifyCrudMode(form.crudMode, CrudMode.CREATE); validate(form, messages -> {}, toEditHtml()); - createKeyMatch(form).ifPresent(entity -> { + getKeyMatch(form).ifPresent(entity -> { keyMatchService.store(entity); saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL)); ComponentUtil.getKeyMatchHelper().update(); @@ -186,7 +186,7 @@ public class AdminKeymatchAction extends FessAdminAction { public HtmlResponse update(final EditForm form) { verifyCrudMode(form.crudMode, CrudMode.EDIT); validate(form, messages -> {}, toEditHtml()); - createKeyMatch(form).ifPresent(entity -> { + getKeyMatch(form).ifPresent(entity -> { keyMatchService.store(entity); saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL)); ComponentUtil.getKeyMatchHelper().update(); @@ -237,7 +237,7 @@ public class AdminKeymatchAction extends FessAdminAction { return OptionalEntity.empty(); } - protected OptionalEntity createKeyMatch(final CreateForm form) { + protected OptionalEntity getKeyMatch(final CreateForm form) { final String username = systemHelper.getUsername(); final long currentTime = systemHelper.getCurrentTimeAsLong(); return getEntity(form, username, currentTime).map(entity -> { diff --git a/src/main/java/org/codelibs/fess/app/web/admin/labeltype/AdminLabeltypeAction.java b/src/main/java/org/codelibs/fess/app/web/admin/labeltype/AdminLabeltypeAction.java index 36707bdf2..76d8ed4fe 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/labeltype/AdminLabeltypeAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/labeltype/AdminLabeltypeAction.java @@ -181,7 +181,7 @@ public class AdminLabeltypeAction extends FessAdminAction { public HtmlResponse create(final CreateForm form) { verifyCrudMode(form.crudMode, CrudMode.CREATE); validate(form, messages -> {}, toEditHtml()); - createLabelType(form).ifPresent(entity -> { + getLabelType(form).ifPresent(entity -> { labelTypeService.store(entity); saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL)); }).orElse(() -> { @@ -194,7 +194,7 @@ public class AdminLabeltypeAction extends FessAdminAction { public HtmlResponse update(final EditForm form) { verifyCrudMode(form.crudMode, CrudMode.EDIT); validate(form, messages -> {}, toEditHtml()); - createLabelType(form).ifPresent(entity -> { + getLabelType(form).ifPresent(entity -> { labelTypeService.store(entity); saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL)); }).orElse(() -> { @@ -243,7 +243,7 @@ public class AdminLabeltypeAction extends FessAdminAction { return OptionalEntity.empty(); } - protected OptionalEntity createLabelType(final CreateForm form) { + protected OptionalEntity getLabelType(final CreateForm form) { final String username = systemHelper.getUsername(); final long currentTime = systemHelper.getCurrentTimeAsLong(); return getEntity(form, username, currentTime).map(entity -> { diff --git a/src/main/java/org/codelibs/fess/app/web/admin/pathmap/AdminPathmapAction.java b/src/main/java/org/codelibs/fess/app/web/admin/pathmap/AdminPathmapAction.java index 4545e88da..7cddbf2df 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/pathmap/AdminPathmapAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/pathmap/AdminPathmapAction.java @@ -172,7 +172,7 @@ public class AdminPathmapAction extends FessAdminAction { public HtmlResponse create(final CreateForm form) { verifyCrudMode(form.crudMode, CrudMode.CREATE); validate(form, messages -> {}, toEditHtml()); - createPathMapping(form).ifPresent(entity -> { + getPathMapping(form).ifPresent(entity -> { pathMappingService.store(entity); saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL)); }).orElse(() -> { @@ -185,7 +185,7 @@ public class AdminPathmapAction extends FessAdminAction { public HtmlResponse update(final EditForm form) { verifyCrudMode(form.crudMode, CrudMode.EDIT); validate(form, messages -> {}, toEditHtml()); - createPathMapping(form).ifPresent(entity -> { + getPathMapping(form).ifPresent(entity -> { pathMappingService.store(entity); saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL)); }).orElse(() -> { @@ -233,7 +233,7 @@ public class AdminPathmapAction extends FessAdminAction { return OptionalEntity.empty(); } - protected OptionalEntity createPathMapping(final CreateForm form) { + protected OptionalEntity getPathMapping(final CreateForm form) { final String username = systemHelper.getUsername(); final long currentTime = systemHelper.getCurrentTimeAsLong(); return getEntity(form, username, currentTime).map(entity -> { diff --git a/src/main/java/org/codelibs/fess/app/web/admin/reqheader/AdminReqheaderAction.java b/src/main/java/org/codelibs/fess/app/web/admin/reqheader/AdminReqheaderAction.java index 14dc41f64..850cd5182 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/reqheader/AdminReqheaderAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/reqheader/AdminReqheaderAction.java @@ -194,7 +194,7 @@ public class AdminReqheaderAction extends FessAdminAction { public HtmlResponse create(final CreateForm form) { verifyCrudMode(form.crudMode, CrudMode.CREATE); validate(form, messages -> {}, toEditHtml()); - createRequestHeader(form).ifPresent(entity -> { + getRequestHeader(form).ifPresent(entity -> { requestHeaderService.store(entity); saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL)); }).orElse(() -> { @@ -207,7 +207,7 @@ public class AdminReqheaderAction extends FessAdminAction { public HtmlResponse update(final EditForm form) { verifyCrudMode(form.crudMode, CrudMode.EDIT); validate(form, messages -> {}, toEditHtml()); - createRequestHeader(form).ifPresent(entity -> { + getRequestHeader(form).ifPresent(entity -> { requestHeaderService.store(entity); saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL)); }).orElse(() -> { @@ -255,7 +255,7 @@ public class AdminReqheaderAction extends FessAdminAction { return OptionalEntity.empty(); } - protected OptionalEntity createRequestHeader(final CreateForm form) { + protected OptionalEntity getRequestHeader(final CreateForm form) { final String username = systemHelper.getUsername(); final long currentTime = systemHelper.getCurrentTimeAsLong(); return getEntity(form, username, currentTime).map(entity -> { diff --git a/src/main/java/org/codelibs/fess/app/web/admin/role/AdminRoleAction.java b/src/main/java/org/codelibs/fess/app/web/admin/role/AdminRoleAction.java index 77f90f80e..54a78bdef 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/role/AdminRoleAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/role/AdminRoleAction.java @@ -173,7 +173,7 @@ public class AdminRoleAction extends FessAdminAction { public HtmlResponse create(final CreateForm form) { verifyCrudMode(form.crudMode, CrudMode.CREATE); validate(form, messages -> {}, toEditHtml()); - createRole(form).ifPresent(entity -> { + getRole(form).ifPresent(entity -> { roleService.store(entity); saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL)); }).orElse(() -> { @@ -186,7 +186,7 @@ public class AdminRoleAction extends FessAdminAction { public HtmlResponse update(final EditForm form) { verifyCrudMode(form.crudMode, CrudMode.EDIT); validate(form, messages -> {}, toEditHtml()); - createRole(form).ifPresent(entity -> { + getRole(form).ifPresent(entity -> { roleService.store(entity); saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL)); }).orElse(() -> { @@ -233,7 +233,7 @@ public class AdminRoleAction extends FessAdminAction { return OptionalEntity.empty(); } - protected OptionalEntity createRole(final CreateForm form) { + protected OptionalEntity getRole(final CreateForm form) { return getEntity(form).map(entity -> { copyBeanToBean(form, entity, op -> op.exclude(Constants.COMMON_CONVERSION_RULE)); return entity; diff --git a/src/main/java/org/codelibs/fess/app/web/admin/roletype/AdminRoletypeAction.java b/src/main/java/org/codelibs/fess/app/web/admin/roletype/AdminRoletypeAction.java index 59ff0c026..c6811b10c 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/roletype/AdminRoletypeAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/roletype/AdminRoletypeAction.java @@ -171,7 +171,7 @@ public class AdminRoletypeAction extends FessAdminAction { public HtmlResponse create(final CreateForm form) { verifyCrudMode(form.crudMode, CrudMode.CREATE); validate(form, messages -> {}, toEditHtml()); - createRoleType(form).ifPresent(entity -> { + getRoleType(form).ifPresent(entity -> { roleTypeService.store(entity); saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL)); }).orElse(() -> { @@ -184,7 +184,7 @@ public class AdminRoletypeAction extends FessAdminAction { public HtmlResponse update(final EditForm form) { verifyCrudMode(form.crudMode, CrudMode.EDIT); validate(form, messages -> {}, toEditHtml()); - createRoleType(form).ifPresent(entity -> { + getRoleType(form).ifPresent(entity -> { roleTypeService.store(entity); saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL)); }).orElse(() -> { @@ -232,7 +232,7 @@ public class AdminRoletypeAction extends FessAdminAction { return OptionalEntity.empty(); } - protected OptionalEntity createRoleType(final CreateForm form) { + protected OptionalEntity getRoleType(final CreateForm form) { final String username = systemHelper.getUsername(); final long currentTime = systemHelper.getCurrentTimeAsLong(); return getEntity(form, username, currentTime).map(entity -> { diff --git a/src/main/java/org/codelibs/fess/app/web/admin/scheduler/AdminSchedulerAction.java b/src/main/java/org/codelibs/fess/app/web/admin/scheduler/AdminSchedulerAction.java index 5f401cec9..8e5832f30 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/scheduler/AdminSchedulerAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/scheduler/AdminSchedulerAction.java @@ -177,7 +177,7 @@ public class AdminSchedulerAction extends FessAdminAction { public HtmlResponse create(final CreateForm form) { verifyCrudMode(form.crudMode, CrudMode.CREATE); validate(form, messages -> {}, toEditHtml()); - createScheduledJob(form).ifPresent(entity -> { + getScheduledJob(form).ifPresent(entity -> { scheduledJobService.store(entity); saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL)); }).orElse(() -> { @@ -190,7 +190,7 @@ public class AdminSchedulerAction extends FessAdminAction { public HtmlResponse update(final EditForm form) { verifyCrudMode(form.crudMode, CrudMode.EDIT); validate(form, messages -> {}, toEditHtml()); - createScheduledJob(form).ifPresent(entity -> { + getScheduledJob(form).ifPresent(entity -> { scheduledJobService.store(entity); saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL)); }).orElse(() -> { @@ -290,7 +290,7 @@ public class AdminSchedulerAction extends FessAdminAction { return OptionalEntity.empty(); } - protected OptionalEntity createScheduledJob(final CreateForm form) { + protected OptionalEntity getScheduledJob(final CreateForm form) { final String username = systemHelper.getUsername(); final long currentTime = systemHelper.getCurrentTimeAsLong(); return getEntity(form, username, currentTime).map(entity -> { diff --git a/src/main/java/org/codelibs/fess/app/web/admin/user/AdminUserAction.java b/src/main/java/org/codelibs/fess/app/web/admin/user/AdminUserAction.java index 54f34a660..5375eaa22 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/user/AdminUserAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/user/AdminUserAction.java @@ -205,7 +205,7 @@ public class AdminUserAction extends FessAdminAction { validate(form, messages -> {}, toEditHtml()); verifyPassword(form); storePassword(form); - createUser(form).ifPresent(entity -> { + getUser(form).ifPresent(entity -> { userService.store(entity); saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL)); }).orElse(() -> { @@ -222,7 +222,7 @@ public class AdminUserAction extends FessAdminAction { if (StringUtil.isNotBlank(form.password)) { storePassword(form); } - createUser(form).ifPresent(entity -> { + getUser(form).ifPresent(entity -> { userService.store(entity); saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL)); }).orElse(() -> { @@ -269,7 +269,7 @@ public class AdminUserAction extends FessAdminAction { return OptionalEntity.empty(); } - protected OptionalEntity createUser(final CreateForm form) { + protected OptionalEntity getUser(final CreateForm form) { return getEntity(form).map(entity -> { copyBeanToBean(form, entity, op -> op.exclude(ArrayUtils.addAll(Constants.COMMON_CONVERSION_RULE, "password"))); sessionManager.getAttribute(TEMPORARY_PASSWORD, String.class).ifPresent(password -> { diff --git a/src/main/java/org/codelibs/fess/app/web/admin/webauth/AdminWebauthAction.java b/src/main/java/org/codelibs/fess/app/web/admin/webauth/AdminWebauthAction.java index 2fcdb297f..e6a7ef6f1 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/webauth/AdminWebauthAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/webauth/AdminWebauthAction.java @@ -193,7 +193,7 @@ public class AdminWebauthAction extends FessAdminAction { public HtmlResponse create(final CreateForm form) { verifyCrudMode(form.crudMode, CrudMode.CREATE); validate(form, messages -> {}, toEditHtml()); - createWebAuthentication(form).ifPresent(entity -> { + getWebAuthentication(form).ifPresent(entity -> { webAuthenticationService.store(entity); saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL)); }).orElse(() -> { @@ -206,7 +206,7 @@ public class AdminWebauthAction extends FessAdminAction { public HtmlResponse update(final EditForm form) { verifyCrudMode(form.crudMode, CrudMode.EDIT); validate(form, messages -> {}, toEditHtml()); - createWebAuthentication(form).ifPresent(entity -> { + getWebAuthentication(form).ifPresent(entity -> { webAuthenticationService.store(entity); saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL)); }).orElse(() -> { @@ -254,7 +254,7 @@ public class AdminWebauthAction extends FessAdminAction { return OptionalEntity.empty(); } - protected OptionalEntity createWebAuthentication(final CreateForm form) { + protected OptionalEntity getWebAuthentication(final CreateForm form) { final String username = systemHelper.getUsername(); final long currentTime = systemHelper.getCurrentTimeAsLong(); return getEntity(form, username, currentTime).map(entity -> { diff --git a/src/main/java/org/codelibs/fess/app/web/admin/webconfig/AdminWebconfigAction.java b/src/main/java/org/codelibs/fess/app/web/admin/webconfig/AdminWebconfigAction.java index ec69f367e..9c7d2839f 100644 --- a/src/main/java/org/codelibs/fess/app/web/admin/webconfig/AdminWebconfigAction.java +++ b/src/main/java/org/codelibs/fess/app/web/admin/webconfig/AdminWebconfigAction.java @@ -214,7 +214,7 @@ public class AdminWebconfigAction extends FessAdminAction { public HtmlResponse create(final CreateForm form) { verifyCrudMode(form.crudMode, CrudMode.CREATE); validate(form, messages -> {}, toEditHtml()); - createWebConfig(form).ifPresent(entity -> { + getWebConfig(form).ifPresent(entity -> { webConfigService.store(entity); saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL)); }).orElse(() -> { @@ -227,7 +227,7 @@ public class AdminWebconfigAction extends FessAdminAction { public HtmlResponse update(final EditForm form) { verifyCrudMode(form.crudMode, CrudMode.EDIT); validate(form, messages -> {}, toEditHtml()); - createWebConfig(form).ifPresent(entity -> { + getWebConfig(form).ifPresent(entity -> { webConfigService.store(entity); saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL)); }).orElse(() -> { @@ -275,7 +275,7 @@ public class AdminWebconfigAction extends FessAdminAction { return OptionalEntity.empty(); } - protected OptionalEntity createWebConfig(final CreateForm form) { + protected OptionalEntity getWebConfig(final CreateForm form) { final String username = systemHelper.getUsername(); final long currentTime = systemHelper.getCurrentTimeAsLong(); return getEntity(form, username, currentTime).map(entity -> { diff --git a/src/main/resources/fess_label.properties b/src/main/resources/fess_label.properties index e8ddd7321..133f44419 100644 --- a/src/main/resources/fess_label.properties +++ b/src/main/resources/fess_label.properties @@ -54,7 +54,7 @@ labels.crawlingConfigPath=Crawling Path labels.deleteUrl=URL labels.processType=Process Type labels.parameters=Parameters -labels.designFile=Upaload File +labels.designFile=Upload File labels.accessType=Access Type labels.additional=Additional Parameters labels.appendQueryParameter=Additional Query Parameters @@ -98,7 +98,7 @@ labels.longitude=Longitude labels.notificationTo=Notification To labels.num=Num labels.overwrite=Overwrite -labels.pn=Page Numger +labels.pn=Page Number labels.protocolScheme=Scheme labels.purgeByBots=Purge By Bots labels.purgeSearchLogDay=Purge Search Log @@ -332,7 +332,7 @@ labels.diff_crawling=Check Last Modified labels.use_acl_as_role=Use ACL as Role labels.search_log_enabled=Search Logging labels.user_info_enabled=User Logging -labels.user_favorite_enabled=Favarite Logging +labels.user_favorite_enabled=Favorite Logging labels.web_api_xml_enabled=XML Response labels.web_api_json_enabled=JSON Response labels.default_label_value=Default Label Value