Search in sources :

Example 1 with ApiResponse

use of org.codelibs.fess.app.web.api.ApiResult.ApiResponse in project fess by codelibs.

the class ApiAdminCrawlinginfoAction method delete$all.

// DELETE /api/admin/crawlinginfo/all
@Execute
public JsonResponse<ApiResult> delete$all() {
    try {
        crawlingInfoService.deleteOldSessions(processHelper.getRunningSessionIdSet());
        saveInfo(messages -> messages.addSuccessCrawlingInfoDeleteAll(GLOBAL));
    } catch (final Exception e) {
        throwValidationErrorApi(messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)));
    }
    return asJson(new ApiResponse().status(Status.OK).result());
}
Also used : CrawlingInfoPager(org.codelibs.fess.app.pager.CrawlingInfoPager) ProcessHelper(org.codelibs.fess.helper.ProcessHelper) FessApiAdminAction(org.codelibs.fess.app.web.api.admin.FessApiAdminAction) Resource(javax.annotation.Resource) ApiLogResponse(org.codelibs.fess.app.web.api.ApiResult.ApiLogResponse) JsonResponse(org.lastaflute.web.response.JsonResponse) Collectors(java.util.stream.Collectors) ApiResult(org.codelibs.fess.app.web.api.ApiResult) CrawlingInfoService(org.codelibs.fess.app.service.CrawlingInfoService) Status(org.codelibs.fess.app.web.api.ApiResult.Status) List(java.util.List) CrawlingInfo(org.codelibs.fess.es.config.exentity.CrawlingInfo) Execute(org.lastaflute.web.Execute) ApiResponse(org.codelibs.fess.app.web.api.ApiResult.ApiResponse) ApiResponse(org.codelibs.fess.app.web.api.ApiResult.ApiResponse) Execute(org.lastaflute.web.Execute)

Example 2 with ApiResponse

use of org.codelibs.fess.app.web.api.ApiResult.ApiResponse in project fess by codelibs.

the class ApiAdminGeneralAction method post$index.

// POST /api/admin/general
@Execute
public JsonResponse<ApiResult> post$index(final EditBody body) {
    validateApi(body, messages -> {
    });
    final EditBody newBody = new EditBody();
    AdminGeneralAction.updateForm(fessConfig, newBody);
    BeanUtil.copyBeanToBean(body, newBody, CopyOptions::excludeNull);
    AdminGeneralAction.updateConfig(fessConfig, newBody);
    return asJson(new ApiResponse().status(Status.OK).result());
}
Also used : CopyOptions(org.codelibs.core.beans.util.CopyOptions) ApiResponse(org.codelibs.fess.app.web.api.ApiResult.ApiResponse) Execute(org.lastaflute.web.Execute)

Example 3 with ApiResponse

use of org.codelibs.fess.app.web.api.ApiResult.ApiResponse in project fess by codelibs.

the class ApiAdminSearchlistAction method delete$doc.

