Package org.apache.rave.portal.model.impl

Examples of org.apache.rave.portal.model.impl.WidgetRatingImpl


    @Before
    public void setUp() {
        mockWidgetRatingRepository = createMock(WidgetRepository.class);
        defaultWidgetRatingPermissionEvaluator = new DefaultWidgetRatingPermissionEvaluator(mockWidgetRatingRepository);

        widgetRating = new WidgetRatingImpl(VALID_WIDGET_ID);
        widgetRating.setUserId(VALID_USER_ID);

        user = new UserImpl();
        user.setUsername(VALID_USERNAME);
        user.setId(VALID_USER_ID);
View Full Code Here


    public void setWidgetRating(@PathVariable long widgetId,
                                @RequestParam(value = "score") Integer score,
                                HttpServletResponse response) {
        logger.debug("POST WidgetRating received for /api/rest/widgets/{} score: {}", widgetId, score);

        WidgetRating widgetRating = new WidgetRatingImpl();
        widgetRating.setScore(score);
        widgetRating.setUserId(userService.getAuthenticatedUser().getId());
        widgetRating.setWidgetId(widgetId);
        widgetRatingService.saveWidgetRating(widgetRating);

        // send a 204 back for success since there is no content being returned
        response.setStatus(HttpStatus.NO_CONTENT.value());
    }
View Full Code Here

    private void convertRatings(Widget source, MongoDbWidget widget) {
        List<WidgetRating> ratings = source.getRatings();
        List<WidgetRating> converted = Lists.newArrayList();
        for(WidgetRating rating : ratings) {
            String id = rating.getId() == null ? generateId() : rating.getId();
            converted.add(new WidgetRatingImpl(id, rating.getUserId(), rating.getScore()));
        }
        widget.setRatings(converted);
    }
View Full Code Here

    public void setWidgetRating(@PathVariable String widgetId,
                                @RequestParam(value = "score") Integer score,
                                HttpServletResponse response) {
        logger.debug("POST WidgetRating received for /api/rest/widgets/{} score: {}", widgetId, score);

        WidgetRating widgetRating = new WidgetRatingImpl();
        widgetRating.setScore(score);
        widgetRating.setUserId(userService.getAuthenticatedUser().getId());
        widgetService.saveWidgetRating(widgetId, widgetRating);

        // send a 204 back for success since there is no content being returned
        response.setStatus(HttpStatus.NO_CONTENT.value());
    }
View Full Code Here

TOP

Related Classes of org.apache.rave.portal.model.impl.WidgetRatingImpl

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.