Examples of WidgetComment


Examples of org.apache.rave.model.WidgetComment

    public void deleteAll(){
        String userId = "1234L";
        List<Widget> widgets = Lists.newArrayList();
        Widget w = new WidgetImpl();
        List<WidgetComment> comments = Lists.newArrayList();
        WidgetComment wc1 = new WidgetCommentImpl();
        WidgetComment wc2 = new WidgetCommentImpl();
        wc1.setUserId(userId);
        wc2.setUserId(userId);
        comments.add(wc1);
        comments.add(wc2);
        w.setComments(comments);
        widgets.add(w);
View Full Code Here

Examples of org.apache.rave.model.WidgetComment

        String userId = "1234L";
        String userId_2 = "1111L";
        List<Widget> widgets = Lists.newArrayList();
        Widget w = new WidgetImpl();
        List<WidgetComment> comments = Lists.newArrayList();
        WidgetComment wc1 = new WidgetCommentImpl();
        WidgetComment wc2 = new WidgetCommentImpl();
        wc1.setUserId(userId_2);
        wc2.setUserId(userId_2);
        comments.add(wc1);
        comments.add(wc2);
        w.setComments(comments);
        widgets.add(w);
View Full Code Here

Examples of org.apache.rave.model.WidgetComment

    public void get(){
        String id = "1234L";
        String widgetId = "321L";
        List<WidgetComment> comments = Lists.newArrayList();
        Widget widget = new WidgetImpl(widgetId);
        WidgetComment wc = new WidgetCommentImpl(id);
        comments.add(wc);
        widget.setComments(comments);

        expect(template.get(widgetId)).andReturn(widget);
        replay(template);

        WidgetComment result = repo.getCommentById(widgetId, id);
        assertThat(result.getId(), is(equalTo(id)));
    }
View Full Code Here

Examples of org.apache.rave.model.WidgetComment

    public void get_null(){
        String id = "1234L";
        String widgetId = "321L";
        List<WidgetComment> comments = Lists.newArrayList();
        Widget widget = new WidgetImpl(widgetId);
        WidgetComment wc = new WidgetCommentImpl("1111L");
        comments.add(wc);
        widget.setComments(comments);

        expect(template.get(widgetId)).andReturn(widget);
        replay(template);

        WidgetComment result = repo.getCommentById(widgetId, id);
        assertNull(result);

    }
View Full Code Here

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

        user.setUsername(VALID_USERNAME);
        user.setEntityId(VALID_USER_ID);
        user2 = new User();
        user2.setUsername(VALID_USERNAME2);
        user2.setEntityId(INVALID_USER_ID);
        widgetComment = new WidgetComment();
        widgetComment.setEntityId(VALID_COMMENT_ID);
        widgetComment.setUser(user);
        grantedAuthoritiesList = new ArrayList<GrantedAuthority>();
        grantedAuthoritiesList.add(new SimpleGrantedAuthority("ROLE_USER"));
    }
View Full Code Here

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

        EasyMock.<Collection<? extends GrantedAuthority>>expect(mockAuthentication.getAuthorities()).andReturn(grantedAuthoritiesList).anyTimes();
        expect(mockAuthentication.getPrincipal()).andReturn(user).anyTimes();
        replay(mockAuthentication);
       
        WidgetComment localWidgetComment = new WidgetComment();
        User localUser = new User();
        localUser.setEntityId(VALID_USER_ID);
        localWidgetComment.setUser(localUser);
        expect(mockWidgetCommentRepository.get(VALID_COMMENT_ID)).andReturn(localWidgetComment).anyTimes();
        replay(mockWidgetCommentRepository);
       
        assertThat(defaultWidgetCommentPermissionEvaluator.hasPermission(mockAuthentication, localWidgetComment, Permission.CREATE), is(true));
       
View Full Code Here

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

   
    @RequestMapping(method = RequestMethod.POST, value = "/{widgetId}/comments")
    public void createWidgetComment(@PathVariable long widgetId,
                                 @RequestParam String text,
                                 HttpServletResponse response) {
        WidgetComment widgetComment = new WidgetComment();
        widgetComment.setWidgetId(widgetId);
        widgetComment.setUser(userService.getAuthenticatedUser());
        widgetComment.setText(text);
        widgetComment.setCreatedDate(new Date());
        widgetComment.setLastModifiedDate(new Date());
       
        widgetCommentService.saveWidgetComment(widgetComment);
       
        response.setStatus(HttpStatus.NO_CONTENT.value());
    }
View Full Code Here

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

    public void updateWidgetComment(@PathVariable long widgetId,
                                    @PathVariable long widgetCommentId,
                                    @RequestParam String text,
                                    HttpServletResponse response) {
       
        WidgetComment widgetComment = widgetCommentService.getWidgetComment(widgetCommentId);
        if (widgetComment == null) {
            widgetComment = new WidgetComment();
            widgetComment.setWidgetId(widgetId);
            widgetComment.setUser(userService.getAuthenticatedUser());
            widgetComment.setCreatedDate(new Date());
            widgetComment.setLastModifiedDate(new Date());
        }
        widgetComment.setText(text);
       
        widgetCommentService.saveWidgetComment(widgetComment);
       
        response.setStatus(HttpStatus.NO_CONTENT.value());
    }
View Full Code Here

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

    // checks to see if the Authentication object principal is the owner of the supplied widgetComment object
    // if trustedDomainObject is false, pull the entity from the database first to ensure
    // the model object is trusted and hasn't been modified
    private boolean isWidgetCommentOwner(Authentication authentication, WidgetComment widgetComment, List<WidgetComment> trustedPageContainer, boolean trustedDomainObject) {
        WidgetComment trustedWidgetComment = null;
        if (trustedDomainObject) {
            trustedWidgetComment = widgetComment;
        } else {
            trustedWidgetComment = getTrustedWidgetComment(widgetComment.getId(), trustedPageContainer);
        }

        return isWidgetCommentOwnerByUsername(authentication, trustedWidgetComment.getUser().getUsername());
    }
View Full Code Here

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

    }

    // returns a trusted Page object, either from the PageRepository, or the
    // cached container list
    private WidgetComment getTrustedWidgetComment(long widgetCommentId, List<WidgetComment> trustedWidgetCommentContainer) {
        WidgetComment p = null;
        if (trustedWidgetCommentContainer.isEmpty()) {
            p = widgetCommentRepository.get(widgetCommentId);
            trustedWidgetCommentContainer.add(p);
        } else {
            p = trustedWidgetCommentContainer.get(0);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.