// DELETE /api/admin/searchlist/doc/{doc_id}
@Execute
public JsonResponse<ApiResult> delete$doc(final String id) {
    try {
        final QueryBuilder query = QueryBuilders.termQuery(fessConfig.getIndexFieldDocId(), id);
        searchEngineClient.deleteByQuery(fessConfig.getIndexDocumentUpdateIndex(), query);
        saveInfo(messages -> messages.addSuccessDeleteDocFromIndex(GLOBAL));
    } catch (final Exception e) {
        throwValidationErrorApi(messages -> messages.addErrorsFailedToDeleteDocInAdmin(GLOBAL));
    }
    return asJson(new ApiResponse().status(Status.OK).result());
}
Also used : Constants(org.codelibs.fess.Constants) AdminSearchlistAction.getDoc(org.codelibs.fess.app.web.admin.searchlist.AdminSearchlistAction.getDoc) SearchEngineClient(org.codelibs.fess.es.client.SearchEngineClient) ApiDeleteResponse(org.codelibs.fess.app.web.api.ApiResult.ApiDeleteResponse) ResultOffsetExceededException(org.codelibs.fess.exception.ResultOffsetExceededException) AdminSearchlistAction.validateFields(org.codelibs.fess.app.web.admin.searchlist.AdminSearchlistAction.validateFields) ApiResult(org.codelibs.fess.app.web.api.ApiResult) Status(org.codelibs.fess.app.web.api.ApiResult.Status) CrudMode(org.codelibs.fess.app.web.CrudMode) Map(java.util.Map) ApiResponse(org.codelibs.fess.app.web.api.ApiResult.ApiResponse) SearchHelper(org.codelibs.fess.helper.SearchHelper) SearchRenderData(org.codelibs.fess.entity.SearchRenderData) QueryBuilders(org.opensearch.index.query.QueryBuilders) FessApiAdminAction(org.codelibs.fess.app.web.api.admin.FessApiAdminAction) ApiDocResponse(org.codelibs.fess.app.web.api.ApiResult.ApiDocResponse) Resource(javax.annotation.Resource) StringUtil(org.codelibs.core.lang.StringUtil) JsonResponse(org.lastaflute.web.response.JsonResponse) ApiUpdateResponse(org.codelibs.fess.app.web.api.ApiResult.ApiUpdateResponse) Logger(org.apache.logging.log4j.Logger) QueryBuilder(org.opensearch.index.query.QueryBuilder) ComponentUtil(org.codelibs.fess.util.ComponentUtil) ApiDocsResponse(org.codelibs.fess.app.web.api.ApiResult.ApiDocsResponse) Execute(org.lastaflute.web.Execute) InvalidQueryException(org.codelibs.fess.exception.InvalidQueryException) LogManager(org.apache.logging.log4j.LogManager) QueryBuilder(org.opensearch.index.query.QueryBuilder) ResultOffsetExceededException(org.codelibs.fess.exception.ResultOffsetExceededException) InvalidQueryException(org.codelibs.fess.exception.InvalidQueryException) ApiResponse(org.codelibs.fess.app.web.api.ApiResult.ApiResponse) Execute(org.lastaflute.web.Execute)

Example 4 with ApiResponse

use of org.codelibs.fess.app.web.api.ApiResult.ApiResponse 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());
}
Also used : ProcessHelper(org.codelibs.fess.helper.ProcessHelper) FessApiAdminAction(org.codelibs.fess.app.web.api.admin.FessApiAdminAction) Resource(javax.annotation.Resource) ApiLogResponse(org.codelibs.fess.app.web.api.ApiResult.ApiLogResponse) JsonResponse(org.lastaflute.web.response.JsonResponse) Collectors(java.util.stream.Collectors) ApiResult(org.codelibs.fess.app.web.api.ApiResult) Status(org.codelibs.fess.app.web.api.ApiResult.Status) List(java.util.List) Execute(org.lastaflute.web.Execute) FailureUrlPager(org.codelibs.fess.app.pager.FailureUrlPager) ApiResponse(org.codelibs.fess.app.web.api.ApiResult.ApiResponse) FailureUrlService(org.codelibs.fess.app.service.FailureUrlService) FailureUrl(org.codelibs.fess.es.config.exentity.FailureUrl) ApiResponse(org.codelibs.fess.app.web.api.ApiResult.ApiResponse) Execute(org.lastaflute.web.Execute)

Aggregations

ApiResponse (org.codelibs.fess.app.web.api.ApiResult.ApiResponse)4 Execute (org.lastaflute.web.Execute)4 Resource (javax.annotation.Resource)3 ApiResult (org.codelibs.fess.app.web.api.ApiResult)3 Status (org.codelibs.fess.app.web.api.ApiResult.Status)3 FessApiAdminAction (org.codelibs.fess.app.web.api.admin.FessApiAdminAction)3 JsonResponse (org.lastaflute.web.response.JsonResponse)3 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 ApiLogResponse (org.codelibs.fess.app.web.api.ApiResult.ApiLogResponse)2 ProcessHelper (org.codelibs.fess.helper.ProcessHelper)2 Map (java.util.Map)1 LogManager (org.apache.logging.log4j.LogManager)1 Logger (org.apache.logging.log4j.Logger)1 CopyOptions (org.codelibs.core.beans.util.CopyOptions)1 StringUtil (org.codelibs.core.lang.StringUtil)1 Constants (org.codelibs.fess.Constants)1 CrawlingInfoPager (org.codelibs.fess.app.pager.CrawlingInfoPager)1 FailureUrlPager (org.codelibs.fess.app.pager.FailureUrlPager)1 CrawlingInfoService (org.codelibs.fess.app.service.CrawlingInfoService)1