Search in sources :

Example 1 with CrudMode

use of org.codelibs.fess.app.web.CrudMode in project fess by codelibs.

the class AdminElevatewordAction method details.

// -----------------------------------------------------
//                                               Details
//                                               -------
@Execute
public HtmlResponse details(final int crudMode, final String id) {
    verifyCrudMode(crudMode, CrudMode.DETAILS);
    saveToken();
    final PermissionHelper permissionHelper = ComponentUtil.getPermissionHelper();
    return asHtml(path_AdminElevateword_AdminElevatewordDetailsJsp).useForm(EditForm.class, op -> op.setup(form -> {
        elevateWordService.getElevateWord(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")));
            form.crudMode = crudMode;
        }).orElse(() -> throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml()));
    })).renderWith(data -> registerLabels(data));
}
Also used : BeanUtil(org.codelibs.core.beans.util.BeanUtil) Constants(org.codelibs.fess.Constants) FessSystemException(org.codelibs.fess.exception.FessSystemException) ElevateWordPager(org.codelibs.fess.app.pager.ElevateWordPager) OptionalThing(org.dbflute.optional.OptionalThing) PermissionHelper(org.codelibs.fess.helper.PermissionHelper) ActionRuntime(org.lastaflute.web.ruts.process.ActionRuntime) RenderDataUtil(org.codelibs.fess.util.RenderDataUtil) StreamUtil.split(org.codelibs.core.stream.StreamUtil.split) CrudMode(org.codelibs.fess.app.web.CrudMode) FessAdminAction(org.codelibs.fess.app.web.base.FessAdminAction) RenderData(org.lastaflute.web.response.render.RenderData) OutputStreamWriter(java.io.OutputStreamWriter) HtmlResponse(org.lastaflute.web.response.HtmlResponse) Path(java.nio.file.Path) StreamUtil.stream(org.codelibs.core.stream.StreamUtil.stream) ElevateWordService(org.codelibs.fess.app.service.ElevateWordService) Files(java.nio.file.Files) BufferedWriter(java.io.BufferedWriter) OptionalEntity(org.dbflute.optional.OptionalEntity) Resource(javax.annotation.Resource) StringUtil(org.codelibs.core.lang.StringUtil) Reader(java.io.Reader) InputStreamReader(java.io.InputStreamReader) Collectors(java.util.stream.Collectors) LabelTypeService(org.codelibs.fess.app.service.LabelTypeService) ActionResponse(org.lastaflute.web.response.ActionResponse) Stream(java.util.stream.Stream) ComponentUtil(org.codelibs.fess.util.ComponentUtil) SystemHelper(org.codelibs.fess.helper.SystemHelper) Writer(java.io.Writer) Execute(org.lastaflute.web.Execute) ElevateWord(org.codelibs.fess.es.config.exentity.ElevateWord) BufferedReader(java.io.BufferedReader) SuggestHelper(org.codelibs.fess.helper.SuggestHelper) InputStream(java.io.InputStream) PermissionHelper(org.codelibs.fess.helper.PermissionHelper) Execute(org.lastaflute.web.Execute)

Example 2 with CrudMode

use of org.codelibs.fess.app.web.CrudMode in project fess by codelibs.

the class AdminLabeltypeAction method details.

// -----------------------------------------------------
//                                               Details
//                                               -------
@Execute
public HtmlResponse details(final int crudMode, final String id) {
    verifyCrudMode(crudMode, CrudMode.DETAILS);
    saveToken();
    return asHtml(path_AdminLabeltype_AdminLabeltypeDetailsJsp).useForm(EditForm.class, op -> {
        op.setup(form -> {
            labelTypeService.getLabelType(id).ifPresent(entity -> {
                copyBeanToBean(entity, form, copyOp -> {
                    copyOp.excludeNull();
                    copyOp.exclude(Constants.PERMISSIONS);
                });
                final PermissionHelper permissionHelper = ComponentUtil.getPermissionHelper();
                form.permissions = stream(entity.getPermissions()).get(stream -> stream.map(s -> permissionHelper.decode(s)).filter(StringUtil::isNotBlank).distinct().collect(Collectors.joining("\n")));
                form.crudMode = crudMode;
            }).orElse(() -> {
                throwValidationError(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, id), () -> asListHtml());
            });
        });
    }).renderWith(data -> {
        registerRoleTypeItems(data);
    });
}
Also used : Constants(org.codelibs.fess.Constants) LabelTypePager(org.codelibs.fess.app.pager.LabelTypePager) StreamUtil.stream(org.codelibs.core.stream.StreamUtil.stream) OptionalEntity(org.dbflute.optional.OptionalEntity) OptionalThing(org.dbflute.optional.OptionalThing) Resource(javax.annotation.Resource) StringUtil(org.codelibs.core.lang.StringUtil) PermissionHelper(org.codelibs.fess.helper.PermissionHelper) Collectors(java.util.stream.Collectors) ActionRuntime(org.lastaflute.web.ruts.process.ActionRuntime) LabelType(org.codelibs.fess.es.config.exentity.LabelType) RenderDataUtil(org.codelibs.fess.util.RenderDataUtil) LabelTypeService(org.codelibs.fess.app.service.LabelTypeService) StreamUtil.split(org.codelibs.core.stream.StreamUtil.split) Stream(java.util.stream.Stream) CrudMode(org.codelibs.fess.app.web.CrudMode) ComponentUtil(org.codelibs.fess.util.ComponentUtil) FessAdminAction(org.codelibs.fess.app.web.base.FessAdminAction) SystemHelper(org.codelibs.fess.helper.SystemHelper) Execute(org.lastaflute.web.Execute) RenderData(org.lastaflute.web.response.render.RenderData) RoleTypeService(org.codelibs.fess.app.service.RoleTypeService) HtmlResponse(org.lastaflute.web.response.HtmlResponse) PermissionHelper(org.codelibs.fess.helper.PermissionHelper) StringUtil(org.codelibs.core.lang.StringUtil) Execute(org.lastaflute.web.Execute)

Aggregations

Collectors (java.util.stream.Collectors)2 Stream (java.util.stream.Stream)2 Resource (javax.annotation.Resource)2 StringUtil (org.codelibs.core.lang.StringUtil)2 StreamUtil.split (org.codelibs.core.stream.StreamUtil.split)2 StreamUtil.stream (org.codelibs.core.stream.StreamUtil.stream)2 Constants (org.codelibs.fess.Constants)2 LabelTypeService (org.codelibs.fess.app.service.LabelTypeService)2 CrudMode (org.codelibs.fess.app.web.CrudMode)2 FessAdminAction (org.codelibs.fess.app.web.base.FessAdminAction)2 PermissionHelper (org.codelibs.fess.helper.PermissionHelper)2 SystemHelper (org.codelibs.fess.helper.SystemHelper)2 ComponentUtil (org.codelibs.fess.util.ComponentUtil)2 RenderDataUtil (org.codelibs.fess.util.RenderDataUtil)2 OptionalEntity (org.dbflute.optional.OptionalEntity)2 OptionalThing (org.dbflute.optional.OptionalThing)2 Execute (org.lastaflute.web.Execute)2 HtmlResponse (org.lastaflute.web.response.HtmlResponse)2 RenderData (org.lastaflute.web.response.render.RenderData)2 ActionRuntime (org.lastaflute.web.ruts.process.ActionRuntime)2