use of org.codelibs.fess.es.config.exentity.BoostDocumentRule in project fess by codelibs.
the class ApiAdminBoostdocAction method settings.
// ===================================================================================
// Search Execute
// ==============
// GET /api/admin/boostdoc
// POST /api/admin/boostdoc
@Execute
public JsonResponse<ApiResult> settings(final SearchBody body) {
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(this::createEditBody).collect(Collectors.toList())).total(pager.getAllRecordCount()).status(Status.OK).result());
}
use of org.codelibs.fess.es.config.exentity.BoostDocumentRule in project fess by codelibs.
the class ApiAdminBoostdocAction method put$setting.
// PUT /api/admin/boostdoc/setting
@Execute
public JsonResponse<ApiResult> put$setting(final CreateBody body) {
validateApi(body, messages -> {
});
body.crudMode = CrudMode.CREATE;
final BoostDocumentRule boostDoc = getBoostDocumentRule(body).map(entity -> {
try {
boostDocumentRuleService.store(entity);
} catch (final Exception e) {
throwValidationErrorApi(messages -> messages.addErrorsCrudFailedToCreateCrudTable(GLOBAL, buildThrowableMessage(e)));
}
return entity;
}).orElseGet(() -> {
throwValidationErrorApi(messages -> messages.addErrorsCrudFailedToCreateInstance(GLOBAL));
return null;
});
return asJson(new ApiUpdateResponse().id(boostDoc.getId()).created(true).status(Status.OK).result());
}
use of org.codelibs.fess.es.config.exentity.BoostDocumentRule in project fess by codelibs.
the class ApiAdminBoostdocAction method post$setting.
// POST /api/admin/boostdoc/setting
@Execute
public JsonResponse<ApiResult> post$setting(final EditBody body) {
validateApi(body, messages -> {
});
body.crudMode = CrudMode.EDIT;
final BoostDocumentRule boostDoc = getBoostDocumentRule(body).map(entity -> {
try {
boostDocumentRuleService.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(boostDoc.getId()).created(false).status(Status.OK).result());
}
Aggregations