Merge pull request #341 from kw-udon/dev

Improve Validation
This commit is contained in:
Shinsuke Sugaya 2015-11-16 22:55:11 +09:00
commit 3733a7b0ce
23 changed files with 264 additions and 211 deletions

View file

@ -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<SuggestBadWord> createSuggestBadWord(final CreateForm form) {
protected OptionalEntity<SuggestBadWord> 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);
}
}

View file

@ -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<BoostDocumentRule> createBoostDocumentRule(final CreateForm form) {
protected OptionalEntity<BoostDocumentRule> getBoostDocumentRule(final CreateForm form) {
final String username = systemHelper.getUsername();
final long currentTime = systemHelper.getCurrentTimeAsLong();
return getEntity(form, username, currentTime).map(entity -> {

View file

@ -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);
}
}

View file

@ -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<DataConfig> createDataConfig(final CreateForm form) {
protected OptionalEntity<DataConfig> 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);
}
}

View file

@ -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);

View file

@ -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<? extends DictionaryItem>[] dictFiles = dictionaryManager.getDictionaryFiles();
data.register("dictFiles", dictFiles);

View file

@ -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<Integer> 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);
}
}

View file

@ -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<DuplicateHost> createDuplicateHost(final CreateForm form) {
protected OptionalEntity<DuplicateHost> getDuplicateHost(final CreateForm form) {
final String username = systemHelper.getUsername();
final long currentTime = systemHelper.getCurrentTimeAsLong();
return getEntity(form, username, currentTime).map(entity -> {

View file

@ -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<SuggestElevateWord> createSuggestElevateWord(final CreateForm form) {
protected OptionalEntity<SuggestElevateWord> getSuggestElevateWord(final CreateForm form) {
final String username = systemHelper.getUsername();
final long currentTime = systemHelper.getCurrentTimeAsLong();
return getEntity(form, username, currentTime).map(entity -> {

View file

@ -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<FileAuthentication> createFileAuthentication(final CreateForm form) {
protected OptionalEntity<FileAuthentication> getFileAuthentication(final CreateForm form) {
final String username = systemHelper.getUsername();
final long currentTime = systemHelper.getCurrentTimeAsLong();
return getEntity(form, username, currentTime).map(entity -> {

View file

@ -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<FileConfig> createFileConfig(final CreateForm form) {
protected OptionalEntity<FileConfig> getFileConfig(final CreateForm form) {
final String username = systemHelper.getUsername();
final long currentTime = systemHelper.getCurrentTimeAsLong();
return getEntity(form, username, currentTime).map(entity -> {

View file

@ -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<Group> createGroup(final CreateForm form) {
protected OptionalEntity<Group> getGroup(final CreateForm form) {
return getEntity(form).map(entity -> {
copyBeanToBean(form, entity, op -> op.exclude(Constants.COMMON_CONVERSION_RULE));
return entity;

View file

@ -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<KeyMatch> createKeyMatch(final CreateForm form) {
protected OptionalEntity<KeyMatch> getKeyMatch(final CreateForm form) {
final String username = systemHelper.getUsername();
final long currentTime = systemHelper.getCurrentTimeAsLong();
return getEntity(form, username, currentTime).map(entity -> {

View file

@ -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<LabelType> createLabelType(final CreateForm form) {
protected OptionalEntity<LabelType> getLabelType(final CreateForm form) {
final String username = systemHelper.getUsername();
final long currentTime = systemHelper.getCurrentTimeAsLong();
return getEntity(form, username, currentTime).map(entity -> {

View file

@ -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<PathMapping> createPathMapping(final CreateForm form) {
protected OptionalEntity<PathMapping> getPathMapping(final CreateForm form) {
final String username = systemHelper.getUsername();
final long currentTime = systemHelper.getCurrentTimeAsLong();
return getEntity(form, username, currentTime).map(entity -> {

View file

@ -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<RequestHeader> createRequestHeader(final CreateForm form) {
protected OptionalEntity<RequestHeader> getRequestHeader(final CreateForm form) {
final String username = systemHelper.getUsername();
final long currentTime = systemHelper.getCurrentTimeAsLong();
return getEntity(form, username, currentTime).map(entity -> {

View file

@ -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<Role> createRole(final CreateForm form) {
protected OptionalEntity<Role> getRole(final CreateForm form) {
return getEntity(form).map(entity -> {
copyBeanToBean(form, entity, op -> op.exclude(Constants.COMMON_CONVERSION_RULE));
return entity;

View file

@ -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<RoleType> createRoleType(final CreateForm form) {
protected OptionalEntity<RoleType> getRoleType(final CreateForm form) {
final String username = systemHelper.getUsername();
final long currentTime = systemHelper.getCurrentTimeAsLong();
return getEntity(form, username, currentTime).map(entity -> {

View file

@ -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<ScheduledJob> createScheduledJob(final CreateForm form) {
protected OptionalEntity<ScheduledJob> getScheduledJob(final CreateForm form) {
final String username = systemHelper.getUsername();
final long currentTime = systemHelper.getCurrentTimeAsLong();
return getEntity(form, username, currentTime).map(entity -> {

View file

@ -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<User> createUser(final CreateForm form) {
protected OptionalEntity<User> 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 -> {

View file

@ -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<WebAuthentication> createWebAuthentication(final CreateForm form) {
protected OptionalEntity<WebAuthentication> getWebAuthentication(final CreateForm form) {
final String username = systemHelper.getUsername();
final long currentTime = systemHelper.getCurrentTimeAsLong();
return getEntity(form, username, currentTime).map(entity -> {

View file

@ -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<WebConfig> createWebConfig(final CreateForm form) {
protected OptionalEntity<WebConfig> getWebConfig(final CreateForm form) {
final String username = systemHelper.getUsername();
final long currentTime = systemHelper.getCurrentTimeAsLong();
return getEntity(form, username, currentTime).map(entity -> {

View file

@ -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