Package org.richfaces.photoalbum.model

Examples of org.richfaces.photoalbum.model.Comment


        User user = em.createQuery("select u from User u where u.id = :id", User.class).setParameter("id", (long) 1)
            .getSingleResult();

        int originalSize = helper.getAllComments(em).size();

        Comment comment = new Comment();
        comment.setAuthor(user);
        comment.setDate(new Date());
        comment.setMessage("beautiful");
        comment.setImage(image);

        if (!image.isAllowComments()) {
            image.setAllowComments(true);
        }
View Full Code Here


    @Test
    public void isCommentDeleted() throws Exception {
        Image image = helper.getAllImages(em).get(0);
        int originalSize = helper.getAllComments(em).size();
        Comment comment = getAllCommentsById(image.getId()).get(0);

        ia.deleteComment(comment);

        Assert.assertFalse(getAllCommentsById(image.getId()).contains(comment));
        Assert.assertEquals(originalSize - 1, helper.getAllComments(em).size());
View Full Code Here

        image.setAllowComments(false);

        int originalSize = helper.getAllComments(em).size();

        Comment comment = new Comment();
        comment.setAuthor(user);
        comment.setDate(new Date());
        comment.setMessage("beautiful");
        comment.setImage(image);

        ia.addComment(comment);
        // the code below should not get executed

        Assert.assertFalse(getAllCommentsById(image.getId()).contains(comment));
View Full Code Here

        }
        if (message.trim().equals("")) {
            error.fire(new ErrorEvent(Constants.NULL_COMMENT_ERROR));
            return;
        }
        Comment comment = new Comment();
        comment.setAuthor(user);
        comment.setImage(image);
        comment.setDate(new Date());
        comment.setMessage(message);
        try {
            imageAction.addComment(comment);
        } catch (Exception e) {
            error.fire(new ErrorEvent("Error", Constants.SAVE_COMMENT_ERROR + " <br/>" + e.getMessage()));
            return;
View Full Code Here

TOP

Related Classes of org.richfaces.photoalbum.model.Comment

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.