use of org.lastaflute.web.Execute in project fess by codelibs.
the class ApiAdminFailureurlAction method delete$all.
// DELETE /api/admin/failureurl/all
@Execute
public JsonResponse<ApiResult> delete$all() {
try {
failureUrlService.deleteAll(failureUrlPager);
failureUrlPager.clear();
saveInfo(messages -> messages.addSuccessFailureUrlDeleteAll(GLOBAL));
} catch (final Exception e) {
throwValidationErrorApi(messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)));
}
return asJson(new ApiResponse().status(Status.OK).result());
}
use of org.lastaflute.web.Execute in project fess by codelibs.
the class ApiAdminFileauthAction method settings.
// ===================================================================================
// Search Execute
// ==============
// GET /api/admin/fileauth/settings
// POST /api/admin/fileauth/settings
@Execute
public JsonResponse<ApiResult> settings(final SearchBody body) {
validateApi(body, messages -> {
});
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());
}
use of org.lastaflute.web.Execute in project fess by codelibs.
the class ApiAdminFileauthAction method post$setting.
// POST /api/admin/fileauth/setting
@Execute
public JsonResponse<ApiResult> post$setting(final EditBody body) {
validateApi(body, messages -> {
});
body.crudMode = CrudMode.EDIT;
final FileAuthentication fileAuth = getFileAuthentication(body).map(entity -> {
try {
fileAuthService.store(entity);
} catch (final Exception e) {
throwValidationErrorApi(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)));
}
return entity;
}).orElseGet(() -> {
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, body.id));
return null;
});
return asJson(new ApiUpdateResponse().id(fileAuth.getId()).created(false).status(Status.OK).result());
}
use of org.lastaflute.web.Execute in project fess by codelibs.
the class ApiAdminFileconfigAction method settings.
// ===================================================================================
// Search Execute
// ==============
// GET /api/admin/fileconfig/settings
// POST /api/admin/fileconfig/settings
@Execute
public JsonResponse<ApiResult> settings(final SearchBody body) {
validateApi(body, messages -> {
});
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());
}
use of org.lastaflute.web.Execute in project fess by codelibs.
the class ApiAdminFileconfigAction method post$setting.
// POST /api/admin/fileconfig/setting
@Execute
public JsonResponse<ApiResult> post$setting(final EditBody body) {
validateApi(body, messages -> {
});
body.crudMode = CrudMode.EDIT;
final FileConfig fileConfig = getFileConfig(body).map(entity -> {
try {
fileConfigService.store(entity);
} catch (final Exception e) {
throwValidationErrorApi(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)));
}
return entity;
}).orElseGet(() -> {
throwValidationErrorApi(messages -> messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, body.id));
return null;
});
return asJson(new ApiUpdateResponse().id(fileConfig.getId()).created(false).status(Status.OK).result());
}
Aggregations