@RequestMapping(value = "/branch/edit", method = RequestMethod.POST)
@ResponseBody
public JsonResponse setBranchInformation(@Valid @RequestBody BranchDto branchDto,
BindingResult result, Locale locale) throws NotFoundException {
if (result.hasErrors()) {
return new JsonResponse(JsonResponseStatus.FAIL, result.getAllErrors());
}
long forumId = componentService.getComponentOfForum().getId();
try {
branchService.changeBranchInfo(forumId, branchDto.getId(), branchDto.getName(), branchDto.getDescription());
} catch (AccessDeniedException e) {
String errorMessage = messageSource.getMessage(ACCESS_DENIED_MESSAGE, null, locale);
return new JsonResponse(JsonResponseStatus.FAIL, errorMessage);
}
return new JsonResponse(JsonResponseStatus.SUCCESS, null);
}