Package org.apache.rave.portal.model

Examples of org.apache.rave.portal.model.WidgetUsersMapReduceResult


        this.mongoOperations = mongoOperations;
    }

    @Override
    public WidgetStatistics getWidgetStatistics(String widget_id, String user_id) {
        WidgetUsersMapReduceResult userResult = mongoOperations.findById(widget_id, WidgetUsersMapReduceResult.class, WIDGET_USERS);
        WidgetRatingsMapReduceResult ratingResult = mongoOperations.findById(widget_id, WidgetRatingsMapReduceResult.class, WIDGET_RATINGS);

        int userCount = userResult == null ? 0 : userResult.getValue().size();
        WidgetStatistics stats;
        if(ratingResult == null) {
            stats = new WidgetStatistics();
            stats.setUserRating(-1);
        } else {
View Full Code Here


        return stats;
    }

    @Override
    public Set<String> getUsersWithWidget(String widgetId) {
        WidgetUsersMapReduceResult result = mongoOperations.findById(widgetId, WidgetUsersMapReduceResult.class, WIDGET_USERS);
        return result.getValue().keySet();
    }
View Full Code Here

                new WidgetRatingsMapReduceResult("25L", new WidgetRatingsMapReduceResult.WidgetStatisticsMapReduceResult(userRatings, 2L, 0L)),
                new WidgetRatingsMapReduceResult("26L", new WidgetRatingsMapReduceResult.WidgetStatisticsMapReduceResult(userRatings, 2L, 0L))
        );

        List<WidgetUsersMapReduceResult> usersMapReduceResults = Arrays.asList(
                new WidgetUsersMapReduceResult("24L", users),
                new WidgetUsersMapReduceResult("25L", users),
                new WidgetUsersMapReduceResult("26L", users)
        );

        expect(mongoOperations.findAll(WidgetRatingsMapReduceResult.class, CollectionNames.WIDGET_RATINGS)).andReturn(ratings);
        expect(mongoOperations.findAll(WidgetUsersMapReduceResult.class, CollectionNames.WIDGET_USERS)).andReturn(usersMapReduceResults);
        replay(mongoOperations);
View Full Code Here

                new WidgetRatingsMapReduceResult("25L", new WidgetRatingsMapReduceResult.WidgetStatisticsMapReduceResult(userRatings, 2L, 0L)),
                new WidgetRatingsMapReduceResult("26L", new WidgetRatingsMapReduceResult.WidgetStatisticsMapReduceResult(userRatings, 2L, 0L))
        );

        List<WidgetUsersMapReduceResult> usersMapReduceResults = Arrays.asList(
                new WidgetUsersMapReduceResult("24L", users),
                new WidgetUsersMapReduceResult("25L", users),
                new WidgetUsersMapReduceResult("26L", users)
        );

        expect(mongoOperations.findAll(WidgetRatingsMapReduceResult.class, CollectionNames.WIDGET_RATINGS)).andReturn(ratings);
        expect(mongoOperations.findAll(WidgetUsersMapReduceResult.class, CollectionNames.WIDGET_USERS)).andReturn(usersMapReduceResults);
        replay(mongoOperations);
View Full Code Here

                new WidgetRatingsMapReduceResult("25L", null),
                new WidgetRatingsMapReduceResult("26L", null)
        );

        List<WidgetUsersMapReduceResult> usersMapReduceResults = Arrays.asList(
                new WidgetUsersMapReduceResult("24L", users),
                new WidgetUsersMapReduceResult("25L", users),
                new WidgetUsersMapReduceResult("26L", users)
        );

        expect(mongoOperations.findAll(WidgetRatingsMapReduceResult.class, CollectionNames.WIDGET_RATINGS)).andReturn(ratings);
        expect(mongoOperations.findAll(WidgetUsersMapReduceResult.class, CollectionNames.WIDGET_USERS)).andReturn(usersMapReduceResults);
        replay(mongoOperations);
View Full Code Here

        Map<String, Long> users = getUsersMap();

        List<WidgetRatingsMapReduceResult> ratings = Lists.newArrayList();

        List<WidgetUsersMapReduceResult> usersMapReduceResults = Arrays.asList(
                new WidgetUsersMapReduceResult("24L", users),
                new WidgetUsersMapReduceResult("25L", users),
                new WidgetUsersMapReduceResult("26L", users)
        );

        expect(mongoOperations.findAll(WidgetRatingsMapReduceResult.class, CollectionNames.WIDGET_RATINGS)).andReturn(ratings);
        expect(mongoOperations.findAll(WidgetUsersMapReduceResult.class, CollectionNames.WIDGET_USERS)).andReturn(usersMapReduceResults);
        replay(mongoOperations);
View Full Code Here

        String widget_id = "1L";
        Map<String, Long> userMap = Maps.newHashMap();
        userMap.put("20L", 10L);
        userMap.put("21L", 10L);
        WidgetRatingsMapReduceResult.WidgetStatisticsMapReduceResult stats = new WidgetRatingsMapReduceResult.WidgetStatisticsMapReduceResult(userMap, 20L, 0L);
        WidgetUsersMapReduceResult usersResult = new WidgetUsersMapReduceResult(widget_id, userMap);
        WidgetRatingsMapReduceResult ratingsResult = new WidgetRatingsMapReduceResult(widget_id, stats);

        expect(mongoOperations.findById(widget_id, WidgetRatingsMapReduceResult.class, WIDGET_RATINGS)).andReturn(ratingsResult);
        expect(mongoOperations.findById(widget_id, WidgetUsersMapReduceResult.class, WIDGET_USERS)).andReturn(usersResult);
        replay(mongoOperations);
View Full Code Here

        String widget_id = "1L";
        Map<String, Long> userMap = Maps.newHashMap();
        userMap.put("20L", 10L);
        userMap.put("21L", 10L);
        WidgetRatingsMapReduceResult.WidgetStatisticsMapReduceResult stats = new WidgetRatingsMapReduceResult.WidgetStatisticsMapReduceResult(userMap, 20L, 0L);
        WidgetUsersMapReduceResult usersResult = new WidgetUsersMapReduceResult(widget_id, userMap);
        WidgetRatingsMapReduceResult ratingsResult = new WidgetRatingsMapReduceResult(widget_id, stats);

        expect(mongoOperations.findById(widget_id, WidgetRatingsMapReduceResult.class, WIDGET_RATINGS)).andReturn(ratingsResult);
        expect(mongoOperations.findById(widget_id, WidgetUsersMapReduceResult.class, WIDGET_USERS)).andReturn(usersResult);
        replay(mongoOperations);
View Full Code Here

    public void getWidgetStatistics_nullRatings() {
        String widget_id = "1L";
        Map<String, Long> userMap = Maps.newHashMap();
        userMap.put("20L", 10L);
        userMap.put("21L", 10L);
        WidgetUsersMapReduceResult usersResult = new WidgetUsersMapReduceResult(widget_id, userMap);

        expect(mongoOperations.findById(widget_id, WidgetRatingsMapReduceResult.class, WIDGET_RATINGS)).andReturn(null);
        expect(mongoOperations.findById(widget_id, WidgetUsersMapReduceResult.class, WIDGET_USERS)).andReturn(usersResult);
        replay(mongoOperations);
View Full Code Here

TOP

Related Classes of org.apache.rave.portal.model.WidgetUsersMapReduceResult

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.