use of org.lastaflute.web.response.JsonResponse in project fess by codelibs.
the class ApiAdminWebconfigAction method post$setting.
// POST /api/admin/webconfig/setting
@Execute
public JsonResponse<ApiResult> post$setting(final EditBody body) {
validateApi(body, messages -> {
});
body.crudMode = CrudMode.EDIT;
final WebConfig webConfig = getWebConfig(body).map(entity -> {
try {
webConfigService.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(webConfig.getId()).created(false).status(Status.OK).result());
}
use of org.lastaflute.web.response.JsonResponse in project fess by codelibs.
the class ApiAdminPathmapAction method post$setting.
// POST /api/admin/pathmap/setting
@Execute
public JsonResponse<ApiResult> post$setting(final EditBody body) {
validateApi(body, messages -> {
});
body.crudMode = CrudMode.EDIT;
final PathMapping entity = getPathMapping(body).orElseGet(() -> {
throwValidationErrorApi(messages -> {
messages.addErrorsCrudCouldNotFindCrudTable(GLOBAL, body.id);
});
return null;
});
try {
pathMappingService.store(entity);
} catch (final Exception e) {
throwValidationErrorApi(messages -> messages.addErrorsCrudFailedToUpdateCrudTable(GLOBAL, buildThrowableMessage(e)));
}
return asJson(new ApiResult.ApiUpdateResponse().id(entity.getId()).created(false).status(ApiResult.Status.OK).result());
}
use of org.lastaflute.web.response.JsonResponse in project fess by codelibs.
the class ApiAdminReqheaderAction method post$setting.
// POST /api/admin/reqheader/setting
@Execute
public JsonResponse<ApiResult> post$setting(final EditBody body) {
validateApi(body, messages -> {
});
body.crudMode = CrudMode.EDIT;
final RequestHeader reqHeader = getRequestHeader(body).map(entity -> {
try {
reqHeaderService.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(reqHeader.getId()).created(false).status(Status.OK).result());
}
use of org.lastaflute.web.response.JsonResponse in project fess by codelibs.
the class ApiAdminKeymatchAction method post$setting.
// POST /api/admin/keymatch/setting
@Execute
public JsonResponse<ApiResult> post$setting(final EditBody body) {
validateApi(body, messages -> {
});
body.crudMode = CrudMode.EDIT;
final KeyMatch keyMatch = getKeyMatch(body).map(entity -> {
try {
keyMatchService.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(keyMatch.getId()).created(false).status(Status.OK).result());
}
use of org.lastaflute.web.response.JsonResponse in project fess by codelibs.
the class ApiAdminLabeltypeAction method post$setting.
// POST /api/admin/labeltype/setting
@Execute
public JsonResponse<ApiResult> post$setting(final EditBody body) {
validateApi(body, messages -> {
});
body.crudMode = CrudMode.EDIT;
final LabelType labelType = getLabelType(body).map(entity -> {
try {
labelTypeService.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(labelType.getId()).created(false).status(Status.OK).result());
}
Aggregations