use of org.lastaflute.web.response.HtmlResponse in project fess by codelibs.
the class AdminFileconfigAction method edit.
@Execute
public HtmlResponse edit(final EditForm form) {
validate(form, messages -> {
}, () -> asListHtml());
final PermissionHelper permissionHelper = ComponentUtil.getPermissionHelper();
final String id = form.id;
fileConfigService.getFileConfig(id).ifPresent(entity -> {
copyBeanToBean(entity, form, copyOp -> {
copyOp.excludeNull();
copyOp.exclude(Constants.PERMISSIONS);
});
form.permissions = stream(entity.getPermissions()).get(stream -> stream.map(permissionHelper::decode).filter(StringUtil::isNotBlank).distinct().collect(Collectors.joining("\n")));
}).orElse(() -> throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml()));
saveToken();
if (form.crudMode.intValue() == CrudMode.EDIT) {
// back
form.crudMode = CrudMode.DETAILS;
return asDetailsHtml();
} else {
form.crudMode = CrudMode.EDIT;
return asEditHtml();
}
}
Aggregations