code cleanup
This commit is contained in:
parent
92897eac7f
commit
4d06623731
79 changed files with 714 additions and 760 deletions
|
@ -153,13 +153,7 @@ public abstract class BaseJsonApiManager extends BaseApiManager {
|
|||
buf.append(escapeJson(entry.getKey())).append(':').append(escapeJson(entry.getValue()));
|
||||
}
|
||||
buf.append('}');
|
||||
} else if (obj instanceof Integer) {
|
||||
buf.append((obj));
|
||||
} else if (obj instanceof Long) {
|
||||
buf.append((obj));
|
||||
} else if (obj instanceof Float) {
|
||||
buf.append((obj));
|
||||
} else if (obj instanceof Double) {
|
||||
} else if ((obj instanceof Integer) || (obj instanceof Long) || (obj instanceof Float) || (obj instanceof Double)) {
|
||||
buf.append((obj));
|
||||
} else if (obj instanceof Boolean) {
|
||||
buf.append(obj.toString());
|
||||
|
|
|
@ -169,7 +169,7 @@ public class AdminAccesstokenAction extends FessAdminAction {
|
|||
})
|
||||
.orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id),
|
||||
() -> asListHtml());
|
||||
this::asListHtml);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -178,7 +178,7 @@ public class AdminAccesstokenAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public HtmlResponse edit(final EditForm form) {
|
||||
validate(form, messages -> {}, () -> asListHtml());
|
||||
validate(form, messages -> {}, this::asListHtml);
|
||||
final String id = form.id;
|
||||
accessTokenService
|
||||
.getAccessToken(id)
|
||||
|
@ -195,7 +195,7 @@ public class AdminAccesstokenAction extends FessAdminAction {
|
|||
stream -> stream.map(permissionHelper::decode).filter(StringUtil::isNotBlank).distinct()
|
||||
.collect(Collectors.joining("\n")));
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
saveToken();
|
||||
if (form.crudMode.intValue() == CrudMode.EDIT) {
|
||||
|
@ -215,8 +215,8 @@ public class AdminAccesstokenAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse create(final CreateForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.CREATE);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getAccessToken(form).ifPresent(
|
||||
entity -> {
|
||||
entity.setToken(accessTokenHelper.generateAccessToken());
|
||||
|
@ -225,10 +225,10 @@ public class AdminAccesstokenAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -237,8 +237,8 @@ public class AdminAccesstokenAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse update(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.EDIT);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getAccessToken(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -246,10 +246,10 @@ public class AdminAccesstokenAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -258,8 +258,8 @@ public class AdminAccesstokenAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
final String id = form.id;
|
||||
accessTokenService
|
||||
.getAccessToken(id)
|
||||
|
@ -271,10 +271,10 @@ public class AdminAccesstokenAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asDetailsHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ public class AdminAccesstokenAction extends FessAdminAction {
|
|||
if (crudMode != expectedMode) {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode));
|
||||
}, () -> asListHtml());
|
||||
}, this::asListHtml);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -124,8 +124,8 @@ public class AdminBackupAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public HtmlResponse upload(final UploadForm form) {
|
||||
validate(form, messages -> {}, () -> asListHtml());
|
||||
verifyToken(() -> asListHtml());
|
||||
validate(form, messages -> {}, this::asListHtml);
|
||||
verifyToken(this::asListHtml);
|
||||
final String fileName = form.bulkFile.getFileName();
|
||||
final File tempFile = ComponentUtil.getSystemHelper().createTempFile("fess_restore_", ".tmp");
|
||||
try (final InputStream in = form.bulkFile.getInputStream(); final OutputStream out = new FileOutputStream(tempFile)) {
|
||||
|
@ -136,7 +136,7 @@ public class AdminBackupAction extends FessAdminAction {
|
|||
if (tempFile.exists() && !tempFile.delete()) {
|
||||
logger.warn("Failed to delete {}.", tempFile.getAbsolutePath());
|
||||
}
|
||||
throwValidationError(messages -> messages.addErrorsFileIsNotSupported(GLOBAL, fileName), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsFileIsNotSupported(GLOBAL, fileName), this::asListHtml);
|
||||
}
|
||||
saveInfo(messages -> messages.addSuccessBulkProcessStarted(GLOBAL));
|
||||
return redirect(getClass()); // no-op
|
||||
|
@ -155,7 +155,7 @@ public class AdminBackupAction extends FessAdminAction {
|
|||
} else if (fileName.startsWith("doc") && fileName.endsWith(".json")) {
|
||||
fileType = 5;
|
||||
} else {
|
||||
throwValidationError(messages -> messages.addErrorsFileIsNotSupported(GLOBAL, fileName), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsFileIsNotSupported(GLOBAL, fileName), this::asListHtml);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -348,7 +348,7 @@ public class AdminBackupAction extends FessAdminAction {
|
|||
});
|
||||
}
|
||||
}
|
||||
throwValidationError(messages -> messages.addErrorsCouldNotFindBackupIndex(GLOBAL), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCouldNotFindBackupIndex(GLOBAL), this::asListHtml);
|
||||
return redirect(getClass()); // no-op
|
||||
}
|
||||
|
||||
|
|
|
@ -148,12 +148,12 @@ public class AdminBadwordAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public HtmlResponse edit(final EditForm form) {
|
||||
validate(form, messages -> {}, () -> asListHtml());
|
||||
validate(form, messages -> {}, this::asListHtml);
|
||||
final String id = form.id;
|
||||
badWordService.getBadWord(id).ifPresent(entity -> {
|
||||
copyBeanToBean(entity, form, op -> {});
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
saveToken();
|
||||
if (form.crudMode.intValue() == CrudMode.EDIT) {
|
||||
|
@ -182,7 +182,7 @@ public class AdminBadwordAction extends FessAdminAction {
|
|||
});
|
||||
form.crudMode = crudMode;
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -201,7 +201,7 @@ public class AdminBadwordAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public ActionResponse download(final DownloadForm form) {
|
||||
verifyToken(() -> asDownloadHtml());
|
||||
verifyToken(this::asDownloadHtml);
|
||||
|
||||
return asStream("badword.csv").contentTypeOctetStream().stream(out -> {
|
||||
final Path tempFile = ComponentUtil.getSystemHelper().createTempFile("fess-badword-", ".csv").toPath();
|
||||
|
@ -209,7 +209,7 @@ public class AdminBadwordAction extends FessAdminAction {
|
|||
try (Writer writer = new BufferedWriter(new OutputStreamWriter(Files.newOutputStream(tempFile), getCsvEncoding()))) {
|
||||
badWordService.exportCsv(writer);
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadBadwordFile(GLOBAL), () -> asDownloadHtml());
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadBadwordFile(GLOBAL), this::asDownloadHtml);
|
||||
}
|
||||
try (InputStream in = Files.newInputStream(tempFile)) {
|
||||
out.write(in);
|
||||
|
@ -237,8 +237,8 @@ public class AdminBadwordAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse create(final CreateForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.CREATE);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getBadWord(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -247,10 +247,10 @@ public class AdminBadwordAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -259,8 +259,8 @@ public class AdminBadwordAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse update(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.EDIT);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getBadWord(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -269,10 +269,10 @@ public class AdminBadwordAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -281,8 +281,8 @@ public class AdminBadwordAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
final String id = form.id;
|
||||
badWordService
|
||||
.getBadWord(id)
|
||||
|
@ -295,10 +295,10 @@ public class AdminBadwordAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asDetailsHtml());
|
||||
this::asDetailsHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asDetailsHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -306,8 +306,8 @@ public class AdminBadwordAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public HtmlResponse upload(final UploadForm form) {
|
||||
validate(form, messages -> {}, () -> asUploadHtml());
|
||||
verifyToken(() -> asUploadHtml());
|
||||
validate(form, messages -> {}, this::asUploadHtml);
|
||||
verifyToken(this::asUploadHtml);
|
||||
CommonPoolUtil.execute(() -> {
|
||||
try (Reader reader = new BufferedReader(new InputStreamReader(form.badWordFile.getInputStream(), getCsvEncoding()))) {
|
||||
badWordService.importCsv(reader);
|
||||
|
@ -361,7 +361,7 @@ public class AdminBadwordAction extends FessAdminAction {
|
|||
if (crudMode != expectedMode) {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode));
|
||||
}, () -> asListHtml());
|
||||
}, this::asListHtml);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -132,12 +132,12 @@ public class AdminBoostdocAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public HtmlResponse edit(final EditForm form) {
|
||||
validate(form, messages -> {}, () -> asListHtml());
|
||||
validate(form, messages -> {}, this::asListHtml);
|
||||
final String id = form.id;
|
||||
boostDocumentRuleService.getBoostDocumentRule(id).ifPresent(entity -> {
|
||||
copyBeanToBean(entity, form, op -> {});
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
saveToken();
|
||||
if (form.crudMode.intValue() == CrudMode.EDIT) {
|
||||
|
@ -166,7 +166,7 @@ public class AdminBoostdocAction extends FessAdminAction {
|
|||
});
|
||||
form.crudMode = crudMode;
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -179,8 +179,8 @@ public class AdminBoostdocAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse create(final CreateForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.CREATE);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getBoostDocumentRule(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -188,10 +188,10 @@ public class AdminBoostdocAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -200,8 +200,8 @@ public class AdminBoostdocAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse update(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.EDIT);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getBoostDocumentRule(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -209,10 +209,10 @@ public class AdminBoostdocAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -221,8 +221,8 @@ public class AdminBoostdocAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
final String id = form.id;
|
||||
boostDocumentRuleService
|
||||
.getBoostDocumentRule(id)
|
||||
|
@ -234,10 +234,10 @@ public class AdminBoostdocAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asDetailsHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ public class AdminBoostdocAction extends FessAdminAction {
|
|||
if (crudMode != expectedMode) {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode));
|
||||
}, () -> asListHtml());
|
||||
}, this::asListHtml);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ public class AdminCrawlinginfoAction extends FessAdminAction {
|
|||
RenderDataUtil.register(data, "crawlingInfoParamItems", crawlingInfoService.getCrawlingInfoParamList(id));
|
||||
RenderDataUtil.register(data, "running", processHelper.isProcessRunning(entity.getSessionId()));
|
||||
})).orElseGet(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
@ -155,8 +155,8 @@ public class AdminCrawlinginfoAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse threaddump(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
final String id = form.id;
|
||||
crawlingInfoService.getCrawlingInfo(id).ifPresent(entity -> {
|
||||
try {
|
||||
|
@ -164,10 +164,10 @@ public class AdminCrawlinginfoAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessPrintThreadDump(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
logger.warn("Failed to print a thread dump.", e);
|
||||
throwValidationError(messages -> messages.addErrorsFailedToPrintThreadDump(GLOBAL), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsFailedToPrintThreadDump(GLOBAL), this::asListHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -179,8 +179,8 @@ public class AdminCrawlinginfoAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
final String id = form.id;
|
||||
crawlingInfoService.getCrawlingInfo(id).alwaysPresent(entity -> {
|
||||
crawlingInfoService.delete(entity);
|
||||
|
@ -192,7 +192,7 @@ public class AdminCrawlinginfoAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public HtmlResponse deleteall() {
|
||||
verifyToken(() -> asListHtml());
|
||||
verifyToken(this::asListHtml);
|
||||
crawlingInfoService.deleteOldSessions(processHelper.getRunningSessionIdSet());
|
||||
crawlingInfoPager.clear();
|
||||
saveInfo(messages -> messages.addSuccessCrawlingInfoDeleteAll(GLOBAL));
|
||||
|
@ -210,7 +210,7 @@ public class AdminCrawlinginfoAction extends FessAdminAction {
|
|||
if (crudMode != expectedMode) {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode));
|
||||
}, () -> asListHtml());
|
||||
}, this::asListHtml);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ public class AdminDataconfigAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public HtmlResponse edit(final EditForm form) {
|
||||
validate(form, messages -> {}, () -> asListHtml());
|
||||
validate(form, messages -> {}, this::asListHtml);
|
||||
final String id = form.id;
|
||||
dataConfigService
|
||||
.getDataConfig(id)
|
||||
|
@ -171,7 +171,7 @@ public class AdminDataconfigAction extends FessAdminAction {
|
|||
stream -> stream.filter(StringUtil::isNotBlank).map(String::trim)
|
||||
.collect(Collectors.joining("\n")));
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
saveToken();
|
||||
if (form.crudMode.intValue() == CrudMode.EDIT) {
|
||||
|
@ -217,7 +217,7 @@ public class AdminDataconfigAction extends FessAdminAction {
|
|||
form.crudMode = crudMode;
|
||||
})
|
||||
.orElse(() -> throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id),
|
||||
() -> asListHtml()));
|
||||
this::asListHtml));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -229,8 +229,8 @@ public class AdminDataconfigAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse create(final CreateForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.CREATE);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getDataConfig(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -238,10 +238,10 @@ public class AdminDataconfigAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -250,8 +250,8 @@ public class AdminDataconfigAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse update(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.EDIT);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getDataConfig(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -259,10 +259,10 @@ public class AdminDataconfigAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -271,8 +271,8 @@ public class AdminDataconfigAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
final String id = form.id;
|
||||
dataConfigService
|
||||
.getDataConfig(id)
|
||||
|
@ -284,11 +284,10 @@ public class AdminDataconfigAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
})
|
||||
.orElse(() -> throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id),
|
||||
() -> asDetailsHtml()));
|
||||
.orElse(() -> throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asDetailsHtml));
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
||||
|
@ -360,7 +359,7 @@ public class AdminDataconfigAction extends FessAdminAction {
|
|||
if (crudMode != expectedMode) {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode));
|
||||
}, () -> asListHtml());
|
||||
}, this::asListHtml);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ public class AdminDesignAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse upload(final UploadForm form) {
|
||||
validate(form, messages -> {}, () -> asListHtml(form));
|
||||
verifyToken(() -> asListHtml());
|
||||
verifyToken(this::asListHtml);
|
||||
final String uploadedFileName = form.designFile.getFileName();
|
||||
String fileName = form.designFileName;
|
||||
if (StringUtil.isBlank(fileName)) {
|
||||
|
@ -135,11 +135,11 @@ public class AdminDesignAction extends FessAdminAction {
|
|||
fileName = fileName.substring(pos + 1);
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsDesignFileNameIsInvalid("designFile"), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsDesignFileNameIsInvalid("designFile"), this::asListHtml);
|
||||
}
|
||||
}
|
||||
if (StringUtil.isBlank(fileName)) {
|
||||
throwValidationError(messages -> messages.addErrorsDesignFileNameIsNotFound("designFile"), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsDesignFileNameIsNotFound("designFile"), this::asListHtml);
|
||||
}
|
||||
|
||||
File uploadFile;
|
||||
|
@ -156,11 +156,11 @@ public class AdminDesignAction extends FessAdminAction {
|
|||
} else if (fessConfig.isSupportedUploadedFile(fileName) || fessConfig.isSupportedUploadedFile(uploadedFileName)) {
|
||||
uploadFile = ResourceUtil.getResourceAsFileNoException(fileName);
|
||||
if (uploadFile == null) {
|
||||
throwValidationError(messages -> messages.addErrorsDesignFileNameIsNotFound("designFileName"), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsDesignFileNameIsNotFound("designFileName"), this::asListHtml);
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
throwValidationError(messages -> messages.addErrorsDesignFileIsUnsupportedType("designFileName"), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsDesignFileIsUnsupportedType("designFileName"), this::asListHtml);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ public class AdminDesignAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessUploadDesignFile(GLOBAL, currentFileName));
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to write an image file: {}", fileName, e);
|
||||
throwValidationError(messages -> messages.addErrorsFailedToWriteDesignImageFile(GLOBAL), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsFailedToWriteDesignImageFile(GLOBAL), this::asListHtml);
|
||||
}
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -198,11 +198,11 @@ public class AdminDesignAction extends FessAdminAction {
|
|||
public StreamResponse download(final FileAccessForm form) {
|
||||
final File file = getTargetFile(form.fileName).get();
|
||||
if (file == null) {
|
||||
throwValidationError(messages -> messages.addErrorsTargetFileDoesNotExist(GLOBAL, form.fileName), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsTargetFileDoesNotExist(GLOBAL, form.fileName), this::asListHtml);
|
||||
return null;
|
||||
}
|
||||
validate(form, messages -> {}, () -> asListHtml());
|
||||
verifyTokenKeep(() -> asListHtml());
|
||||
validate(form, messages -> {}, this::asListHtml);
|
||||
verifyTokenKeep(this::asListHtml);
|
||||
return asStream(file.getName()).contentTypeOctetStream().stream(out -> {
|
||||
try (FileInputStream fis = new FileInputStream(file)) {
|
||||
out.write(fis);
|
||||
|
@ -216,14 +216,14 @@ public class AdminDesignAction extends FessAdminAction {
|
|||
getTargetFile(form.fileName).ifPresent(file -> {
|
||||
if (!file.delete()) {
|
||||
logger.error("Failed to delete {}", file.getAbsolutePath());
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDeleteFile(GLOBAL, form.fileName), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDeleteFile(GLOBAL, form.fileName), this::asListHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsTargetFileDoesNotExist(GLOBAL, form.fileName), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsTargetFileDoesNotExist(GLOBAL, form.fileName), this::asListHtml);
|
||||
});
|
||||
saveInfo(messages -> messages.addSuccessDeleteFile(GLOBAL, form.fileName));
|
||||
validate(form, messages -> {}, () -> asListHtml());
|
||||
verifyToken(() -> asListHtml());
|
||||
validate(form, messages -> {}, this::asListHtml);
|
||||
verifyToken(this::asListHtml);
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
||||
|
@ -275,7 +275,7 @@ public class AdminDesignAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessUpdateDesignJspFile(GLOBAL, jspFile.getAbsolutePath()));
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to update {}", form.fileName, e);
|
||||
throwValidationError(messages -> messages.addErrorsFailedToUpdateJspFile(GLOBAL), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsFailedToUpdateJspFile(GLOBAL), this::asListHtml);
|
||||
}
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -307,11 +307,11 @@ public class AdminDesignAction extends FessAdminAction {
|
|||
try {
|
||||
final String[] values = URLDecoder.decode(fileName, Constants.UTF_8).split(":");
|
||||
if (values.length != 2) {
|
||||
throwValidationError(messages -> messages.addErrorsInvalidDesignJspFileName(GLOBAL), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsInvalidDesignJspFileName(GLOBAL), this::asListHtml);
|
||||
}
|
||||
final String jspFileName = systemHelper.getDesignJspFileName(values[1]);
|
||||
if (jspFileName == null) {
|
||||
throwValidationError(messages -> messages.addErrorsInvalidDesignJspFileName(GLOBAL), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsInvalidDesignJspFileName(GLOBAL), this::asListHtml);
|
||||
}
|
||||
String path;
|
||||
if ("view".equals(jspType)) {
|
||||
|
@ -321,7 +321,7 @@ public class AdminDesignAction extends FessAdminAction {
|
|||
}
|
||||
final File jspFile = new File(getServletContext().getRealPath(path));
|
||||
if (!jspFile.exists()) {
|
||||
throwValidationError(messages -> messages.addErrorsDesignJspFileDoesNotExist(GLOBAL), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsDesignJspFileDoesNotExist(GLOBAL), this::asListHtml);
|
||||
}
|
||||
return jspFile;
|
||||
} catch (final UnsupportedEncodingException e) {
|
||||
|
|
|
@ -80,7 +80,7 @@ public class AdminDictKuromojiAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public HtmlResponse index(final SearchForm form) {
|
||||
validate(form, messages -> {}, () -> asDictIndexHtml());
|
||||
validate(form, messages -> {}, this::asDictIndexHtml);
|
||||
kuromojiPager.clear();
|
||||
return asHtml(path_AdminDictKuromoji_AdminDictKuromojiJsp).renderWith(data -> {
|
||||
searchPaging(data, form);
|
||||
|
@ -90,7 +90,7 @@ public class AdminDictKuromojiAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public HtmlResponse list(final OptionalThing<Integer> pageNumber, final SearchForm form) {
|
||||
validate(form, messages -> {}, () -> asDictIndexHtml());
|
||||
validate(form, messages -> {}, this::asDictIndexHtml);
|
||||
pageNumber.ifPresent(num -> {
|
||||
kuromojiPager.setCurrentPageNumber(pageNumber.get());
|
||||
}).orElse(() -> {
|
||||
|
@ -104,7 +104,7 @@ public class AdminDictKuromojiAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public HtmlResponse search(final SearchForm form) {
|
||||
validate(form, messages -> {}, () -> asDictIndexHtml());
|
||||
validate(form, messages -> {}, this::asDictIndexHtml);
|
||||
copyBeanToBean(form, kuromojiPager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
|
||||
return asHtml(path_AdminDictKuromoji_AdminDictKuromojiJsp).renderWith(data -> {
|
||||
searchPaging(data, form);
|
||||
|
@ -114,7 +114,7 @@ public class AdminDictKuromojiAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public HtmlResponse reset(final SearchForm form) {
|
||||
validate(form, messages -> {}, () -> asDictIndexHtml());
|
||||
validate(form, messages -> {}, this::asDictIndexHtml);
|
||||
kuromojiPager.clear();
|
||||
return asHtml(path_AdminDictKuromoji_AdminDictKuromojiJsp).renderWith(data -> {
|
||||
searchPaging(data, form);
|
||||
|
@ -219,7 +219,7 @@ public class AdminDictKuromojiAction extends FessAdminAction {
|
|||
kuromojiService.getKuromojiFile(dictId).ifPresent(file -> {
|
||||
RenderDataUtil.register(data, "path", file.getPath());
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadKuromojiFile(GLOBAL), () -> asDictIndexHtml());
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadKuromojiFile(GLOBAL), this::asDictIndexHtml);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ public class AdminDictKuromojiAction extends FessAdminAction {
|
|||
kuromojiService.getKuromojiFile(dictId).ifPresent(file -> {
|
||||
RenderDataUtil.register(data, "path", file.getPath());
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadKuromojiFile(GLOBAL), () -> asDictIndexHtml());
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadKuromojiFile(GLOBAL), this::asDictIndexHtml);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -292,19 +292,19 @@ public class AdminDictKuromojiAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse create(final CreateForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.CREATE, form.dictId);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
createKuromojiItem(form, () -> asEditHtml()).ifPresent(
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
createKuromojiItem(form, this::asEditHtml).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
kuromojiService.store(form.dictId, entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml);
|
||||
});
|
||||
return redirectWith(getClass(), moreUrl("list/1").params("dictId", form.dictId));
|
||||
}
|
||||
|
@ -313,19 +313,19 @@ public class AdminDictKuromojiAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse update(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.EDIT, form.dictId);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
createKuromojiItem(form, () -> asEditHtml()).ifPresent(
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
createKuromojiItem(form, this::asEditHtml).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
kuromojiService.store(form.dictId, entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.getDisplayId()), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.getDisplayId()), this::asEditHtml);
|
||||
});
|
||||
return redirectWith(getClass(), moreUrl("list/1").params("dictId", form.dictId));
|
||||
}
|
||||
|
@ -334,8 +334,8 @@ public class AdminDictKuromojiAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS, form.dictId);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
kuromojiService
|
||||
.getKuromojiItem(form.dictId, form.id)
|
||||
.ifPresent(
|
||||
|
@ -346,12 +346,12 @@ public class AdminDictKuromojiAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
})
|
||||
.orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.getDisplayId()),
|
||||
() -> asDetailsHtml());
|
||||
this::asDetailsHtml);
|
||||
});
|
||||
return redirectWith(getClass(), moreUrl("list/1").params("dictId", form.dictId));
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ public class AdminDictMappingAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public HtmlResponse index(final SearchForm form) {
|
||||
validate(form, messages -> {}, () -> asDictIndexHtml());
|
||||
validate(form, messages -> {}, this::asDictIndexHtml);
|
||||
charMappingPager.clear();
|
||||
return asHtml(path_AdminDictMapping_AdminDictMappingJsp).renderWith(data -> {
|
||||
searchPaging(data, form);
|
||||
|
@ -92,7 +92,7 @@ public class AdminDictMappingAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public HtmlResponse list(final OptionalThing<Integer> pageNumber, final SearchForm form) {
|
||||
validate(form, messages -> {}, () -> asDictIndexHtml());
|
||||
validate(form, messages -> {}, this::asDictIndexHtml);
|
||||
pageNumber.ifPresent(num -> {
|
||||
charMappingPager.setCurrentPageNumber(pageNumber.get());
|
||||
}).orElse(() -> {
|
||||
|
@ -106,7 +106,7 @@ public class AdminDictMappingAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public HtmlResponse search(final SearchForm form) {
|
||||
validate(form, messages -> {}, () -> asDictIndexHtml());
|
||||
validate(form, messages -> {}, this::asDictIndexHtml);
|
||||
copyBeanToBean(form, charMappingPager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
|
||||
return asHtml(path_AdminDictMapping_AdminDictMappingJsp).renderWith(data -> {
|
||||
searchPaging(data, form);
|
||||
|
@ -116,7 +116,7 @@ public class AdminDictMappingAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public HtmlResponse reset(final SearchForm form) {
|
||||
validate(form, messages -> {}, () -> asDictIndexHtml());
|
||||
validate(form, messages -> {}, this::asDictIndexHtml);
|
||||
charMappingPager.clear();
|
||||
return asHtml(path_AdminDictMapping_AdminDictMappingJsp).renderWith(data -> {
|
||||
searchPaging(data, form);
|
||||
|
@ -222,7 +222,7 @@ public class AdminDictMappingAction extends FessAdminAction {
|
|||
charMappingService.getCharMappingFile(dictId).ifPresent(file -> {
|
||||
RenderDataUtil.register(data, "path", file.getPath());
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadMappingFile(GLOBAL), () -> asDictIndexHtml());
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadMappingFile(GLOBAL), this::asDictIndexHtml);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ public class AdminDictMappingAction extends FessAdminAction {
|
|||
charMappingService.getCharMappingFile(dictId).ifPresent(file -> {
|
||||
RenderDataUtil.register(data, "path", file.getPath());
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadMappingFile(GLOBAL), () -> asDictIndexHtml());
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadMappingFile(GLOBAL), this::asDictIndexHtml);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -295,19 +295,19 @@ public class AdminDictMappingAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse create(final CreateForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.CREATE, form.dictId);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
createCharMappingItem(form, () -> asEditHtml()).ifPresent(
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
createCharMappingItem(form, this::asEditHtml).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
charMappingService.store(form.dictId, entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml);
|
||||
});
|
||||
return redirectWith(getClass(), moreUrl("list/1").params("dictId", form.dictId));
|
||||
}
|
||||
|
@ -316,19 +316,19 @@ public class AdminDictMappingAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse update(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.EDIT, form.dictId);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
createCharMappingItem(form, () -> asEditHtml()).ifPresent(
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
createCharMappingItem(form, this::asEditHtml).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
charMappingService.store(form.dictId, entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.getDisplayId()), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.getDisplayId()), this::asEditHtml);
|
||||
});
|
||||
return redirectWith(getClass(), moreUrl("list/1").params("dictId", form.dictId));
|
||||
}
|
||||
|
@ -337,8 +337,8 @@ public class AdminDictMappingAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS, form.dictId);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
charMappingService
|
||||
.getCharMappingItem(form.dictId, form.id)
|
||||
.ifPresent(
|
||||
|
@ -349,12 +349,12 @@ public class AdminDictMappingAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
})
|
||||
.orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.getDisplayId()),
|
||||
() -> asDetailsHtml());
|
||||
this::asDetailsHtml);
|
||||
});
|
||||
return redirectWith(getClass(), moreUrl("list/1").params("dictId", form.dictId));
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ public class AdminDictProtwordsAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public HtmlResponse index(final SearchForm form) {
|
||||
validate(form, messages -> {}, () -> asDictIndexHtml());
|
||||
validate(form, messages -> {}, this::asDictIndexHtml);
|
||||
protwordsPager.clear();
|
||||
return asHtml(path_AdminDictProtwords_AdminDictProtwordsJsp).renderWith(data -> {
|
||||
searchPaging(data, form);
|
||||
|
@ -89,7 +89,7 @@ public class AdminDictProtwordsAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public HtmlResponse list(final OptionalThing<Integer> pageNumber, final SearchForm form) {
|
||||
validate(form, messages -> {}, () -> asDictIndexHtml());
|
||||
validate(form, messages -> {}, this::asDictIndexHtml);
|
||||
pageNumber.ifPresent(num -> {
|
||||
protwordsPager.setCurrentPageNumber(pageNumber.get());
|
||||
}).orElse(() -> {
|
||||
|
@ -103,7 +103,7 @@ public class AdminDictProtwordsAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public HtmlResponse search(final SearchForm form) {
|
||||
validate(form, messages -> {}, () -> asDictIndexHtml());
|
||||
validate(form, messages -> {}, this::asDictIndexHtml);
|
||||
copyBeanToBean(form, protwordsPager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
|
||||
return asHtml(path_AdminDictProtwords_AdminDictProtwordsJsp).renderWith(data -> {
|
||||
searchPaging(data, form);
|
||||
|
@ -113,7 +113,7 @@ public class AdminDictProtwordsAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public HtmlResponse reset(final SearchForm form) {
|
||||
validate(form, messages -> {}, () -> asDictIndexHtml());
|
||||
validate(form, messages -> {}, this::asDictIndexHtml);
|
||||
protwordsPager.clear();
|
||||
return asHtml(path_AdminDictProtwords_AdminDictProtwordsJsp).renderWith(data -> {
|
||||
searchPaging(data, form);
|
||||
|
@ -217,7 +217,7 @@ public class AdminDictProtwordsAction extends FessAdminAction {
|
|||
protwordsService.getProtwordsFile(dictId).ifPresent(file -> {
|
||||
RenderDataUtil.register(data, "path", file.getPath());
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadProtwordsFile(GLOBAL), () -> asDictIndexHtml());
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadProtwordsFile(GLOBAL), this::asDictIndexHtml);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ public class AdminDictProtwordsAction extends FessAdminAction {
|
|||
protwordsService.getProtwordsFile(dictId).ifPresent(file -> {
|
||||
RenderDataUtil.register(data, "path", file.getPath());
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadProtwordsFile(GLOBAL), () -> asDictIndexHtml());
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadProtwordsFile(GLOBAL), this::asDictIndexHtml);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -290,12 +290,12 @@ public class AdminDictProtwordsAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse create(final CreateForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.CREATE, form.dictId);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
createProtwordsItem(form, () -> asEditHtml()).ifPresent(entity -> {
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
createProtwordsItem(form, this::asEditHtml).ifPresent(entity -> {
|
||||
protwordsService.store(form.dictId, entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
}).orElse(() -> throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml()));
|
||||
}).orElse(() -> throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml));
|
||||
return redirectWith(getClass(), moreUrl("list/1").params("dictId", form.dictId));
|
||||
}
|
||||
|
||||
|
@ -303,14 +303,14 @@ public class AdminDictProtwordsAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse update(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.EDIT, form.dictId);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
createProtwordsItem(form, () -> asEditHtml()).ifPresent(entity -> {
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
createProtwordsItem(form, this::asEditHtml).ifPresent(entity -> {
|
||||
protwordsService.store(form.dictId, entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
}).orElse(
|
||||
() -> throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.getDisplayId()),
|
||||
() -> asEditHtml()));
|
||||
this::asEditHtml));
|
||||
return redirectWith(getClass(), moreUrl("list/1").params("dictId", form.dictId));
|
||||
}
|
||||
|
||||
|
@ -318,8 +318,8 @@ public class AdminDictProtwordsAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS, form.dictId);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
protwordsService
|
||||
.getProtwordsItem(form.dictId, form.id)
|
||||
.ifPresent(entity -> {
|
||||
|
@ -328,7 +328,7 @@ public class AdminDictProtwordsAction extends FessAdminAction {
|
|||
})
|
||||
.orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.getDisplayId()),
|
||||
() -> asDetailsHtml());
|
||||
this::asDetailsHtml);
|
||||
});
|
||||
return redirectWith(getClass(), moreUrl("list/1").params("dictId", form.dictId));
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ public class AdminDictStemmeroverrideAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public HtmlResponse index(final SearchForm form) {
|
||||
validate(form, messages -> {}, () -> asDictIndexHtml());
|
||||
validate(form, messages -> {}, this::asDictIndexHtml);
|
||||
stemmerOverridePager.clear();
|
||||
return asHtml(path_AdminDictStemmeroverride_AdminDictStemmeroverrideJsp).renderWith(data -> {
|
||||
searchPaging(data, form);
|
||||
|
@ -89,7 +89,7 @@ public class AdminDictStemmeroverrideAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public HtmlResponse list(final OptionalThing<Integer> pageNumber, final SearchForm form) {
|
||||
validate(form, messages -> {}, () -> asDictIndexHtml());
|
||||
validate(form, messages -> {}, this::asDictIndexHtml);
|
||||
pageNumber.ifPresent(num -> {
|
||||
stemmerOverridePager.setCurrentPageNumber(pageNumber.get());
|
||||
}).orElse(() -> {
|
||||
|
@ -103,7 +103,7 @@ public class AdminDictStemmeroverrideAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public HtmlResponse search(final SearchForm form) {
|
||||
validate(form, messages -> {}, () -> asDictIndexHtml());
|
||||
validate(form, messages -> {}, this::asDictIndexHtml);
|
||||
copyBeanToBean(form, stemmerOverridePager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
|
||||
return asHtml(path_AdminDictStemmeroverride_AdminDictStemmeroverrideJsp).renderWith(data -> {
|
||||
searchPaging(data, form);
|
||||
|
@ -113,7 +113,7 @@ public class AdminDictStemmeroverrideAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public HtmlResponse reset(final SearchForm form) {
|
||||
validate(form, messages -> {}, () -> asDictIndexHtml());
|
||||
validate(form, messages -> {}, this::asDictIndexHtml);
|
||||
stemmerOverridePager.clear();
|
||||
return asHtml(path_AdminDictStemmeroverride_AdminDictStemmeroverrideJsp).renderWith(data -> {
|
||||
searchPaging(data, form);
|
||||
|
@ -220,7 +220,7 @@ public class AdminDictStemmeroverrideAction extends FessAdminAction {
|
|||
stemmerOverrideService.getStemmerOverrideFile(dictId).ifPresent(file -> {
|
||||
RenderDataUtil.register(data, "path", file.getPath());
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadStemmeroverrideFile(GLOBAL), () -> asDictIndexHtml());
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadStemmeroverrideFile(GLOBAL), this::asDictIndexHtml);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -258,7 +258,7 @@ public class AdminDictStemmeroverrideAction extends FessAdminAction {
|
|||
stemmerOverrideService.getStemmerOverrideFile(dictId).ifPresent(file -> {
|
||||
RenderDataUtil.register(data, "path", file.getPath());
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadStemmeroverrideFile(GLOBAL), () -> asDictIndexHtml());
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadStemmeroverrideFile(GLOBAL), this::asDictIndexHtml);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -296,19 +296,19 @@ public class AdminDictStemmeroverrideAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse create(final CreateForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.CREATE, form.dictId);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
createStemmerOverrideItem(form, () -> asEditHtml()).ifPresent(
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
createStemmerOverrideItem(form, this::asEditHtml).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
stemmerOverrideService.store(form.dictId, entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml);
|
||||
});
|
||||
return redirectWith(getClass(), moreUrl("list/1").params("dictId", form.dictId));
|
||||
}
|
||||
|
@ -317,20 +317,20 @@ public class AdminDictStemmeroverrideAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse update(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.EDIT, form.dictId);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
createStemmerOverrideItem(form, () -> asEditHtml()).ifPresent(
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
createStemmerOverrideItem(form, this::asEditHtml).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
stemmerOverrideService.store(form.dictId, entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
saveToken();
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.getDisplayId()), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.getDisplayId()), this::asEditHtml);
|
||||
});
|
||||
return redirectWith(getClass(), moreUrl("list/1").params("dictId", form.dictId));
|
||||
}
|
||||
|
@ -339,8 +339,8 @@ public class AdminDictStemmeroverrideAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS, form.dictId);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
stemmerOverrideService
|
||||
.getStemmerOverrideItem(form.dictId, form.id)
|
||||
.ifPresent(
|
||||
|
@ -351,12 +351,12 @@ public class AdminDictStemmeroverrideAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
})
|
||||
.orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.getDisplayId()),
|
||||
() -> asDetailsHtml());
|
||||
this::asDetailsHtml);
|
||||
});
|
||||
return redirectWith(getClass(), moreUrl("list/1").params("dictId", form.dictId));
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public class AdminDictStopwordsAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public HtmlResponse index(final SearchForm form) {
|
||||
validate(form, messages -> {}, () -> asDictIndexHtml());
|
||||
validate(form, messages -> {}, this::asDictIndexHtml);
|
||||
stopwordsPager.clear();
|
||||
return asHtml(path_AdminDictStopwords_AdminDictStopwordsJsp).renderWith(data -> {
|
||||
searchPaging(data, form);
|
||||
|
@ -87,7 +87,7 @@ public class AdminDictStopwordsAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public HtmlResponse list(final OptionalThing<Integer> pageNumber, final SearchForm form) {
|
||||
validate(form, messages -> {}, () -> asDictIndexHtml());
|
||||
validate(form, messages -> {}, this::asDictIndexHtml);
|
||||
pageNumber.ifPresent(num -> {
|
||||
stopwordsPager.setCurrentPageNumber(pageNumber.get());
|
||||
}).orElse(() -> {
|
||||
|
@ -101,7 +101,7 @@ public class AdminDictStopwordsAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public HtmlResponse search(final SearchForm form) {
|
||||
validate(form, messages -> {}, () -> asDictIndexHtml());
|
||||
validate(form, messages -> {}, this::asDictIndexHtml);
|
||||
copyBeanToBean(form, stopwordsPager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
|
||||
return asHtml(path_AdminDictStopwords_AdminDictStopwordsJsp).renderWith(data -> {
|
||||
searchPaging(data, form);
|
||||
|
@ -111,7 +111,7 @@ public class AdminDictStopwordsAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public HtmlResponse reset(final SearchForm form) {
|
||||
validate(form, messages -> {}, () -> asDictIndexHtml());
|
||||
validate(form, messages -> {}, this::asDictIndexHtml);
|
||||
stopwordsPager.clear();
|
||||
return asHtml(path_AdminDictStopwords_AdminDictStopwordsJsp).renderWith(data -> {
|
||||
searchPaging(data, form);
|
||||
|
@ -215,7 +215,7 @@ public class AdminDictStopwordsAction extends FessAdminAction {
|
|||
stopwordsService.getStopwordsFile(dictId).ifPresent(file -> {
|
||||
RenderDataUtil.register(data, "path", file.getPath());
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadStopwordsFile(GLOBAL), () -> asDictIndexHtml());
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadStopwordsFile(GLOBAL), this::asDictIndexHtml);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ public class AdminDictStopwordsAction extends FessAdminAction {
|
|||
stopwordsService.getStopwordsFile(dictId).ifPresent(file -> {
|
||||
RenderDataUtil.register(data, "path", file.getPath());
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadStopwordsFile(GLOBAL), () -> asDictIndexHtml());
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadStopwordsFile(GLOBAL), this::asDictIndexHtml);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -288,12 +288,12 @@ public class AdminDictStopwordsAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse create(final CreateForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.CREATE, form.dictId);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
createStopwordsItem(form, () -> asEditHtml()).ifPresent(entity -> {
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
createStopwordsItem(form, this::asEditHtml).ifPresent(entity -> {
|
||||
stopwordsService.store(form.dictId, entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
}).orElse(() -> throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml()));
|
||||
}).orElse(() -> throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml));
|
||||
return redirectWith(getClass(), moreUrl("list/1").params("dictId", form.dictId));
|
||||
}
|
||||
|
||||
|
@ -301,14 +301,14 @@ public class AdminDictStopwordsAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse update(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.EDIT, form.dictId);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
createStopwordsItem(form, () -> asEditHtml()).ifPresent(entity -> {
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
createStopwordsItem(form, this::asEditHtml).ifPresent(entity -> {
|
||||
stopwordsService.store(form.dictId, entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
}).orElse(
|
||||
() -> throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.getDisplayId()),
|
||||
() -> asEditHtml()));
|
||||
this::asEditHtml));
|
||||
return redirectWith(getClass(), moreUrl("list/1").params("dictId", form.dictId));
|
||||
}
|
||||
|
||||
|
@ -316,8 +316,8 @@ public class AdminDictStopwordsAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS, form.dictId);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
stopwordsService
|
||||
.getStopwordsItem(form.dictId, form.id)
|
||||
.ifPresent(entity -> {
|
||||
|
@ -326,7 +326,7 @@ public class AdminDictStopwordsAction extends FessAdminAction {
|
|||
})
|
||||
.orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.getDisplayId()),
|
||||
() -> asDetailsHtml());
|
||||
this::asDetailsHtml);
|
||||
});
|
||||
return redirectWith(getClass(), moreUrl("list/1").params("dictId", form.dictId));
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ public class AdminDictSynonymAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public HtmlResponse index(final SearchForm form) {
|
||||
validate(form, messages -> {}, () -> asDictIndexHtml());
|
||||
validate(form, messages -> {}, this::asDictIndexHtml);
|
||||
synonymPager.clear();
|
||||
return asHtml(path_AdminDictSynonym_AdminDictSynonymJsp).renderWith(data -> {
|
||||
searchPaging(data, form);
|
||||
|
@ -92,7 +92,7 @@ public class AdminDictSynonymAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public HtmlResponse list(final OptionalThing<Integer> pageNumber, final SearchForm form) {
|
||||
validate(form, messages -> {}, () -> asDictIndexHtml());
|
||||
validate(form, messages -> {}, this::asDictIndexHtml);
|
||||
pageNumber.ifPresent(num -> {
|
||||
synonymPager.setCurrentPageNumber(pageNumber.get());
|
||||
}).orElse(() -> {
|
||||
|
@ -106,7 +106,7 @@ public class AdminDictSynonymAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public HtmlResponse search(final SearchForm form) {
|
||||
validate(form, messages -> {}, () -> asDictIndexHtml());
|
||||
validate(form, messages -> {}, this::asDictIndexHtml);
|
||||
copyBeanToBean(form, synonymPager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
|
||||
return asHtml(path_AdminDictSynonym_AdminDictSynonymJsp).renderWith(data -> {
|
||||
searchPaging(data, form);
|
||||
|
@ -116,7 +116,7 @@ public class AdminDictSynonymAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public HtmlResponse reset(final SearchForm form) {
|
||||
validate(form, messages -> {}, () -> asDictIndexHtml());
|
||||
validate(form, messages -> {}, this::asDictIndexHtml);
|
||||
synonymPager.clear();
|
||||
return asHtml(path_AdminDictSynonym_AdminDictSynonymJsp).renderWith(data -> {
|
||||
searchPaging(data, form);
|
||||
|
@ -222,7 +222,7 @@ public class AdminDictSynonymAction extends FessAdminAction {
|
|||
synonymService.getSynonymFile(dictId).ifPresent(file -> {
|
||||
RenderDataUtil.register(data, "path", file.getPath());
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadSynonymFile(GLOBAL), () -> asDictIndexHtml());
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadSynonymFile(GLOBAL), this::asDictIndexHtml);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ public class AdminDictSynonymAction extends FessAdminAction {
|
|||
synonymService.getSynonymFile(dictId).ifPresent(file -> {
|
||||
RenderDataUtil.register(data, "path", file.getPath());
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadSynonymFile(GLOBAL), () -> asDictIndexHtml());
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadSynonymFile(GLOBAL), this::asDictIndexHtml);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -295,19 +295,19 @@ public class AdminDictSynonymAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse create(final CreateForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.CREATE, form.dictId);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
createSynonymItem(form, () -> asEditHtml()).ifPresent(
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
createSynonymItem(form, this::asEditHtml).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
synonymService.store(form.dictId, entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml);
|
||||
});
|
||||
return redirectWith(getClass(), moreUrl("list/1").params("dictId", form.dictId));
|
||||
}
|
||||
|
@ -316,20 +316,20 @@ public class AdminDictSynonymAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse update(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.EDIT, form.dictId);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
createSynonymItem(form, () -> asEditHtml()).ifPresent(
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
createSynonymItem(form, this::asEditHtml).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
synonymService.store(form.dictId, entity);
|
||||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
saveToken();
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.getDisplayId()), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.getDisplayId()), this::asEditHtml);
|
||||
});
|
||||
return redirectWith(getClass(), moreUrl("list/1").params("dictId", form.dictId));
|
||||
}
|
||||
|
@ -338,8 +338,8 @@ public class AdminDictSynonymAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS, form.dictId);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
synonymService
|
||||
.getSynonymItem(form.dictId, form.id)
|
||||
.ifPresent(
|
||||
|
@ -350,12 +350,12 @@ public class AdminDictSynonymAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
})
|
||||
.orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.getDisplayId()),
|
||||
() -> asDetailsHtml());
|
||||
this::asDetailsHtml);
|
||||
});
|
||||
return redirectWith(getClass(), moreUrl("list/1").params("dictId", form.dictId));
|
||||
}
|
||||
|
|
|
@ -132,12 +132,12 @@ public class AdminDuplicatehostAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public HtmlResponse edit(final EditForm form) {
|
||||
validate(form, messages -> {}, () -> asListHtml());
|
||||
validate(form, messages -> {}, this::asListHtml);
|
||||
final String id = form.id;
|
||||
duplicateHostService.getDuplicateHost(id).ifPresent(entity -> {
|
||||
copyBeanToBean(entity, form, op -> {});
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
saveToken();
|
||||
if (form.crudMode.intValue() == CrudMode.EDIT) {
|
||||
|
@ -166,7 +166,7 @@ public class AdminDuplicatehostAction extends FessAdminAction {
|
|||
});
|
||||
form.crudMode = crudMode;
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -179,8 +179,8 @@ public class AdminDuplicatehostAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse create(final CreateForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.CREATE);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getDuplicateHost(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -188,10 +188,10 @@ public class AdminDuplicatehostAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -200,8 +200,8 @@ public class AdminDuplicatehostAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse update(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.EDIT);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getDuplicateHost(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -209,10 +209,10 @@ public class AdminDuplicatehostAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -221,8 +221,8 @@ public class AdminDuplicatehostAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
final String id = form.id;
|
||||
duplicateHostService
|
||||
.getDuplicateHost(id)
|
||||
|
@ -234,10 +234,10 @@ public class AdminDuplicatehostAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asDetailsHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -283,7 +283,7 @@ public class AdminDuplicatehostAction extends FessAdminAction {
|
|||
if (crudMode != expectedMode) {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode));
|
||||
}, () -> asListHtml());
|
||||
}, this::asListHtml);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ public class AdminElevatewordAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public HtmlResponse edit(final EditForm form) {
|
||||
validate(form, messages -> {}, () -> asListHtml());
|
||||
validate(form, messages -> {}, this::asListHtml);
|
||||
final String id = form.id;
|
||||
elevateWordService
|
||||
.getElevateWord(id)
|
||||
|
@ -176,7 +176,7 @@ public class AdminElevatewordAction extends FessAdminAction {
|
|||
stream -> stream.map(s -> permissionHelper.decode(s)).filter(StringUtil::isNotBlank).distinct()
|
||||
.collect(Collectors.joining("\n")));
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
saveToken();
|
||||
if (form.crudMode.intValue() == CrudMode.EDIT) {
|
||||
|
@ -216,8 +216,8 @@ public class AdminElevatewordAction extends FessAdminAction {
|
|||
form.crudMode = crudMode;
|
||||
})
|
||||
.orElse(() -> throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id),
|
||||
() -> asListHtml()));
|
||||
})).renderWith(data -> registerLabels(data));
|
||||
this::asListHtml));
|
||||
})).renderWith(this::registerLabels);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------
|
||||
|
@ -233,7 +233,7 @@ public class AdminElevatewordAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public ActionResponse download(final DownloadForm form) {
|
||||
verifyToken(() -> asDownloadHtml());
|
||||
verifyToken(this::asDownloadHtml);
|
||||
|
||||
return asStream("elevate.csv").contentTypeOctetStream().stream(out -> {
|
||||
final Path tempFile = ComponentUtil.getSystemHelper().createTempFile("fess-elevate-", ".csv").toPath();
|
||||
|
@ -241,7 +241,7 @@ public class AdminElevatewordAction extends FessAdminAction {
|
|||
try (Writer writer = new BufferedWriter(new OutputStreamWriter(Files.newOutputStream(tempFile), getCsvEncoding()))) {
|
||||
elevateWordService.exportCsv(writer);
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadElevateFile(GLOBAL), () -> asDownloadHtml());
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDownloadElevateFile(GLOBAL), this::asDownloadHtml);
|
||||
}
|
||||
try (InputStream in = Files.newInputStream(tempFile)) {
|
||||
out.write(in);
|
||||
|
@ -269,8 +269,8 @@ public class AdminElevatewordAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse create(final CreateForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.CREATE);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getElevateWord(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -280,10 +280,10 @@ public class AdminElevatewordAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -292,8 +292,8 @@ public class AdminElevatewordAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse update(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.EDIT);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getElevateWord(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -303,10 +303,10 @@ public class AdminElevatewordAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -315,8 +315,8 @@ public class AdminElevatewordAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
final String id = form.id;
|
||||
elevateWordService
|
||||
.getElevateWord(id)
|
||||
|
@ -329,19 +329,18 @@ public class AdminElevatewordAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
})
|
||||
.orElse(() -> throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id),
|
||||
() -> asDetailsHtml()));
|
||||
.orElse(() -> throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asDetailsHtml));
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
||||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public HtmlResponse upload(final UploadForm form) {
|
||||
validate(form, messages -> {}, () -> asUploadHtml());
|
||||
verifyToken(() -> asUploadHtml());
|
||||
validate(form, messages -> {}, this::asUploadHtml);
|
||||
verifyToken(this::asUploadHtml);
|
||||
CommonPoolUtil.execute(() -> {
|
||||
try (Reader reader = new BufferedReader(new InputStreamReader(form.elevateWordFile.getInputStream(), getCsvEncoding()))) {
|
||||
elevateWordService.importCsv(reader);
|
||||
|
@ -407,7 +406,7 @@ public class AdminElevatewordAction extends FessAdminAction {
|
|||
if (crudMode != expectedMode) {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode));
|
||||
}, () -> asListHtml());
|
||||
}, this::asListHtml);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,14 +62,14 @@ public class AdminEsreqAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public HtmlResponse index() {
|
||||
return asListHtml(() -> saveToken());
|
||||
return asListHtml(this::saveToken);
|
||||
}
|
||||
|
||||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public ActionResponse upload(final UploadForm form) {
|
||||
validate(form, messages -> {}, () -> asListHtml(null));
|
||||
verifyTokenKeep(() -> asListHtml(() -> saveToken()));
|
||||
verifyTokenKeep(() -> asListHtml(this::saveToken));
|
||||
|
||||
String header = null;
|
||||
final StringBuilder buf = new StringBuilder(1000);
|
||||
|
@ -77,7 +77,7 @@ public class AdminEsreqAction extends FessAdminAction {
|
|||
header = ReaderUtil.readLine(reader);
|
||||
if (header == null) {
|
||||
throwValidationError(messages -> messages.addErrorsInvalidHeaderForRequestFile(GLOBAL, "no header"),
|
||||
() -> asListHtml(() -> saveToken()));
|
||||
() -> asListHtml(this::saveToken));
|
||||
return redirect(getClass()); // no-op
|
||||
}
|
||||
String line;
|
||||
|
@ -86,14 +86,13 @@ public class AdminEsreqAction extends FessAdminAction {
|
|||
}
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsFailedToReadRequestFile(GLOBAL, e.getMessage()),
|
||||
() -> asListHtml(() -> saveToken()));
|
||||
() -> asListHtml(this::saveToken));
|
||||
}
|
||||
|
||||
final CurlRequest curlRequest = getCurlRequest(header);
|
||||
if (curlRequest == null) {
|
||||
final String msg = header;
|
||||
throwValidationError(messages -> messages.addErrorsInvalidHeaderForRequestFile(GLOBAL, msg),
|
||||
() -> asListHtml(() -> saveToken()));
|
||||
throwValidationError(messages -> messages.addErrorsInvalidHeaderForRequestFile(GLOBAL, msg), () -> asListHtml(this::saveToken));
|
||||
} else {
|
||||
try (final CurlResponse response = curlRequest.body(buf.toString()).execute()) {
|
||||
final File tempFile = ComponentUtil.getSystemHelper().createTempFile("esreq_", ".json");
|
||||
|
@ -117,7 +116,7 @@ public class AdminEsreqAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
logger.warn("Failed to process request file: " + form.requestFile.getFileName(), e);
|
||||
throwValidationError(messages -> messages.addErrorsInvalidHeaderForRequestFile(GLOBAL, e.getMessage()),
|
||||
() -> asListHtml(() -> saveToken()));
|
||||
() -> asListHtml(this::saveToken));
|
||||
}
|
||||
}
|
||||
return redirect(getClass()); // no-op
|
||||
|
|
|
@ -126,7 +126,7 @@ public class AdminFailureurlAction extends FessAdminAction {
|
|||
});
|
||||
form.crudMode = crudMode;
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -140,8 +140,8 @@ public class AdminFailureurlAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
final String id = form.id;
|
||||
failureUrlService.getFailureUrl(id).alwaysPresent(entity -> {
|
||||
failureUrlService.delete(entity);
|
||||
|
@ -153,7 +153,7 @@ public class AdminFailureurlAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public HtmlResponse deleteall() {
|
||||
verifyToken(() -> asListHtml());
|
||||
verifyToken(this::asListHtml);
|
||||
failureUrlService.deleteAll(failureUrlPager);
|
||||
failureUrlPager.clear();
|
||||
saveInfo(messages -> messages.addSuccessFailureUrlDeleteAll(GLOBAL));
|
||||
|
@ -167,7 +167,7 @@ public class AdminFailureurlAction extends FessAdminAction {
|
|||
if (crudMode != expectedMode) {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode));
|
||||
}, () -> asListHtml());
|
||||
}, this::asListHtml);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -147,12 +147,12 @@ public class AdminFileauthAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public HtmlResponse edit(final EditForm form) {
|
||||
validate(form, messages -> {}, () -> asListHtml());
|
||||
validate(form, messages -> {}, this::asListHtml);
|
||||
final String id = form.id;
|
||||
fileAuthenticationService.getFileAuthentication(id).ifPresent(entity -> {
|
||||
copyBeanToBean(entity, form, op -> {});
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
saveToken();
|
||||
if (form.crudMode.intValue() == CrudMode.EDIT) {
|
||||
|
@ -181,7 +181,7 @@ public class AdminFileauthAction extends FessAdminAction {
|
|||
});
|
||||
form.crudMode = crudMode;
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -194,8 +194,8 @@ public class AdminFileauthAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse create(final CreateForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.CREATE);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getFileAuthentication(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -203,10 +203,10 @@ public class AdminFileauthAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -215,8 +215,8 @@ public class AdminFileauthAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse update(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.EDIT);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getFileAuthentication(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -224,10 +224,10 @@ public class AdminFileauthAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -236,8 +236,8 @@ public class AdminFileauthAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
final String id = form.id;
|
||||
fileAuthenticationService
|
||||
.getFileAuthentication(id)
|
||||
|
@ -249,10 +249,10 @@ public class AdminFileauthAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asDetailsHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ public class AdminFileauthAction extends FessAdminAction {
|
|||
if (crudMode != expectedMode) {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode));
|
||||
}, () -> asListHtml());
|
||||
}, this::asListHtml);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ public class AdminFileconfigAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public HtmlResponse edit(final EditForm form) {
|
||||
validate(form, messages -> {}, () -> asListHtml());
|
||||
validate(form, messages -> {}, this::asListHtml);
|
||||
final PermissionHelper permissionHelper = ComponentUtil.getPermissionHelper();
|
||||
final String id = form.id;
|
||||
fileConfigService
|
||||
|
@ -168,7 +168,7 @@ public class AdminFileconfigAction extends FessAdminAction {
|
|||
stream -> stream.filter(StringUtil::isNotBlank).map(String::trim)
|
||||
.collect(Collectors.joining("\n")));
|
||||
})
|
||||
.orElse(() -> throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml()));
|
||||
.orElse(() -> throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml));
|
||||
saveToken();
|
||||
if (form.crudMode.intValue() == CrudMode.EDIT) {
|
||||
// back
|
||||
|
@ -212,8 +212,8 @@ public class AdminFileconfigAction extends FessAdminAction {
|
|||
form.crudMode = crudMode;
|
||||
})
|
||||
.orElse(() -> throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id),
|
||||
() -> asListHtml()));
|
||||
})).renderWith(data -> registerRolesAndLabels(data));
|
||||
this::asListHtml));
|
||||
})).renderWith(this::registerRolesAndLabels);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------
|
||||
|
@ -223,8 +223,8 @@ public class AdminFileconfigAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse create(final CreateForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.CREATE);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getFileConfig(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -232,10 +232,10 @@ public class AdminFileconfigAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -244,8 +244,8 @@ public class AdminFileconfigAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse update(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.EDIT);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getFileConfig(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -253,10 +253,10 @@ public class AdminFileconfigAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -265,8 +265,8 @@ public class AdminFileconfigAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
final String id = form.id;
|
||||
fileConfigService
|
||||
.getFileConfig(id)
|
||||
|
@ -278,10 +278,10 @@ public class AdminFileconfigAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asDetailsHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ public class AdminFileconfigAction extends FessAdminAction {
|
|||
if (crudMode != expectedMode) {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode));
|
||||
}, () -> asListHtml());
|
||||
}, this::asListHtml);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -141,12 +141,12 @@ public class AdminGroupAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public HtmlResponse edit(final EditForm form) {
|
||||
validate(form, messages -> {}, () -> asListHtml());
|
||||
validate(form, messages -> {}, this::asListHtml);
|
||||
final String id = form.id;
|
||||
groupService.getGroup(id).ifPresent(entity -> {
|
||||
copyBeanToBean(entity, form, op -> {});
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
saveToken();
|
||||
if (form.crudMode.intValue() == CrudMode.EDIT) {
|
||||
|
@ -175,7 +175,7 @@ public class AdminGroupAction extends FessAdminAction {
|
|||
});
|
||||
form.crudMode = crudMode;
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -188,9 +188,9 @@ public class AdminGroupAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse create(final CreateForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.CREATE);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
validateAttributes(form.attributes, v -> throwValidationError(v, () -> asEditHtml()));
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
validateAttributes(form.attributes, v -> throwValidationError(v, this::asEditHtml));
|
||||
verifyToken(this::asEditHtml);
|
||||
getGroup(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -199,10 +199,10 @@ public class AdminGroupAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
logger.error("Failed to add " + entity, e);
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -211,9 +211,9 @@ public class AdminGroupAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse update(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.EDIT);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
validateAttributes(form.attributes, v -> throwValidationError(v, () -> asEditHtml()));
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
validateAttributes(form.attributes, v -> throwValidationError(v, this::asEditHtml));
|
||||
verifyToken(this::asEditHtml);
|
||||
getGroup(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -222,10 +222,10 @@ public class AdminGroupAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
logger.error("Failed to update " + entity, e);
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -234,8 +234,8 @@ public class AdminGroupAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
final String id = form.id;
|
||||
groupService
|
||||
.getGroup(id)
|
||||
|
@ -248,10 +248,10 @@ public class AdminGroupAction extends FessAdminAction {
|
|||
logger.error("Failed to delete " + entity, e);
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asDetailsHtml());
|
||||
this::asDetailsHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asDetailsHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ public class AdminGroupAction extends FessAdminAction {
|
|||
if (crudMode != expectedMode) {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode));
|
||||
}, () -> asListHtml());
|
||||
}, this::asListHtml);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ public class AdminJoblogAction extends FessAdminAction {
|
|||
});
|
||||
form.crudMode = crudMode;
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -154,8 +154,8 @@ public class AdminJoblogAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
final String id = form.id;
|
||||
jobLogService.getJobLog(id).alwaysPresent(entity -> {
|
||||
jobLogService.delete(entity);
|
||||
|
@ -167,7 +167,7 @@ public class AdminJoblogAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public HtmlResponse deleteall() {
|
||||
verifyToken(() -> asListHtml());
|
||||
verifyToken(this::asListHtml);
|
||||
final List<String> jobStatusList = new ArrayList<>();
|
||||
jobStatusList.add(Constants.OK);
|
||||
jobStatusList.add(Constants.FAIL);
|
||||
|
@ -188,7 +188,7 @@ public class AdminJoblogAction extends FessAdminAction {
|
|||
if (crudMode != expectedMode) {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode));
|
||||
}, () -> asListHtml());
|
||||
}, this::asListHtml);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -139,12 +139,12 @@ public class AdminKeymatchAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public HtmlResponse edit(final EditForm form) {
|
||||
validate(form, messages -> {}, () -> asListHtml());
|
||||
validate(form, messages -> {}, this::asListHtml);
|
||||
final String id = form.id;
|
||||
keyMatchService.getKeyMatch(id).ifPresent(entity -> {
|
||||
copyBeanToBean(entity, form, op -> {});
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
saveToken();
|
||||
if (form.crudMode.intValue() == CrudMode.EDIT) {
|
||||
|
@ -175,7 +175,7 @@ public class AdminKeymatchAction extends FessAdminAction {
|
|||
form.crudMode = crudMode;
|
||||
docList.addAll(keyMatchHelper.getBoostedDocumentList(entity.getTerm(), entity.getMaxSize()));
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
});
|
||||
}).renderWith(data -> {
|
||||
|
@ -190,8 +190,8 @@ public class AdminKeymatchAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse create(final CreateForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.CREATE);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getKeyMatch(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -200,10 +200,10 @@ public class AdminKeymatchAction extends FessAdminAction {
|
|||
ComponentUtil.getKeyMatchHelper().update();
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -212,8 +212,8 @@ public class AdminKeymatchAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse update(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.EDIT);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getKeyMatch(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -222,10 +222,10 @@ public class AdminKeymatchAction extends FessAdminAction {
|
|||
ComponentUtil.getKeyMatchHelper().update();
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -234,8 +234,8 @@ public class AdminKeymatchAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
final String id = form.id;
|
||||
keyMatchService
|
||||
.getKeyMatch(id)
|
||||
|
@ -248,10 +248,10 @@ public class AdminKeymatchAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asDetailsHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ public class AdminKeymatchAction extends FessAdminAction {
|
|||
if (crudMode != expectedMode) {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode));
|
||||
}, () -> asListHtml());
|
||||
}, this::asListHtml);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ public class AdminLabeltypeAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public HtmlResponse edit(final EditForm form) {
|
||||
validate(form, messages -> {}, () -> asListHtml());
|
||||
validate(form, messages -> {}, this::asListHtml);
|
||||
final String id = form.id;
|
||||
labelTypeService
|
||||
.getLabelType(id)
|
||||
|
@ -162,7 +162,7 @@ public class AdminLabeltypeAction extends FessAdminAction {
|
|||
stream -> stream.map(s -> permissionHelper.decode(s)).filter(StringUtil::isNotBlank).distinct()
|
||||
.collect(Collectors.joining("\n")));
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
saveToken();
|
||||
if (form.crudMode.intValue() == CrudMode.EDIT) {
|
||||
|
@ -205,7 +205,7 @@ public class AdminLabeltypeAction extends FessAdminAction {
|
|||
})
|
||||
.orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id),
|
||||
() -> asListHtml());
|
||||
this::asListHtml);
|
||||
});
|
||||
});
|
||||
}).renderWith(data -> {
|
||||
|
@ -220,8 +220,8 @@ public class AdminLabeltypeAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse create(final CreateForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.CREATE);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getLabelType(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -229,10 +229,10 @@ public class AdminLabeltypeAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -241,8 +241,8 @@ public class AdminLabeltypeAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse update(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.EDIT);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getLabelType(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -250,10 +250,10 @@ public class AdminLabeltypeAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -262,8 +262,8 @@ public class AdminLabeltypeAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
final String id = form.id;
|
||||
labelTypeService
|
||||
.getLabelType(id)
|
||||
|
@ -275,10 +275,10 @@ public class AdminLabeltypeAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asDetailsHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ public class AdminLabeltypeAction extends FessAdminAction {
|
|||
if (crudMode != expectedMode) {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode));
|
||||
}, () -> asListHtml());
|
||||
}, this::asListHtml);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ public class AdminLogAction extends FessAdminAction {
|
|||
}
|
||||
});
|
||||
}
|
||||
throwValidationError(messages -> messages.addErrorsCouldNotFindLogFile(GLOBAL, filename), () -> asIndexHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCouldNotFindLogFile(GLOBAL, filename), this::asIndexHtml);
|
||||
return redirect(getClass()); // no-op
|
||||
}
|
||||
|
||||
|
|
|
@ -133,12 +133,12 @@ public class AdminPathmapAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public HtmlResponse edit(final EditForm form) {
|
||||
validate(form, messages -> {}, () -> asListHtml());
|
||||
validate(form, messages -> {}, this::asListHtml);
|
||||
final String id = form.id;
|
||||
pathMappingService.getPathMapping(id).ifPresent(entity -> {
|
||||
copyBeanToBean(entity, form, op -> {});
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
saveToken();
|
||||
if (form.crudMode.intValue() == CrudMode.EDIT) {
|
||||
|
@ -167,7 +167,7 @@ public class AdminPathmapAction extends FessAdminAction {
|
|||
});
|
||||
form.crudMode = crudMode;
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -180,8 +180,8 @@ public class AdminPathmapAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse create(final CreateForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.CREATE);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getPathMapping(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -189,10 +189,10 @@ public class AdminPathmapAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -201,8 +201,8 @@ public class AdminPathmapAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse update(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.EDIT);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getPathMapping(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -210,10 +210,10 @@ public class AdminPathmapAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -222,8 +222,8 @@ public class AdminPathmapAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
final String id = form.id;
|
||||
pathMappingService
|
||||
.getPathMapping(id)
|
||||
|
@ -235,10 +235,10 @@ public class AdminPathmapAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asDetailsHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ public class AdminPathmapAction extends FessAdminAction {
|
|||
if (crudMode != expectedMode) {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode));
|
||||
}, () -> asListHtml());
|
||||
}, this::asListHtml);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -84,11 +84,10 @@ public class AdminPluginAction extends FessAdminAction {
|
|||
verifyToken(() -> asHtml(path_AdminPlugin_AdminPluginInstallpluginJsp));
|
||||
if (UPLOAD.equals(form.id)) {
|
||||
if (form.jarFile == null) {
|
||||
throwValidationError(messages -> messages.addErrorsPluginFileIsNotFound(GLOBAL, form.id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsPluginFileIsNotFound(GLOBAL, form.id), this::asListHtml);
|
||||
}
|
||||
if (!form.jarFile.getFileName().endsWith(".jar")) {
|
||||
throwValidationError(messages -> messages.addErrorsFileIsNotSupported(GLOBAL, form.jarFile.getFileName()),
|
||||
() -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsFileIsNotSupported(GLOBAL, form.jarFile.getFileName()), this::asListHtml);
|
||||
}
|
||||
final String filename = form.jarFile.getFileName();
|
||||
final File tempFile = ComponentUtil.getSystemHelper().createTempFile("tmp-adminplugin-", ".jar");
|
||||
|
@ -99,7 +98,7 @@ public class AdminPluginAction extends FessAdminAction {
|
|||
logger.warn("Failed to delete {}.", tempFile.getAbsolutePath());
|
||||
}
|
||||
logger.debug("Failed to copy {}", filename, e);
|
||||
throwValidationError(messages -> messages.addErrorsFailedToInstallPlugin(GLOBAL, filename), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsFailedToInstallPlugin(GLOBAL, filename), this::asListHtml);
|
||||
}
|
||||
new Thread(() -> {
|
||||
try {
|
||||
|
@ -119,7 +118,7 @@ public class AdminPluginAction extends FessAdminAction {
|
|||
} else {
|
||||
final Artifact artifact = getArtifactFromInstallForm(form);
|
||||
if (artifact == null) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), this::asListHtml);
|
||||
}
|
||||
installArtifact(artifact);
|
||||
saveInfo(messages -> messages.addSuccessInstallPlugin(GLOBAL, artifact.getFileName()));
|
||||
|
|
|
@ -132,12 +132,12 @@ public class AdminRelatedcontentAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public HtmlResponse edit(final EditForm form) {
|
||||
validate(form, messages -> {}, () -> asListHtml());
|
||||
validate(form, messages -> {}, this::asListHtml);
|
||||
final String id = form.id;
|
||||
relatedContentService.getRelatedContent(id).ifPresent(entity -> {
|
||||
copyBeanToBean(entity, form, op -> {});
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
saveToken();
|
||||
if (form.crudMode.intValue() == CrudMode.EDIT) {
|
||||
|
@ -166,7 +166,7 @@ public class AdminRelatedcontentAction extends FessAdminAction {
|
|||
});
|
||||
form.crudMode = crudMode;
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -179,8 +179,8 @@ public class AdminRelatedcontentAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse create(final CreateForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.CREATE);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getRelatedContent(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -188,10 +188,10 @@ public class AdminRelatedcontentAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -200,8 +200,8 @@ public class AdminRelatedcontentAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse update(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.EDIT);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getRelatedContent(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -209,10 +209,10 @@ public class AdminRelatedcontentAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -221,8 +221,8 @@ public class AdminRelatedcontentAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
final String id = form.id;
|
||||
relatedContentService
|
||||
.getRelatedContent(id)
|
||||
|
@ -234,10 +234,10 @@ public class AdminRelatedcontentAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asDetailsHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ public class AdminRelatedcontentAction extends FessAdminAction {
|
|||
if (crudMode != expectedMode) {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode));
|
||||
}, () -> asListHtml());
|
||||
}, this::asListHtml);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ public class AdminRelatedqueryAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public HtmlResponse edit(final EditForm form) {
|
||||
validate(form, messages -> {}, () -> asListHtml());
|
||||
validate(form, messages -> {}, this::asListHtml);
|
||||
final String id = form.id;
|
||||
relatedQueryService
|
||||
.getRelatedQuery(id)
|
||||
|
@ -153,7 +153,7 @@ public class AdminRelatedqueryAction extends FessAdminAction {
|
|||
stream(entity.getQueries()).get(
|
||||
stream -> stream.filter(StringUtil::isNotBlank).collect(Collectors.joining("\n")));
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
saveToken();
|
||||
if (form.crudMode.intValue() == CrudMode.EDIT) {
|
||||
|
@ -194,7 +194,7 @@ public class AdminRelatedqueryAction extends FessAdminAction {
|
|||
})
|
||||
.orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id),
|
||||
() -> asListHtml());
|
||||
this::asListHtml);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -207,8 +207,8 @@ public class AdminRelatedqueryAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse create(final CreateForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.CREATE);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getRelatedQuery(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -216,10 +216,10 @@ public class AdminRelatedqueryAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -228,8 +228,8 @@ public class AdminRelatedqueryAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse update(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.EDIT);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getRelatedQuery(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -237,10 +237,10 @@ public class AdminRelatedqueryAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -249,8 +249,8 @@ public class AdminRelatedqueryAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
final String id = form.id;
|
||||
relatedQueryService
|
||||
.getRelatedQuery(id)
|
||||
|
@ -262,10 +262,10 @@ public class AdminRelatedqueryAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asDetailsHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -316,7 +316,7 @@ public class AdminRelatedqueryAction extends FessAdminAction {
|
|||
if (crudMode != expectedMode) {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode));
|
||||
}, () -> asListHtml());
|
||||
}, this::asListHtml);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -145,12 +145,12 @@ public class AdminReqheaderAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public HtmlResponse edit(final EditForm form) {
|
||||
validate(form, messages -> {}, () -> asListHtml());
|
||||
validate(form, messages -> {}, this::asListHtml);
|
||||
final String id = form.id;
|
||||
requestHeaderService.getRequestHeader(id).ifPresent(entity -> {
|
||||
copyBeanToBean(entity, form, op -> {});
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
saveToken();
|
||||
if (form.crudMode.intValue() == CrudMode.EDIT) {
|
||||
|
@ -179,7 +179,7 @@ public class AdminReqheaderAction extends FessAdminAction {
|
|||
});
|
||||
form.crudMode = crudMode;
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -192,8 +192,8 @@ public class AdminReqheaderAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse create(final CreateForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.CREATE);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getRequestHeader(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -201,10 +201,10 @@ public class AdminReqheaderAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -213,8 +213,8 @@ public class AdminReqheaderAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse update(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.EDIT);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getRequestHeader(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -222,10 +222,10 @@ public class AdminReqheaderAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -234,8 +234,8 @@ public class AdminReqheaderAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
final String id = form.id;
|
||||
requestHeaderService
|
||||
.getRequestHeader(id)
|
||||
|
@ -247,10 +247,10 @@ public class AdminReqheaderAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asDetailsHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -312,7 +312,7 @@ public class AdminReqheaderAction extends FessAdminAction {
|
|||
if (crudMode != expectedMode) {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode));
|
||||
}, () -> asListHtml());
|
||||
}, this::asListHtml);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ public class AdminRoleAction extends FessAdminAction {
|
|||
});
|
||||
form.crudMode = crudMode;
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -163,8 +163,8 @@ public class AdminRoleAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse create(final CreateForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.CREATE);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getRole(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -173,10 +173,10 @@ public class AdminRoleAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
logger.error("Failed to add " + entity, e);
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -185,8 +185,8 @@ public class AdminRoleAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
final String id = form.id;
|
||||
roleService.getRole(id).ifPresent(entity -> {
|
||||
try {
|
||||
|
@ -194,10 +194,10 @@ public class AdminRoleAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
logger.error("Failed to delete " + entity, e);
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asDetailsHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asDetailsHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ public class AdminRoleAction extends FessAdminAction {
|
|||
if (crudMode != expectedMode) {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode));
|
||||
}, () -> asListHtml());
|
||||
}, this::asListHtml);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -170,12 +170,12 @@ public class AdminSchedulerAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public HtmlResponse edit(final EditForm form) {
|
||||
validate(form, messages -> {}, () -> asListHtml());
|
||||
validate(form, messages -> {}, this::asListHtml);
|
||||
final String id = form.id;
|
||||
scheduledJobService.getScheduledJob(id).ifPresent(entity -> {
|
||||
loadScheduledJob(form, entity);
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
saveToken();
|
||||
if (form.crudMode.intValue() == CrudMode.EDIT) {
|
||||
|
@ -208,7 +208,7 @@ public class AdminSchedulerAction extends FessAdminAction {
|
|||
request.setAttribute("enabled", entity.isEnabled());
|
||||
});
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -221,8 +221,8 @@ public class AdminSchedulerAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse create(final CreateForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.CREATE);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getScheduledJob(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -230,10 +230,10 @@ public class AdminSchedulerAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -242,8 +242,8 @@ public class AdminSchedulerAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse update(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.EDIT);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getScheduledJob(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -251,10 +251,10 @@ public class AdminSchedulerAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ public class AdminSchedulerAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml(id));
|
||||
|
@ -388,7 +388,7 @@ public class AdminSchedulerAction extends FessAdminAction {
|
|||
if (crudMode != expectedMode) {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode));
|
||||
}, () -> asListHtml());
|
||||
}, this::asListHtml);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ public class AdminSearchlistAction extends FessAdminAction {
|
|||
}
|
||||
|
||||
protected HtmlResponse doSearch(final ListForm form) {
|
||||
validate(form, messages -> {}, () -> asListHtml());
|
||||
validate(form, messages -> {}, this::asListHtml);
|
||||
|
||||
if (StringUtil.isBlank(form.q)) {
|
||||
// query matches on all documents.
|
||||
|
@ -147,15 +147,15 @@ public class AdminSearchlistAction extends FessAdminAction {
|
|||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(e.getMessage(), e);
|
||||
}
|
||||
throwValidationError(e.getMessageCode(), () -> asListHtml());
|
||||
throwValidationError(e.getMessageCode(), this::asListHtml);
|
||||
} catch (final ResultOffsetExceededException e) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(e.getMessage(), e);
|
||||
}
|
||||
throwValidationError(messages -> messages.addErrorsResultSizeExceeded(GLOBAL), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsResultSizeExceeded(GLOBAL), this::asListHtml);
|
||||
}
|
||||
|
||||
throwValidationError(messages -> messages.addErrorsInvalidQueryUnknown(GLOBAL), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsInvalidQueryUnknown(GLOBAL), this::asListHtml);
|
||||
return null; // ignore
|
||||
}
|
||||
|
||||
|
@ -207,15 +207,15 @@ public class AdminSearchlistAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final DeleteForm form) {
|
||||
validate(form, messages -> {}, () -> asListHtml());
|
||||
verifyToken(() -> asListHtml());
|
||||
validate(form, messages -> {}, this::asListHtml);
|
||||
verifyToken(this::asListHtml);
|
||||
final String docId = form.docId;
|
||||
try {
|
||||
final QueryBuilder query = QueryBuilders.termQuery(fessConfig.getIndexFieldDocId(), docId);
|
||||
fessEsClient.deleteByQuery(fessConfig.getIndexDocumentUpdateIndex(), query);
|
||||
saveInfo(messages -> messages.addSuccessDeleteDocFromIndex(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDeleteDocInAdmin(GLOBAL), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsFailedToDeleteDocInAdmin(GLOBAL), this::asListHtml);
|
||||
}
|
||||
return asListHtml();
|
||||
}
|
||||
|
@ -223,8 +223,8 @@ public class AdminSearchlistAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE, ROLE + VIEW })
|
||||
public HtmlResponse deleteall(final ListForm form) {
|
||||
validate(form, messages -> {}, () -> asListHtml());
|
||||
verifyToken(() -> asListHtml());
|
||||
validate(form, messages -> {}, this::asListHtml);
|
||||
verifyToken(this::asListHtml);
|
||||
try {
|
||||
searchHelper.deleteByQuery(request, form);
|
||||
saveInfo(messages -> messages.addSuccessDeleteDocFromIndex(GLOBAL));
|
||||
|
@ -232,7 +232,7 @@ public class AdminSearchlistAction extends FessAdminAction {
|
|||
if (logger.isDebugEnabled()) {
|
||||
logger.debug(e.getMessage(), e);
|
||||
}
|
||||
throwValidationError(e.getMessageCode(), () -> asListHtml());
|
||||
throwValidationError(e.getMessageCode(), this::asListHtml);
|
||||
}
|
||||
return asListHtml();
|
||||
}
|
||||
|
@ -252,14 +252,14 @@ public class AdminSearchlistAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public HtmlResponse edit(final EditForm form) {
|
||||
validate(form, messages -> {}, () -> asListHtml());
|
||||
validate(form, messages -> {}, this::asListHtml);
|
||||
getDoc(form).ifPresent(entity -> {
|
||||
form.doc = fessConfig.convertToEditableDoc(entity);
|
||||
form.id = (String) entity.remove(fessConfig.getIndexFieldId());
|
||||
form.seqNo = (Long) entity.remove(fessConfig.getIndexFieldSeqNo());
|
||||
form.primaryTerm = (Long) entity.remove(fessConfig.getIndexFieldPrimaryTerm());
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), this::asListHtml);
|
||||
});
|
||||
saveToken();
|
||||
return asEditHtml();
|
||||
|
@ -269,9 +269,9 @@ public class AdminSearchlistAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse create(final CreateForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.CREATE);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
validateFields(form, v -> throwValidationError(v, () -> asEditHtml()));
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
validateFields(form, v -> throwValidationError(v, this::asEditHtml));
|
||||
verifyToken(this::asEditHtml);
|
||||
getDoc(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -286,10 +286,10 @@ public class AdminSearchlistAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
logger.error("Failed to add " + entity, e);
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -298,9 +298,9 @@ public class AdminSearchlistAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse update(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.EDIT);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
validateFields(form, v -> throwValidationError(v, () -> asEditHtml()));
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
validateFields(form, v -> throwValidationError(v, this::asEditHtml));
|
||||
verifyToken(this::asEditHtml);
|
||||
getDoc(form).ifPresent(
|
||||
entity -> {
|
||||
final String index = fessConfig.getIndexDocumentUpdateIndex();
|
||||
|
@ -324,10 +324,10 @@ public class AdminSearchlistAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
logger.error("Failed to update " + entity, e);
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), this::asEditHtml);
|
||||
});
|
||||
return redirectWith(getClass(), moreUrl("search").params("q", URLUtil.encode(form.q, Constants.UTF_8)));
|
||||
}
|
||||
|
@ -380,7 +380,7 @@ public class AdminSearchlistAction extends FessAdminAction {
|
|||
if (crudMode != expectedMode) {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode));
|
||||
}, () -> asListHtml());
|
||||
}, this::asListHtml);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -149,8 +149,8 @@ public class AdminSearchlogAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
searchLogService.getSearchLog(form.logType, form.id).alwaysPresent(e -> {
|
||||
searchLogService.deleteSearchLog(e);
|
||||
saveInfo(messages -> messages.addSuccessCrudDeleteCrudTable(GLOBAL));
|
||||
|
|
|
@ -159,12 +159,12 @@ public class AdminUserAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public HtmlResponse edit(final EditForm form) {
|
||||
validate(form, messages -> {}, () -> asListHtml());
|
||||
validate(form, messages -> {}, this::asListHtml);
|
||||
final String id = form.id;
|
||||
userService.getUser(id).ifPresent(entity -> {
|
||||
copyBeanToBean(entity, form, op -> {});
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
resetPassword(form);
|
||||
saveToken();
|
||||
|
@ -194,7 +194,7 @@ public class AdminUserAction extends FessAdminAction {
|
|||
});
|
||||
form.crudMode = crudMode;
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
resetPassword(form);
|
||||
});
|
||||
|
@ -210,10 +210,10 @@ public class AdminUserAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse create(final CreateForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.CREATE);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
validateAttributes(form.attributes, v -> throwValidationError(v, () -> asEditHtml()));
|
||||
verifyPassword(form, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
validateAttributes(form.attributes, v -> throwValidationError(v, this::asEditHtml));
|
||||
verifyPassword(form, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getUser(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -222,10 +222,10 @@ public class AdminUserAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
logger.error("Failed to add " + entity, e);
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -234,10 +234,10 @@ public class AdminUserAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse update(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.EDIT);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
validateAttributes(form.attributes, v -> throwValidationError(v, () -> asEditHtml()));
|
||||
verifyPassword(form, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
validateAttributes(form.attributes, v -> throwValidationError(v, this::asEditHtml));
|
||||
verifyPassword(form, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getUser(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -246,10 +246,10 @@ public class AdminUserAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
logger.error("Failed to update " + entity, e);
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -258,13 +258,13 @@ public class AdminUserAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
getUserBean().ifPresent(u -> {
|
||||
if (u.getFessUser() instanceof User && form.name.equals(u.getUserId())) {
|
||||
throwValidationError(messages -> messages.addErrorsCouldNotDeleteLoggedInUser(GLOBAL), () -> asDetailsHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCouldNotDeleteLoggedInUser(GLOBAL), this::asDetailsHtml);
|
||||
}
|
||||
});
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
verifyToken(this::asDetailsHtml);
|
||||
final String id = form.id;
|
||||
userService
|
||||
.getUser(id)
|
||||
|
@ -277,10 +277,10 @@ public class AdminUserAction extends FessAdminAction {
|
|||
logger.error("Failed to delete " + entity, e);
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asDetailsHtml());
|
||||
this::asDetailsHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asDetailsHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -334,7 +334,7 @@ public class AdminUserAction extends FessAdminAction {
|
|||
if (crudMode != expectedMode) {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode));
|
||||
}, () -> asListHtml());
|
||||
}, this::asListHtml);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -145,12 +145,12 @@ public class AdminWebauthAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public HtmlResponse edit(final EditForm form) {
|
||||
validate(form, messages -> {}, () -> asListHtml());
|
||||
validate(form, messages -> {}, this::asListHtml);
|
||||
final String id = form.id;
|
||||
webAuthenticationService.getWebAuthentication(id).ifPresent(entity -> {
|
||||
copyBeanToBean(entity, form, op -> {});
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
saveToken();
|
||||
if (form.crudMode.intValue() == CrudMode.EDIT) {
|
||||
|
@ -179,7 +179,7 @@ public class AdminWebauthAction extends FessAdminAction {
|
|||
});
|
||||
form.crudMode = crudMode;
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
});
|
||||
}).renderWith(data -> {
|
||||
|
@ -195,8 +195,8 @@ public class AdminWebauthAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse create(final CreateForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.CREATE);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getWebAuthentication(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -204,10 +204,10 @@ public class AdminWebauthAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -216,8 +216,8 @@ public class AdminWebauthAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse update(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.EDIT);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getWebAuthentication(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -225,10 +225,10 @@ public class AdminWebauthAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -237,8 +237,8 @@ public class AdminWebauthAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
final String id = form.id;
|
||||
webAuthenticationService
|
||||
.getWebAuthentication(id)
|
||||
|
@ -250,10 +250,10 @@ public class AdminWebauthAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asDetailsHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ public class AdminWebauthAction extends FessAdminAction {
|
|||
if (crudMode != expectedMode) {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode));
|
||||
}, () -> asListHtml());
|
||||
}, this::asListHtml);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ public class AdminWebconfigAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public HtmlResponse edit(final EditForm form) {
|
||||
validate(form, messages -> {}, () -> asListHtml());
|
||||
validate(form, messages -> {}, this::asListHtml);
|
||||
final String id = form.id;
|
||||
webConfigService
|
||||
.getWebConfig(id)
|
||||
|
@ -170,7 +170,7 @@ public class AdminWebconfigAction extends FessAdminAction {
|
|||
stream -> stream.filter(StringUtil::isNotBlank).map(String::trim)
|
||||
.collect(Collectors.joining("\n")));
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asListHtml);
|
||||
});
|
||||
saveToken();
|
||||
if (form.crudMode.intValue() == CrudMode.EDIT) {
|
||||
|
@ -217,7 +217,7 @@ public class AdminWebconfigAction extends FessAdminAction {
|
|||
})
|
||||
.orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id),
|
||||
() -> asListHtml());
|
||||
this::asListHtml);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -230,8 +230,8 @@ public class AdminWebconfigAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse create(final CreateForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.CREATE);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getWebConfig(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -239,10 +239,10 @@ public class AdminWebconfigAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudCreateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -251,8 +251,8 @@ public class AdminWebconfigAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse update(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.EDIT);
|
||||
validate(form, messages -> {}, () -> asEditHtml());
|
||||
verifyToken(() -> asEditHtml());
|
||||
validate(form, messages -> {}, this::asEditHtml);
|
||||
verifyToken(this::asEditHtml);
|
||||
getWebConfig(form).ifPresent(
|
||||
entity -> {
|
||||
try {
|
||||
|
@ -260,10 +260,10 @@ public class AdminWebconfigAction extends FessAdminAction {
|
|||
saveInfo(messages -> messages.addSuccessCrudUpdateCrudTable(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationError(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), () -> asEditHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, form.id), this::asEditHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -272,8 +272,8 @@ public class AdminWebconfigAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse delete(final EditForm form) {
|
||||
verifyCrudMode(form.crudMode, CrudMode.DETAILS);
|
||||
validate(form, messages -> {}, () -> asDetailsHtml());
|
||||
verifyToken(() -> asDetailsHtml());
|
||||
validate(form, messages -> {}, this::asDetailsHtml);
|
||||
verifyToken(this::asDetailsHtml);
|
||||
final String id = form.id;
|
||||
webConfigService
|
||||
.getWebConfig(id)
|
||||
|
@ -285,10 +285,10 @@ public class AdminWebconfigAction extends FessAdminAction {
|
|||
} catch (final Exception e) {
|
||||
throwValidationError(
|
||||
messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)),
|
||||
() -> asEditHtml());
|
||||
this::asEditHtml);
|
||||
}
|
||||
}).orElse(() -> {
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asDetailsHtml());
|
||||
throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), this::asDetailsHtml);
|
||||
});
|
||||
return redirect(getClass());
|
||||
}
|
||||
|
@ -351,7 +351,7 @@ public class AdminWebconfigAction extends FessAdminAction {
|
|||
if (crudMode != expectedMode) {
|
||||
throwValidationError(messages -> {
|
||||
messages.addErrorsCrudInvalidMode(GLOBAL, String.valueOf(expectedMode), String.valueOf(crudMode));
|
||||
}, () -> asListHtml());
|
||||
}, this::asListHtml);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ public class AdminWizardAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse crawlingConfig(final CrawlingConfigForm form) {
|
||||
validate(form, messages -> {}, () -> asHtml(path_AdminWizard_AdminWizardConfigJsp));
|
||||
verifyTokenKeep(() -> asIndexHtml());
|
||||
verifyTokenKeep(this::asIndexHtml);
|
||||
final String name = crawlingConfigInternal(form);
|
||||
saveInfo(messages -> messages.addSuccessCreateCrawlingConfigAtWizard(GLOBAL, name));
|
||||
return redirectWith(getClass(), moreUrl("crawlingConfigForm"));
|
||||
|
@ -120,7 +120,7 @@ public class AdminWizardAction extends FessAdminAction {
|
|||
@Secured({ ROLE })
|
||||
public HtmlResponse crawlingConfigNext(final CrawlingConfigForm form) {
|
||||
validate(form, messages -> {}, () -> asHtml(path_AdminWizard_AdminWizardConfigJsp));
|
||||
verifyToken(() -> asIndexHtml());
|
||||
verifyToken(this::asIndexHtml);
|
||||
final String name = crawlingConfigInternal(form);
|
||||
saveInfo(messages -> messages.addSuccessCreateCrawlingConfigAtWizard(GLOBAL, name));
|
||||
return redirectWith(getClass(), moreUrl("startCrawlingForm"));
|
||||
|
@ -288,7 +288,7 @@ public class AdminWizardAction extends FessAdminAction {
|
|||
@Execute
|
||||
@Secured({ ROLE })
|
||||
public HtmlResponse startCrawling(final StartCrawlingForm form) {
|
||||
verifyToken(() -> asIndexHtml());
|
||||
verifyToken(this::asIndexHtml);
|
||||
if (!processHelper.isProcessRunning()) {
|
||||
final List<ScheduledJob> scheduledJobList = scheduledJobService.getCrawlerJobList();
|
||||
final JobManager jobManager = ComponentUtil.getJobManager();
|
||||
|
|
|
@ -59,19 +59,17 @@ public class ApiAdminAccesstokenAction extends FessApiAdminAction {
|
|||
validateApi(body, messages -> {});
|
||||
final AccessTokenPager pager = copyBeanToNewBean(body, AccessTokenPager.class);
|
||||
final List<AccessToken> list = accessTokenService.getAccessTokenList(pager);
|
||||
return asJson(new ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
return asJson(new ApiConfigsResponse<EditBody>().settings(list.stream().map(this::createEditBody).collect(Collectors.toList()))
|
||||
.total(pager.getAllRecordCount()).status(Status.OK).result());
|
||||
}
|
||||
|
||||
// GET /api/admin/accesstoken/setting/{id}
|
||||
@Execute
|
||||
public JsonResponse<ApiResult> get$setting(final String id) {
|
||||
return asJson(new ApiConfigResponse()
|
||||
.setting(accessTokenService.getAccessToken(id).map(entity -> createEditBody(entity)).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
return asJson(new ApiConfigResponse().setting(accessTokenService.getAccessToken(id).map(this::createEditBody).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
}
|
||||
|
||||
// PUT /api/admin/accesstoken/setting
|
||||
|
|
|
@ -64,8 +64,8 @@ public class ApiAdminBadwordAction extends FessApiAdminAction {
|
|||
final BadWordPager pager = copyBeanToNewBean(body, BadWordPager.class);
|
||||
final List<BadWord> list = badWordService.getBadWordList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
.total(pager.getAllRecordCount()).status(ApiResult.Status.OK).result());
|
||||
.settings(list.stream().map(this::createEditBody).collect(Collectors.toList())).total(pager.getAllRecordCount())
|
||||
.status(ApiResult.Status.OK).result());
|
||||
}
|
||||
|
||||
// GET /api/admin/badword/{id}
|
||||
|
|
|
@ -59,8 +59,7 @@ public class ApiAdminBoostdocAction extends FessApiAdminAction {
|
|||
validateApi(body, messages -> {});
|
||||
final BoostDocPager pager = copyBeanToNewBean(body, BoostDocPager.class);
|
||||
final List<BoostDocumentRule> list = boostDocumentRuleService.getBoostDocumentRuleList(pager);
|
||||
return asJson(new ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
return asJson(new ApiConfigsResponse<EditBody>().settings(list.stream().map(this::createEditBody).collect(Collectors.toList()))
|
||||
.total(pager.getAllRecordCount()).status(Status.OK).result());
|
||||
}
|
||||
|
||||
|
@ -68,7 +67,7 @@ public class ApiAdminBoostdocAction extends FessApiAdminAction {
|
|||
@Execute
|
||||
public JsonResponse<ApiResult> get$setting(final String id) {
|
||||
return asJson(new ApiConfigResponse()
|
||||
.setting(boostDocumentRuleService.getBoostDocumentRule(id).map(entity -> createEditBody(entity)).orElseGet(() -> {
|
||||
.setting(boostDocumentRuleService.getBoostDocumentRule(id).map(this::createEditBody).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
|
|
|
@ -56,19 +56,17 @@ public class ApiAdminCrawlinginfoAction extends FessApiAdminAction {
|
|||
validateApi(body, messages -> {});
|
||||
final CrawlingInfoPager pager = copyBeanToNewBean(body, CrawlingInfoPager.class);
|
||||
final List<CrawlingInfo> list = crawlingInfoService.getCrawlingInfoList(pager);
|
||||
return asJson(new ApiResult.ApiLogsResponse<EditBody>()
|
||||
.logs(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList())).total(pager.getAllRecordCount())
|
||||
.status(ApiResult.Status.OK).result());
|
||||
return asJson(new ApiResult.ApiLogsResponse<EditBody>().logs(list.stream().map(this::createEditBody).collect(Collectors.toList()))
|
||||
.total(pager.getAllRecordCount()).status(ApiResult.Status.OK).result());
|
||||
}
|
||||
|
||||
// GET /api/admin/crawlinginfo/log/{id}
|
||||
@Execute
|
||||
public JsonResponse<ApiResult> get$log(final String id) {
|
||||
return asJson(new ApiLogResponse()
|
||||
.log(crawlingInfoService.getCrawlingInfo(id).map(entity -> createEditBody(entity)).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
return asJson(new ApiLogResponse().log(crawlingInfoService.getCrawlingInfo(id).map(this::createEditBody).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
}
|
||||
|
||||
// DELETE /api/admin/crawlinginfo/log/{id}
|
||||
|
|
|
@ -63,18 +63,17 @@ public class ApiAdminDataconfigAction extends FessApiAdminAction {
|
|||
final DataConfigPager pager = copyBeanToNewBean(body, DataConfigPager.class);
|
||||
final List<DataConfig> list = dataConfigService.getDataConfigList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
.total(pager.getAllRecordCount()).status(ApiResult.Status.OK).result());
|
||||
.settings(list.stream().map(this::createEditBody).collect(Collectors.toList())).total(pager.getAllRecordCount())
|
||||
.status(ApiResult.Status.OK).result());
|
||||
}
|
||||
|
||||
// GET /api/admin/dataconfig/setting/{id}
|
||||
@Execute
|
||||
public JsonResponse<ApiResult> get$setting(final String id) {
|
||||
return asJson(new ApiConfigResponse()
|
||||
.setting(dataConfigService.getDataConfig(id).map(entity -> createEditBody(entity)).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
return asJson(new ApiConfigResponse().setting(dataConfigService.getDataConfig(id).map(this::createEditBody).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
}
|
||||
|
||||
// PUT /api/admin/dataconfig/setting
|
||||
|
|
|
@ -37,8 +37,7 @@ public class ApiAdminDictAction extends FessApiAdminAction {
|
|||
public JsonResponse<ApiResult> get$index() {
|
||||
final DictionaryFile<? extends DictionaryItem>[] dictFiles = dictionaryManager.getDictionaryFiles();
|
||||
return asJson(new ApiResult.ApiConfigsResponse<ListBody>()
|
||||
.settings(Stream.of(dictFiles).map(dictionaryFile -> createListBody(dictionaryFile)).collect(Collectors.toList()))
|
||||
.status(ApiResult.Status.OK).result());
|
||||
.settings(Stream.of(dictFiles).map(this::createListBody).collect(Collectors.toList())).status(ApiResult.Status.OK).result());
|
||||
}
|
||||
|
||||
protected ListBody createListBody(final DictionaryFile<? extends DictionaryItem> dictionaryFile) {
|
||||
|
|
|
@ -58,18 +58,17 @@ public class ApiAdminDuplicatehostAction extends FessApiAdminAction {
|
|||
final DuplicateHostPager pager = copyBeanToNewBean(body, DuplicateHostPager.class);
|
||||
final List<DuplicateHost> list = duplicateHostService.getDuplicateHostList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
.total(pager.getAllRecordCount()).status(ApiResult.Status.OK).result());
|
||||
.settings(list.stream().map(this::createEditBody).collect(Collectors.toList())).total(pager.getAllRecordCount())
|
||||
.status(ApiResult.Status.OK).result());
|
||||
}
|
||||
|
||||
// GET /api/admin/duplicatehost/setting/{id}
|
||||
@Execute
|
||||
public JsonResponse<ApiResult> get$setting(final String id) {
|
||||
return asJson(new ApiConfigResponse()
|
||||
.setting(duplicateHostService.getDuplicateHost(id).map(entity -> createEditBody(entity)).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
return asJson(new ApiConfigResponse().setting(duplicateHostService.getDuplicateHost(id).map(this::createEditBody).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
}
|
||||
|
||||
// PUT /api/admin/duplicatehost/setting
|
||||
|
|
|
@ -68,8 +68,8 @@ public class ApiAdminElevatewordAction extends FessApiAdminAction {
|
|||
final ElevateWordPager pager = copyBeanToNewBean(body, ElevateWordPager.class);
|
||||
final List<ElevateWord> list = elevateWordService.getElevateWordList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
.total(pager.getAllRecordCount()).status(ApiResult.Status.OK).result());
|
||||
.settings(list.stream().map(this::createEditBody).collect(Collectors.toList())).total(pager.getAllRecordCount())
|
||||
.status(ApiResult.Status.OK).result());
|
||||
}
|
||||
|
||||
// GET /api/admin/elevateword/{id}
|
||||
|
|
|
@ -58,15 +58,14 @@ public class ApiAdminFailureurlAction extends FessApiAdminAction {
|
|||
validateApi(body, messages -> {});
|
||||
final FailureUrlPager pager = copyBeanToNewBean(body, FailureUrlPager.class);
|
||||
final List<FailureUrl> list = failureUrlService.getFailureUrlList(pager);
|
||||
return asJson(new ApiResult.ApiLogsResponse<EditBody>()
|
||||
.logs(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList())).total(pager.getAllRecordCount())
|
||||
.status(ApiResult.Status.OK).result());
|
||||
return asJson(new ApiResult.ApiLogsResponse<EditBody>().logs(list.stream().map(this::createEditBody).collect(Collectors.toList()))
|
||||
.total(pager.getAllRecordCount()).status(ApiResult.Status.OK).result());
|
||||
}
|
||||
|
||||
// GET /api/admin/failureurl/log/{id}
|
||||
@Execute
|
||||
public JsonResponse<ApiResult> get$log(final String id) {
|
||||
return asJson(new ApiLogResponse().log(failureUrlService.getFailureUrl(id).map(entity -> createEditBody(entity)).orElseGet(() -> {
|
||||
return asJson(new ApiLogResponse().log(failureUrlService.getFailureUrl(id).map(this::createEditBody).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
|
|
|
@ -62,18 +62,17 @@ public class ApiAdminFileauthAction extends FessApiAdminAction {
|
|||
final FileAuthPager pager = copyBeanToNewBean(body, FileAuthPager.class);
|
||||
final List<FileAuthentication> list = fileAuthService.getFileAuthenticationList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
.total(pager.getAllRecordCount()).status(ApiResult.Status.OK).result());
|
||||
.settings(list.stream().map(this::createEditBody).collect(Collectors.toList())).total(pager.getAllRecordCount())
|
||||
.status(ApiResult.Status.OK).result());
|
||||
}
|
||||
|
||||
// GET /api/admin/fileauth/setting/{id}
|
||||
@Execute
|
||||
public JsonResponse<ApiResult> get$setting(final String id) {
|
||||
return asJson(new ApiConfigResponse()
|
||||
.setting(fileAuthService.getFileAuthentication(id).map(entity -> createEditBody(entity)).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
return asJson(new ApiConfigResponse().setting(fileAuthService.getFileAuthentication(id).map(this::createEditBody).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
}
|
||||
|
||||
// PUT /api/admin/fileauth/setting
|
||||
|
|
|
@ -63,18 +63,17 @@ public class ApiAdminFileconfigAction extends FessApiAdminAction {
|
|||
final FileConfigPager pager = copyBeanToNewBean(body, FileConfigPager.class);
|
||||
final List<FileConfig> list = fileConfigService.getFileConfigList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
.total(pager.getAllRecordCount()).status(ApiResult.Status.OK).result());
|
||||
.settings(list.stream().map(this::createEditBody).collect(Collectors.toList())).total(pager.getAllRecordCount())
|
||||
.status(ApiResult.Status.OK).result());
|
||||
}
|
||||
|
||||
// GET /api/admin/fileconfig/setting/{id}
|
||||
@Execute
|
||||
public JsonResponse<ApiResult> get$setting(final String id) {
|
||||
return asJson(new ApiConfigResponse()
|
||||
.setting(fileConfigService.getFileConfig(id).map(entity -> createEditBody(entity)).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
return asJson(new ApiConfigResponse().setting(fileConfigService.getFileConfig(id).map(this::createEditBody).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
}
|
||||
|
||||
// PUT /api/admin/fileconfig/setting
|
||||
|
|
|
@ -46,25 +46,24 @@ public class ApiAdminGroupAction extends FessApiAdminAction {
|
|||
final GroupPager pager = copyBeanToNewBean(body, GroupPager.class);
|
||||
final List<Group> list = groupService.getGroupList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
.total(pager.getAllRecordCount()).status(ApiResult.Status.OK).result());
|
||||
.settings(list.stream().map(this::createEditBody).collect(Collectors.toList())).total(pager.getAllRecordCount())
|
||||
.status(ApiResult.Status.OK).result());
|
||||
}
|
||||
|
||||
// GET /api/admin/group/setting/{id}
|
||||
@Execute
|
||||
public JsonResponse<ApiResult> get$setting(final String id) {
|
||||
return asJson(new ApiResult.ApiConfigResponse()
|
||||
.setting(groupService.getGroup(id).map(entity -> createEditBody(entity)).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(ApiResult.Status.OK).result());
|
||||
return asJson(new ApiResult.ApiConfigResponse().setting(groupService.getGroup(id).map(this::createEditBody).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(ApiResult.Status.OK).result());
|
||||
}
|
||||
|
||||
// PUT /api/admin/group/setting
|
||||
@Execute
|
||||
public JsonResponse<ApiResult> put$setting(final CreateBody body) {
|
||||
validateApi(body, messages -> {});
|
||||
validateAttributes(body.attributes, v -> throwValidationErrorApi(v));
|
||||
validateAttributes(body.attributes, this::throwValidationErrorApi);
|
||||
body.crudMode = CrudMode.CREATE;
|
||||
final Group entity = getGroup(body).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> {
|
||||
|
@ -85,7 +84,7 @@ public class ApiAdminGroupAction extends FessApiAdminAction {
|
|||
@Execute
|
||||
public JsonResponse<ApiResult> post$setting(final EditBody body) {
|
||||
validateApi(body, messages -> {});
|
||||
validateAttributes(body.attributes, v -> throwValidationErrorApi(v));
|
||||
validateAttributes(body.attributes, this::throwValidationErrorApi);
|
||||
body.crudMode = CrudMode.EDIT;
|
||||
final Group entity = getGroup(body).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> {
|
||||
|
|
|
@ -52,15 +52,14 @@ public class ApiAdminJoblogAction extends FessApiAdminAction {
|
|||
validateApi(body, messages -> {});
|
||||
final JobLogPager pager = copyBeanToNewBean(body, JobLogPager.class);
|
||||
final List<JobLog> list = jobLogService.getJobLogList(pager);
|
||||
return asJson(new ApiResult.ApiLogsResponse<EditBody>()
|
||||
.logs(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList())).total(pager.getAllRecordCount())
|
||||
.status(ApiResult.Status.OK).result());
|
||||
return asJson(new ApiResult.ApiLogsResponse<EditBody>().logs(list.stream().map(this::createEditBody).collect(Collectors.toList()))
|
||||
.total(pager.getAllRecordCount()).status(ApiResult.Status.OK).result());
|
||||
}
|
||||
|
||||
// GET /api/admin/joblog/log/{id}
|
||||
@Execute
|
||||
public JsonResponse<ApiResult> get$log(final String id) {
|
||||
return asJson(new ApiLogResponse().log(jobLogService.getJobLog(id).map(entity -> createEditBody(entity)).orElseGet(() -> {
|
||||
return asJson(new ApiLogResponse().log(jobLogService.getJobLog(id).map(this::createEditBody).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
|
|
|
@ -58,18 +58,17 @@ public class ApiAdminKeymatchAction extends FessApiAdminAction {
|
|||
final KeyMatchPager pager = copyBeanToNewBean(body, KeyMatchPager.class);
|
||||
final List<KeyMatch> list = keyMatchService.getKeyMatchList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
.total(pager.getAllRecordCount()).status(ApiResult.Status.OK).result());
|
||||
.settings(list.stream().map(this::createEditBody).collect(Collectors.toList())).total(pager.getAllRecordCount())
|
||||
.status(ApiResult.Status.OK).result());
|
||||
}
|
||||
|
||||
// GET /api/admin/keymatch/setting/{id}
|
||||
@Execute
|
||||
public JsonResponse<ApiResult> get$setting(final String id) {
|
||||
return asJson(new ApiConfigResponse()
|
||||
.setting(keyMatchService.getKeyMatch(id).map(entity -> createEditBody(entity)).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
return asJson(new ApiConfigResponse().setting(keyMatchService.getKeyMatch(id).map(this::createEditBody).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
}
|
||||
|
||||
// PUT /api/admin/keymatch/setting
|
||||
|
|
|
@ -63,18 +63,17 @@ public class ApiAdminLabeltypeAction extends FessApiAdminAction {
|
|||
final LabelTypePager pager = copyBeanToNewBean(body, LabelTypePager.class);
|
||||
final List<LabelType> list = labelTypeService.getLabelTypeList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
.total(pager.getAllRecordCount()).status(ApiResult.Status.OK).result());
|
||||
.settings(list.stream().map(this::createEditBody).collect(Collectors.toList())).total(pager.getAllRecordCount())
|
||||
.status(ApiResult.Status.OK).result());
|
||||
}
|
||||
|
||||
// GET /api/admin/labeltype/setting/{id}
|
||||
@Execute
|
||||
public JsonResponse<ApiResult> get$setting(final String id) {
|
||||
return asJson(new ApiConfigResponse()
|
||||
.setting(labelTypeService.getLabelType(id).map(entity -> createEditBody(entity)).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
return asJson(new ApiConfigResponse().setting(labelTypeService.getLabelType(id).map(this::createEditBody).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
}
|
||||
|
||||
// PUT /api/admin/labeltype/setting
|
||||
|
|
|
@ -45,15 +45,15 @@ public class ApiAdminPathmapAction extends FessApiAdminAction {
|
|||
final PathMapPager pager = copyBeanToNewBean(body, PathMapPager.class);
|
||||
final List<PathMapping> list = pathMappingService.getPathMappingList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
.total(pager.getAllRecordCount()).status(ApiResult.Status.OK).result());
|
||||
.settings(list.stream().map(this::createEditBody).collect(Collectors.toList())).total(pager.getAllRecordCount())
|
||||
.status(ApiResult.Status.OK).result());
|
||||
}
|
||||
|
||||
// GET /api/admin/pathmap/setting/{id}
|
||||
@Execute
|
||||
public JsonResponse<ApiResult> get$setting(final String id) {
|
||||
return asJson(new ApiResult.ApiConfigResponse()
|
||||
.setting(pathMappingService.getPathMapping(id).map(entity -> createEditBody(entity)).orElseGet(() -> {
|
||||
.setting(pathMappingService.getPathMapping(id).map(this::createEditBody).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(ApiResult.Status.OK).result());
|
||||
|
|
|
@ -55,15 +55,15 @@ public class ApiAdminRelatedcontentAction extends FessApiAdminAction {
|
|||
final RelatedContentPager pager = copyBeanToNewBean(body, RelatedContentPager.class);
|
||||
final List<RelatedContent> list = relatedContentService.getRelatedContentList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
.total(pager.getAllRecordCount()).status(ApiResult.Status.OK).result());
|
||||
.settings(list.stream().map(this::createEditBody).collect(Collectors.toList())).total(pager.getAllRecordCount())
|
||||
.status(ApiResult.Status.OK).result());
|
||||
}
|
||||
|
||||
// GET /api/admin/relatedcontent/setting/{id}
|
||||
@Execute
|
||||
public JsonResponse<ApiResult> get$setting(final String id) {
|
||||
return asJson(new ApiConfigResponse()
|
||||
.setting(relatedContentService.getRelatedContent(id).map(entity -> createEditBody(entity)).orElseGet(() -> {
|
||||
.setting(relatedContentService.getRelatedContent(id).map(this::createEditBody).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
|
|
|
@ -58,18 +58,17 @@ public class ApiAdminRelatedqueryAction extends FessApiAdminAction {
|
|||
final RelatedQueryPager pager = copyBeanToNewBean(body, RelatedQueryPager.class);
|
||||
final List<RelatedQuery> list = relatedQueryService.getRelatedQueryList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
.total(pager.getAllRecordCount()).status(ApiResult.Status.OK).result());
|
||||
.settings(list.stream().map(this::createEditBody).collect(Collectors.toList())).total(pager.getAllRecordCount())
|
||||
.status(ApiResult.Status.OK).result());
|
||||
}
|
||||
|
||||
// GET /api/admin/relatedquery/setting/{id}
|
||||
@Execute
|
||||
public JsonResponse<ApiResult> get$setting(final String id) {
|
||||
return asJson(new ApiConfigResponse()
|
||||
.setting(relatedQueryService.getRelatedQuery(id).map(entity -> createEditBody(entity)).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
return asJson(new ApiConfigResponse().setting(relatedQueryService.getRelatedQuery(id).map(this::createEditBody).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
}
|
||||
|
||||
// PUT /api/admin/relatedquery/setting
|
||||
|
|
|
@ -62,18 +62,17 @@ public class ApiAdminReqheaderAction extends FessApiAdminAction {
|
|||
final ReqHeaderPager pager = copyBeanToNewBean(body, ReqHeaderPager.class);
|
||||
final List<RequestHeader> list = reqHeaderService.getRequestHeaderList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
.total(pager.getAllRecordCount()).status(ApiResult.Status.OK).result());
|
||||
.settings(list.stream().map(this::createEditBody).collect(Collectors.toList())).total(pager.getAllRecordCount())
|
||||
.status(ApiResult.Status.OK).result());
|
||||
}
|
||||
|
||||
// GET /api/admin/reqheader/setting/{id}
|
||||
@Execute
|
||||
public JsonResponse<ApiResult> get$setting(final String id) {
|
||||
return asJson(new ApiConfigResponse()
|
||||
.setting(reqHeaderService.getRequestHeader(id).map(entity -> createEditBody(entity)).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
return asJson(new ApiConfigResponse().setting(reqHeaderService.getRequestHeader(id).map(this::createEditBody).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
}
|
||||
|
||||
// PUT /api/admin/reqheader/setting
|
||||
|
|
|
@ -44,18 +44,17 @@ public class ApiAdminRoleAction extends FessApiAdminAction {
|
|||
final RolePager pager = copyBeanToNewBean(body, RolePager.class);
|
||||
final List<Role> list = roleService.getRoleList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
.total(pager.getAllRecordCount()).status(ApiResult.Status.OK).result());
|
||||
.settings(list.stream().map(this::createEditBody).collect(Collectors.toList())).total(pager.getAllRecordCount())
|
||||
.status(ApiResult.Status.OK).result());
|
||||
}
|
||||
|
||||
// GET /api/admin/role/setting/{id}
|
||||
@Execute
|
||||
public JsonResponse<ApiResult> get$setting(final String id) {
|
||||
return asJson(new ApiResult.ApiConfigResponse()
|
||||
.setting(roleService.getRole(id).map(entity -> createEditBody(entity)).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(ApiResult.Status.OK).result());
|
||||
return asJson(new ApiResult.ApiConfigResponse().setting(roleService.getRole(id).map(this::createEditBody).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(ApiResult.Status.OK).result());
|
||||
}
|
||||
|
||||
// PUT /api/admin/role/setting
|
||||
|
|
|
@ -96,15 +96,15 @@ public class ApiAdminSchedulerAction extends FessApiAdminAction {
|
|||
final SchedulerPager pager = copyBeanToNewBean(body, SchedulerPager.class);
|
||||
final List<ScheduledJob> list = scheduledJobService.getScheduledJobList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
.total(pager.getAllRecordCount()).status(ApiResult.Status.OK).result());
|
||||
.settings(list.stream().map(this::createEditBody).collect(Collectors.toList())).total(pager.getAllRecordCount())
|
||||
.status(ApiResult.Status.OK).result());
|
||||
}
|
||||
|
||||
// GET /api/admin/scheduler/setting/{id}
|
||||
@Execute
|
||||
public JsonResponse<ApiResult> get$setting(final String id) {
|
||||
return asJson(new ApiResult.ApiConfigResponse()
|
||||
.setting(scheduledJobService.getScheduledJob(id).map(entity -> createEditBody(entity)).orElseGet(() -> {
|
||||
.setting(scheduledJobService.getScheduledJob(id).map(this::createEditBody).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(ApiResult.Status.OK).result());
|
||||
|
|
|
@ -120,7 +120,7 @@ public class ApiAdminSearchlistAction extends FessApiAdminAction {
|
|||
if (body.doc == null) {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, "doc is required"));
|
||||
}
|
||||
validateFields(body, v -> throwValidationErrorApi(v));
|
||||
validateFields(body, this::throwValidationErrorApi);
|
||||
body.crudMode = CrudMode.CREATE;
|
||||
final Map<String, Object> doc = getDoc(body).map(entity -> {
|
||||
try {
|
||||
|
@ -152,7 +152,7 @@ public class ApiAdminSearchlistAction extends FessApiAdminAction {
|
|||
if (body.doc == null) {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, "doc is required"));
|
||||
}
|
||||
validateFields(body, v -> throwValidationErrorApi(v));
|
||||
validateFields(body, this::throwValidationErrorApi);
|
||||
body.crudMode = CrudMode.EDIT;
|
||||
final Map<String, Object> doc = getDoc(body).map(entity -> {
|
||||
final String index = fessConfig.getIndexDocumentUpdateIndex();
|
||||
|
|
|
@ -45,18 +45,17 @@ public class ApiAdminUserAction extends FessApiAdminAction {
|
|||
final UserPager pager = copyBeanToNewBean(body, UserPager.class);
|
||||
final List<User> list = userService.getUserList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
.total(pager.getAllRecordCount()).status(ApiResult.Status.OK).result());
|
||||
.settings(list.stream().map(this::createEditBody).collect(Collectors.toList())).total(pager.getAllRecordCount())
|
||||
.status(ApiResult.Status.OK).result());
|
||||
}
|
||||
|
||||
// GET /api/admin/user/setting/{id}
|
||||
@Execute
|
||||
public JsonResponse<ApiResult> get$setting(final String id) {
|
||||
return asJson(new ApiResult.ApiConfigResponse()
|
||||
.setting(userService.getUser(id).map(entity -> createEditBody(entity)).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(ApiResult.Status.OK).result());
|
||||
return asJson(new ApiResult.ApiConfigResponse().setting(userService.getUser(id).map(this::createEditBody).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(ApiResult.Status.OK).result());
|
||||
}
|
||||
|
||||
// PUT /api/admin/user/setting
|
||||
|
@ -83,7 +82,7 @@ public class ApiAdminUserAction extends FessApiAdminAction {
|
|||
@Execute
|
||||
public JsonResponse<ApiResult> post$setting(final EditBody body) {
|
||||
validateApi(body, messages -> {});
|
||||
validateAttributes(body.attributes, v -> throwValidationErrorApi(v));
|
||||
validateAttributes(body.attributes, this::throwValidationErrorApi);
|
||||
body.crudMode = CrudMode.EDIT;
|
||||
final User entity = getUser(body).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> {
|
||||
|
|
|
@ -62,18 +62,17 @@ public class ApiAdminWebauthAction extends FessApiAdminAction {
|
|||
final WebAuthPager pager = copyBeanToNewBean(body, WebAuthPager.class);
|
||||
final List<WebAuthentication> list = webAuthService.getWebAuthenticationList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
.total(pager.getAllRecordCount()).status(ApiResult.Status.OK).result());
|
||||
.settings(list.stream().map(this::createEditBody).collect(Collectors.toList())).total(pager.getAllRecordCount())
|
||||
.status(ApiResult.Status.OK).result());
|
||||
}
|
||||
|
||||
// GET /api/admin/webauth/setting/{id}
|
||||
@Execute
|
||||
public JsonResponse<ApiResult> get$setting(final String id) {
|
||||
return asJson(new ApiConfigResponse()
|
||||
.setting(webAuthService.getWebAuthentication(id).map(entity -> createEditBody(entity)).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
return asJson(new ApiConfigResponse().setting(webAuthService.getWebAuthentication(id).map(this::createEditBody).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
}
|
||||
|
||||
// PUT /api/admin/webauth/setting
|
||||
|
|
|
@ -63,18 +63,17 @@ public class ApiAdminWebconfigAction extends FessApiAdminAction {
|
|||
final WebConfigPager pager = copyBeanToNewBean(body, WebConfigPager.class);
|
||||
final List<WebConfig> list = webConfigService.getWebConfigList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
.total(pager.getAllRecordCount()).status(ApiResult.Status.OK).result());
|
||||
.settings(list.stream().map(this::createEditBody).collect(Collectors.toList())).total(pager.getAllRecordCount())
|
||||
.status(ApiResult.Status.OK).result());
|
||||
}
|
||||
|
||||
// GET /api/admin/webconfig/setting/{id}
|
||||
@Execute
|
||||
public JsonResponse<ApiResult> get$setting(final String id) {
|
||||
return asJson(new ApiConfigResponse()
|
||||
.setting(webConfigService.getWebConfig(id).map(entity -> createEditBody(entity)).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
return asJson(new ApiConfigResponse().setting(webConfigService.getWebConfig(id).map(this::createEditBody).orElseGet(() -> {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id));
|
||||
return null;
|
||||
})).status(Status.OK).result());
|
||||
}
|
||||
|
||||
// PUT /api/admin/webconfig/setting
|
||||
|
|
|
@ -177,7 +177,7 @@ public abstract class FessBaseAction extends TypicalAction // has several interf
|
|||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public ActionValidator<FessMessages> createValidator() {
|
||||
return systemHelper.createValidator(requestManager, () -> createMessages(), myValidationGroups());
|
||||
return systemHelper.createValidator(requestManager, this::createMessages, myValidationGroups());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.lastaflute.web.response.HtmlResponse;
|
|||
|
||||
public abstract class FessLoginAction extends FessSearchAction {
|
||||
protected HtmlResponse getHtmlResponse() {
|
||||
return getUserBean().map(user -> redirectByUser(user)).orElse(asHtml(virtualHost(path_Login_IndexJsp)));
|
||||
return getUserBean().map(this::redirectByUser).orElse(asHtml(virtualHost(path_Login_IndexJsp)));
|
||||
}
|
||||
|
||||
protected HtmlResponse redirectByUser(final FessUserBean user) {
|
||||
|
|
|
@ -52,7 +52,7 @@ public class FessResponseProcessor extends DefaultResponseProcessor {
|
|||
for (final Ingester ingester : ingestFactory.getIngesters()) {
|
||||
try {
|
||||
target = ingester.process(target, responseData);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
logger.warn("Failed to process Ingest[{}]", ingester.getClass().getSimpleName(), e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,36 +110,30 @@ public interface FessTransformer {
|
|||
|
||||
default void putResultDataBody(final Map<String, Object> dataMap, final String key, final Object value) {
|
||||
final FessConfig fessConfig = ComponentUtil.getFessConfig();
|
||||
if (fessConfig.getIndexFieldUrl().equals(key)) {
|
||||
if (fessConfig.getIndexFieldUrl().equals(key) || !dataMap.containsKey(key) || !getFessConfig().isCrawlerDocumentAppendData()) {
|
||||
dataMap.put(key, value);
|
||||
} else if (dataMap.containsKey(key)) {
|
||||
if (getFessConfig().isCrawlerDocumentAppendData()) {
|
||||
final Object oldValue = dataMap.get(key);
|
||||
final Object[] oldValues;
|
||||
if (oldValue instanceof Object[]) {
|
||||
oldValues = (Object[]) oldValue;
|
||||
} else if (oldValue instanceof Collection<?>) {
|
||||
oldValues = ((Collection<?>) oldValue).toArray();
|
||||
} else {
|
||||
oldValues = new Object[] { oldValue };
|
||||
}
|
||||
if (value.getClass().isArray()) {
|
||||
final Object[] newValues = (Object[]) value;
|
||||
final Object[] values = Arrays.copyOf(oldValues, oldValues.length + newValues.length);
|
||||
for (int i = 0; i < newValues.length; i++) {
|
||||
values[values.length - 1 + i] = newValues[i];
|
||||
}
|
||||
dataMap.put(key, values);
|
||||
} else {
|
||||
final Object[] values = Arrays.copyOf(oldValues, oldValues.length + 1);
|
||||
values[values.length - 1] = value;
|
||||
dataMap.put(key, values);
|
||||
}
|
||||
} else {
|
||||
dataMap.put(key, value);
|
||||
}
|
||||
} else {
|
||||
dataMap.put(key, value);
|
||||
final Object oldValue = dataMap.get(key);
|
||||
final Object[] oldValues;
|
||||
if (oldValue instanceof Object[]) {
|
||||
oldValues = (Object[]) oldValue;
|
||||
} else if (oldValue instanceof Collection<?>) {
|
||||
oldValues = ((Collection<?>) oldValue).toArray();
|
||||
} else {
|
||||
oldValues = new Object[] { oldValue };
|
||||
}
|
||||
if (value.getClass().isArray()) {
|
||||
final Object[] newValues = (Object[]) value;
|
||||
final Object[] values = Arrays.copyOf(oldValues, oldValues.length + newValues.length);
|
||||
for (int i = 0; i < newValues.length; i++) {
|
||||
values[values.length - 1 + i] = newValues[i];
|
||||
}
|
||||
dataMap.put(key, values);
|
||||
} else {
|
||||
final Object[] values = Arrays.copyOf(oldValues, oldValues.length + 1);
|
||||
values[values.length - 1] = value;
|
||||
dataMap.put(key, values);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ public class IndexUpdateCallbackImpl implements IndexUpdateCallback {
|
|||
for (final Ingester ingester : ingestFactory.getIngesters()) {
|
||||
try {
|
||||
target = ingester.process(target, paramMap);
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
logger.warn("Failed to process Ingest[{}]", ingester.getClass().getSimpleName(), e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -552,9 +552,7 @@ public class FessEsClient implements Client {
|
|||
final Map<String, Map<String, String>> result =
|
||||
mapper.readValue(line, new TypeReference<Map<String, Map<String, String>>>() {
|
||||
});
|
||||
if (result.containsKey("index")) {
|
||||
return line;
|
||||
} else if (result.containsKey("update")) {
|
||||
if (result.containsKey("index") || result.containsKey("update")) {
|
||||
return line;
|
||||
} else if (result.containsKey("delete")) {
|
||||
return StringUtil.EMPTY;
|
||||
|
|
|
@ -59,12 +59,12 @@ public class User extends BsUser implements FessUser {
|
|||
|
||||
@Override
|
||||
public String[] getRoleNames() {
|
||||
return stream(getRoles()).get(stream -> stream.map(s -> decode(s)).toArray(n -> new String[n]));
|
||||
return stream(getRoles()).get(stream -> stream.map(this::decode).toArray(n -> new String[n]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getGroupNames() {
|
||||
return stream(getGroups()).get(stream -> stream.map(s -> decode(s)).toArray(n -> new String[n]));
|
||||
return stream(getGroups()).get(stream -> stream.map(this::decode).toArray(n -> new String[n]));
|
||||
}
|
||||
|
||||
private String decode(final String value) {
|
||||
|
|
|
@ -120,9 +120,8 @@ public class IntervalControlHelper {
|
|||
|
||||
public boolean isTarget(final int hours, final int minutes, final int day) {
|
||||
if (reverse) {
|
||||
if (compareTime(hours, minutes, toHours, toMinutes) >= 0 && isInDays(day + 1)) {
|
||||
return true;
|
||||
} else if (compareTime(fromHours, fromMinutes, hours, minutes) >= 0 && isInDays(day)) {
|
||||
if ((compareTime(hours, minutes, toHours, toMinutes) >= 0 && isInDays(day + 1))
|
||||
|| (compareTime(fromHours, fromMinutes, hours, minutes) >= 0 && isInDays(day))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -132,7 +132,7 @@ public class SuggestHelper {
|
|||
final String from = LocalDateTime.now().minusDays(fessConfig.getPurgeSuggestSearchLogDay()).format(DateTimeFormatter.ISO_DATE);
|
||||
cb.query().addQuery(QueryBuilders.rangeQuery("requestedAt").gte(from));
|
||||
cb.query().addOrderBy_RequestedAt_Asc();
|
||||
}, searchLogsList -> indexFromSearchLog(searchLogsList));
|
||||
}, this::indexFromSearchLog);
|
||||
}
|
||||
|
||||
public void indexFromSearchLog(final List<SearchLog> searchLogList) {
|
||||
|
|
|
@ -19,7 +19,6 @@ import java.util.Map;
|
|||
|
||||
import org.codelibs.fess.crawler.entity.ResponseData;
|
||||
import org.codelibs.fess.crawler.entity.ResultData;
|
||||
import org.codelibs.fess.crawler.transformer.Transformer;
|
||||
import org.codelibs.fess.util.ComponentUtil;
|
||||
|
||||
public abstract class Ingester {
|
||||
|
|
|
@ -367,7 +367,7 @@ public class LdapManager {
|
|||
return;
|
||||
}
|
||||
|
||||
final Supplier<Hashtable<String, String>> adminEnv = () -> createAdminEnv();
|
||||
final Supplier<Hashtable<String, String>> adminEnv = this::createAdminEnv;
|
||||
search(fessConfig.getLdapAdminUserBaseDn(),
|
||||
fessConfig.getLdapAdminUserFilter(user.getName()),
|
||||
null,
|
||||
|
@ -446,7 +446,7 @@ public class LdapManager {
|
|||
return;
|
||||
}
|
||||
|
||||
final Supplier<Hashtable<String, String>> adminEnv = () -> createAdminEnv();
|
||||
final Supplier<Hashtable<String, String>> adminEnv = this::createAdminEnv;
|
||||
final String userDN = fessConfig.getLdapAdminUserSecurityPrincipal(user.getName());
|
||||
// attributes
|
||||
search(fessConfig.getLdapAdminUserBaseDn(), fessConfig.getLdapAdminUserFilter(user.getName()), null, adminEnv, result -> {
|
||||
|
@ -926,7 +926,7 @@ public class LdapManager {
|
|||
return;
|
||||
}
|
||||
|
||||
final Supplier<Hashtable<String, String>> adminEnv = () -> createAdminEnv();
|
||||
final Supplier<Hashtable<String, String>> adminEnv = this::createAdminEnv;
|
||||
final String userDN = fessConfig.getLdapAdminUserSecurityPrincipal(user.getName());
|
||||
|
||||
stream(user.getGroupNames()).of(stream -> stream.forEach(name -> {
|
||||
|
@ -969,7 +969,7 @@ public class LdapManager {
|
|||
return;
|
||||
}
|
||||
|
||||
final Supplier<Hashtable<String, String>> adminEnv = () -> createAdminEnv();
|
||||
final Supplier<Hashtable<String, String>> adminEnv = this::createAdminEnv;
|
||||
search(fessConfig.getLdapAdminRoleBaseDn(), fessConfig.getLdapAdminRoleFilter(role.getName()), null, adminEnv, result -> {
|
||||
if (!result.isEmpty()) {
|
||||
logger.info("{} exists in LDAP server.", role.getName());
|
||||
|
@ -994,7 +994,7 @@ public class LdapManager {
|
|||
return;
|
||||
}
|
||||
|
||||
final Supplier<Hashtable<String, String>> adminEnv = () -> createAdminEnv();
|
||||
final Supplier<Hashtable<String, String>> adminEnv = this::createAdminEnv;
|
||||
search(fessConfig.getLdapAdminRoleBaseDn(), fessConfig.getLdapAdminRoleFilter(role.getName()), null, adminEnv, result -> {
|
||||
if (!result.isEmpty()) {
|
||||
final String entryDN = fessConfig.getLdapAdminRoleSecurityPrincipal(role.getName());
|
||||
|
@ -1011,7 +1011,7 @@ public class LdapManager {
|
|||
return;
|
||||
}
|
||||
|
||||
final Supplier<Hashtable<String, String>> adminEnv = () -> createAdminEnv();
|
||||
final Supplier<Hashtable<String, String>> adminEnv = this::createAdminEnv;
|
||||
search(fessConfig.getLdapAdminGroupBaseDn(), fessConfig.getLdapAdminGroupFilter(group.getName()), null, adminEnv, result -> {
|
||||
if (!result.isEmpty()) {
|
||||
setAttributeValue(result, fessConfig.getLdapAttrGidNumber(), o -> group.setGidNumber(DfTypeUtil.toLong(o)));
|
||||
|
@ -1024,7 +1024,7 @@ public class LdapManager {
|
|||
return;
|
||||
}
|
||||
|
||||
final Supplier<Hashtable<String, String>> adminEnv = () -> createAdminEnv();
|
||||
final Supplier<Hashtable<String, String>> adminEnv = this::createAdminEnv;
|
||||
final String entryDN = fessConfig.getLdapAdminGroupSecurityPrincipal(group.getName());
|
||||
search(fessConfig.getLdapAdminGroupBaseDn(), fessConfig.getLdapAdminGroupFilter(group.getName()), null, adminEnv, result -> {
|
||||
if (!result.isEmpty()) {
|
||||
|
@ -1083,7 +1083,7 @@ public class LdapManager {
|
|||
return;
|
||||
}
|
||||
|
||||
final Supplier<Hashtable<String, String>> adminEnv = () -> createAdminEnv();
|
||||
final Supplier<Hashtable<String, String>> adminEnv = this::createAdminEnv;
|
||||
search(fessConfig.getLdapAdminGroupBaseDn(), fessConfig.getLdapAdminGroupFilter(group.getName()), null, adminEnv, result -> {
|
||||
if (!result.isEmpty()) {
|
||||
final String entryDN = fessConfig.getLdapAdminGroupSecurityPrincipal(group.getName());
|
||||
|
@ -1099,7 +1099,7 @@ public class LdapManager {
|
|||
return false;
|
||||
}
|
||||
|
||||
final Supplier<Hashtable<String, String>> adminEnv = () -> createAdminEnv();
|
||||
final Supplier<Hashtable<String, String>> adminEnv = this::createAdminEnv;
|
||||
final String userDN = fessConfig.getLdapAdminUserSecurityPrincipal(username);
|
||||
search(fessConfig.getLdapAdminUserBaseDn(), fessConfig.getLdapAdminUserFilter(username), null, adminEnv, result -> {
|
||||
if (!result.isEmpty()) {
|
||||
|
|
|
@ -1442,36 +1442,34 @@ public interface FessProp {
|
|||
final Set<String> floatFieldSet = getIndexAdminFloatFieldSet();
|
||||
final Set<String> doubleFieldSet = getIndexAdminDoubleFieldSet();
|
||||
|
||||
return source.entrySet().stream().map(e -> {
|
||||
final String key = e.getKey();
|
||||
Object value = e.getValue();
|
||||
if (value == null) {
|
||||
value = StringUtil.EMPTY;
|
||||
}
|
||||
if (value instanceof String || value == null) {
|
||||
return new Pair<>(key, value);
|
||||
}
|
||||
if (arrayFieldSet.contains(key)) {
|
||||
if (value instanceof String[]) {
|
||||
value = stream((String[]) value).get(stream -> stream.collect(Collectors.joining("\n")));
|
||||
} else if (value instanceof List) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final List<String> list = (List<String>) value;
|
||||
value = list.stream().collect(Collectors.joining("\n"));
|
||||
}
|
||||
} else if (dateFieldSet.contains(key)) {
|
||||
value = FessFunctions.formatDate((Date) value);
|
||||
} else if (integerFieldSet.contains(key)) {
|
||||
value = value.toString();
|
||||
} else if (longFieldSet.contains(key)) {
|
||||
value = value.toString();
|
||||
} else if (floatFieldSet.contains(key)) {
|
||||
value = value.toString();
|
||||
} else if (doubleFieldSet.contains(key)) {
|
||||
value = value.toString();
|
||||
}
|
||||
return new Pair<>(key, value);
|
||||
}).collect(Collectors.toMap(Pair::getFirst, Pair::getSecond));
|
||||
return source
|
||||
.entrySet()
|
||||
.stream()
|
||||
.map(e -> {
|
||||
final String key = e.getKey();
|
||||
Object value = e.getValue();
|
||||
if (value == null) {
|
||||
value = StringUtil.EMPTY;
|
||||
}
|
||||
if (value instanceof String || value == null) {
|
||||
return new Pair<>(key, value);
|
||||
}
|
||||
if (arrayFieldSet.contains(key)) {
|
||||
if (value instanceof String[]) {
|
||||
value = stream((String[]) value).get(stream -> stream.collect(Collectors.joining("\n")));
|
||||
} else if (value instanceof List) {
|
||||
@SuppressWarnings("unchecked")
|
||||
final List<String> list = (List<String>) value;
|
||||
value = list.stream().collect(Collectors.joining("\n"));
|
||||
}
|
||||
} else if (dateFieldSet.contains(key)) {
|
||||
value = FessFunctions.formatDate((Date) value);
|
||||
} else if (integerFieldSet.contains(key) || longFieldSet.contains(key) || floatFieldSet.contains(key)
|
||||
|| doubleFieldSet.contains(key)) {
|
||||
value = value.toString();
|
||||
}
|
||||
return new Pair<>(key, value);
|
||||
}).collect(Collectors.toMap(Pair::getFirst, Pair::getSecond));
|
||||
}
|
||||
|
||||
default Map<String, Object> convertToStorableDoc(final Map<String, Object> source) {
|
||||
|
|
|
@ -401,7 +401,7 @@ public class ThumbnailManager {
|
|||
}
|
||||
});
|
||||
|
||||
deleteFileMap.values().forEach(v -> deleteFile(v));
|
||||
deleteFileMap.values().forEach(this::deleteFile);
|
||||
count += deleteFileMap.size();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,9 +52,7 @@ public class SystemMonitorTarget implements TimeoutTarget {
|
|||
final Object value = supplier.get();
|
||||
if (value == null) {
|
||||
buf.append("null");
|
||||
} else if (value instanceof Integer) {
|
||||
buf.append((value));
|
||||
} else if (value instanceof Long) {
|
||||
} else if ((value instanceof Integer) || (value instanceof Long)) {
|
||||
buf.append((value));
|
||||
} else if (value instanceof Short) {
|
||||
buf.append(((Short) value).shortValue());
|
||||
|
|
|
@ -230,7 +230,7 @@ public class GsaConfigParser extends DefaultHandler {
|
|||
|
||||
protected String parseFilterPaths(final String text, final boolean web, final boolean file) {
|
||||
return split(text, "\n").get(
|
||||
stream -> stream.map(String::trim).filter(StringUtil::isNotBlank).map(s -> getFilterPath(s)).filter(s -> {
|
||||
stream -> stream.map(String::trim).filter(StringUtil::isNotBlank).map(this::getFilterPath).filter(s -> {
|
||||
if (StringUtil.isBlank(s)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -264,9 +264,8 @@ public class GsaConfigParser extends DefaultHandler {
|
|||
final String v = s.substring(REGEXP.length());
|
||||
final StringBuilder buf = new StringBuilder(100);
|
||||
return appendFileterPath(buf, unescape(v));
|
||||
} else if (Arrays.stream(webProtocols).anyMatch(p -> s.startsWith(p))) {
|
||||
return escape(s) + ".*";
|
||||
} else if (Arrays.stream(fileProtocols).anyMatch(p -> s.startsWith(p))) {
|
||||
} else if (Arrays.stream(webProtocols).anyMatch(p -> s.startsWith(p))
|
||||
|| Arrays.stream(fileProtocols).anyMatch(p -> s.startsWith(p))) {
|
||||
return escape(s) + ".*";
|
||||
} else {
|
||||
final StringBuilder buf = new StringBuilder(100);
|
||||
|
|
|
@ -136,7 +136,7 @@ public class QueryStringBuilder {
|
|||
final int maxQueryLength = fessConfig.getQueryMaxLengthAsInteger();
|
||||
|
||||
stream(conditions.get(SearchRequestParams.AS_OCCURRENCE)).of(
|
||||
stream -> stream.filter(q -> isOccurrence(q)).findFirst().ifPresent(q -> queryBuf.insert(0, q + ":")));
|
||||
stream -> stream.filter(this::isOccurrence).findFirst().ifPresent(q -> queryBuf.insert(0, q + ":")));
|
||||
|
||||
stream(conditions.get(SearchRequestParams.AS_Q)).of(
|
||||
stream -> stream.filter(q -> StringUtil.isNotBlank(q) && q.length() <= maxQueryLength).forEach(
|
||||
|
|
Loading…
Add table
Reference in a new issue