auto format

This commit is contained in:
Kaoru FUZITA 2015-11-17 02:21:53 +09:00
parent 3733a7b0ce
commit 034fcbb98d
2 changed files with 41 additions and 26 deletions

View file

@ -140,11 +140,15 @@ public class AdminDictKuromojiAction extends FessAdminAction {
@Execute
public HtmlResponse edit(final EditForm form) {
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()), () -> asListHtml(form.dictId));
});
kuromojiService
.getKuromojiItem(form.dictId, form.id)
.ifPresent(entity -> {
copyBeanToBean(entity, form, op -> {});
})
.orElse(() -> {
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.getDisplayId()),
() -> asListHtml(form.dictId));
});
saveToken();
if (form.crudMode.intValue() == CrudMode.EDIT) {
// back
@ -163,19 +167,26 @@ public class AdminDictKuromojiAction extends FessAdminAction {
public HtmlResponse details(final String dictId, final int crudMode, final long id) {
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 -> {
copyOp.excludeNull();
return asDetailsHtml().useForm(
EditForm.class,
op -> {
op.setup(form -> {
kuromojiService
.getKuromojiItem(dictId, id)
.ifPresent(entity -> {
copyBeanToBean(entity, form, copyOp -> {
copyOp.excludeNull();
});
form.crudMode = crudMode;
})
.orElse(() -> {
throwValidationError(
messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, dictId + ":" + id),
() -> asListHtml(dictId));
});
form.dictId = dictId;
});
form.crudMode = crudMode;
}).orElse(() -> {
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, dictId + ":" + id), () -> asListHtml(dictId));
});
form.dictId = dictId;
});
});
}
// -----------------------------------------------------
@ -289,12 +300,16 @@ public class AdminDictKuromojiAction extends FessAdminAction {
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()), () -> 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()),
() -> asDetailsHtml());
});
return redirectWith(getClass(), moreUrl("list/1").params("dictId", form.dictId));
}
@ -349,7 +364,7 @@ public class AdminDictKuromojiAction extends FessAdminAction {
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));

View file

@ -188,7 +188,7 @@ public class FessLabels extends ActionMessages {
/** The key of the message: Parameters */
public static final String LABELS_PARAMETERS = "{labels.parameters}";
/** The key of the message: Upaload File */
/** The key of the message: Upload File */
public static final String LABELS_DESIGN_FILE = "{labels.designFile}";
/** The key of the message: Access Type */
@ -317,7 +317,7 @@ public class FessLabels extends ActionMessages {
/** The key of the message: Overwrite */
public static final String LABELS_OVERWRITE = "{labels.overwrite}";
/** The key of the message: Page Numger */
/** The key of the message: Page Number */
public static final String LABELS_PN = "{labels.pn}";
/** The key of the message: Scheme */
@ -1004,7 +1004,7 @@ public class FessLabels extends ActionMessages {
/** The key of the message: User Logging */
public static final String LABELS_user_info_enabled = "{labels.user_info_enabled}";
/** The key of the message: Favarite Logging */
/** The key of the message: Favorite Logging */
public static final String LABELS_user_favorite_enabled = "{labels.user_favorite_enabled}";
/** The key of the message: XML Response */