Package org.jtalks.jcommune.web.dto.json

Examples of org.jtalks.jcommune.web.dto.json.JsonResponse


    @ResponseBody
    public JsonResponse getQuote(@PathVariable(POST_ID) Long postId,
                                 @RequestParam("selection") String selection) throws NotFoundException {
        Post source = postService.get(postId);
        String content = StringUtils.defaultString(selection, source.getPostContent());
        return new JsonResponse(JsonResponseStatus.SUCCESS, bbCodeService.quote(content, source.getUserCreated()));
    }
View Full Code Here


            return new FailValidationJsonResponse(bindingResult.getAllErrors());
        }
        CodeReviewComment addedComment = codeReviewService.addComment(
                reviewId, commentDto.getLineNumber(), commentDto.getBody());
        CodeReviewCommentDto addedCommentDto = new CodeReviewCommentDto(addedComment);
        return new JsonResponse(JsonResponseStatus.SUCCESS, addedCommentDto);
    }
View Full Code Here

    @ResponseBody
    public JsonResponse deleteComment(
            @RequestParam(COMMENT_ID) Long commentId,
            @RequestParam(REVIEW_ID) Long reviewId) throws NotFoundException {
        codeReviewService.deleteComment(codeReviewCommentService.get(commentId), codeReviewService.get(reviewId));
        return new JsonResponse(JsonResponseStatus.SUCCESS);
    }
View Full Code Here

            return new FailValidationJsonResponse(bindingResult.getAllErrors());
        }
        CodeReviewComment editedComment = codeReviewCommentService.updateComment(
                commentDto.getId(), commentDto.getBody(), branchId);
        CodeReviewCommentDto editedCommentDto = new CodeReviewCommentDto(editedComment);
        return new JsonResponse(JsonResponseStatus.SUCCESS, editedCommentDto);
    }
View Full Code Here

            return getCustomErrorJsonResponse(CONNECTION_ERROR);
        } catch (UnexpectedErrorException e) {
            return getCustomErrorJsonResponse(UNEXPECTED_ERROR);
        }
        if (errors.hasErrors()) {
            return new JsonResponse(JsonResponseStatus.FAIL, errors.getAllErrors());
        }
        return new JsonResponse(JsonResponseStatus.SUCCESS);
    }
View Full Code Here

        }
        return false;
    }

    private JsonResponse getCustomErrorJsonResponse(String customError) {
        return new JsonResponse(JsonResponseStatus.FAIL,
                new ImmutableMap.Builder<String, String>().put(CUSTOM_ERROR, customError).build());
    }
View Full Code Here

    @RequestMapping(value = "/user/new_ajax", method = RequestMethod.GET)
    @ResponseBody
    public JsonResponse registrationForm(HttpServletRequest request, Locale locale) {
        Map<String, String> registrationPlugins = getRegistrationPluginsHtml(request, locale);
        return new JsonResponse(JsonResponseStatus.SUCCESS, registrationPlugins);
    }
View Full Code Here

            return getCustomErrorJsonResponse("unexpectedError");
        }
        if (isAuthenticated) {
            LocaleResolver localeResolver = RequestContextUtils.getLocaleResolver(request);
            localeResolver.setLocale(request, response, userService.getCurrentUser().getLanguage().getLocale());
            return new JsonResponse(JsonResponseStatus.SUCCESS);
        } else {
            return new JsonResponse(JsonResponseStatus.FAIL);
        }
    }
View Full Code Here

     * @return list of usernames as json
     */
    @RequestMapping(value = "/usernames", method = RequestMethod.POST)
    @ResponseBody
    public JsonResponse usernameList(@RequestParam("pattern") String pattern) {
        return new JsonResponse(JsonResponseStatus.SUCCESS, userService.getUsernames(pattern));
    }
View Full Code Here

TOP

Related Classes of org.jtalks.jcommune.web.dto.json.JsonResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.