Package org.jboss.seam.wiki.core.model

Examples of org.jboss.seam.wiki.core.model.WikiComment


          }
          else
          {
             if (nodeToDelete instanceof WikiComment)
             {
                WikiComment comment = (WikiComment) nodeToDelete;
               
                documentHome.setId(getCommentDocument(comment).getId());
                CommentHome commentHome = (CommentHome) Component.getInstance("commentHome");
               
                commentHome.setId(comment.getId());
                commentHome.remove(comment.getId());            
             }
             else if (nodeToDelete instanceof WikiDocument)
             {
                documentHome.setId(nodeToDelete.getId());
                documentHome.reallyRemove();
View Full Code Here


                        em.createQuery("select d from WikiDocument d where d.id = :id")
                                .setParameter("id", 6l)
                                .getSingleResult();
                assert d.getName().equals("One");

                WikiComment newComment = new WikiComment();

                newComment.setAreaNumber(d.getAreaNumber());
                newComment.setDerivedName(d);
                newComment.setWikiname(WikiUtil.convertToWikiName(newComment.getName()));
                newComment.setCreatedBy(em.find(User.class, 1l));

                newComment.setSubject("Seven");
                newComment.setContent("Testcomment Seven");
                newComment.setUseWikiText(true);

                newComment.setParent(d);

                em.persist(newComment);

                em.flush();
                em.clear();

                List<WikiComment> comments =
                        em.createQuery("select c from WikiComment c where c.parent = :doc order by c.createdOn asc")
                        .setParameter("doc", d)
                        .getResultList();

                assert comments.size() == 7;

                assert comments.get(0).getName().equals("One.Comment11967298211870");
                assert comments.get(1).getSubject().equals("Two");
                assert comments.get(2).getSubject().equals("Three");
                assert comments.get(3).getSubject().equals("Four");
                assert comments.get(4).getSubject().equals("Five");
                assert comments.get(5).getSubject().equals("Six");
                assert comments.get(6).getSubject().equals("Seven");
                assert comments.get(6).getId().equals(newComment.getId());

            }
        }.run();
    }
View Full Code Here

    public void findCommentParent() throws Exception {
        new FacesRequest() {

            protected void invokeApplication() throws Exception {
                EntityManager em = (EntityManager) getInstance("restrictedEntityManager");
                WikiComment comment  = (WikiComment)
                        em.createQuery("select c from WikiComment c where c.id = :id")
                                .setParameter("id", 13l)
                                .getSingleResult();
                assert comment.getSubject().equals("Four");
                assert comment.getParent().getId().equals(6l);
                assertEquals(comment.getPermURL(".lace"), "6.lace#comment13");
                assertEquals(comment.getWikiURL(), "CCC/One#comment13");
            }
        }.run();
    }
View Full Code Here

    public void commentURL() throws Exception {
        new FacesRequest() {

            protected void invokeApplication() throws Exception {
                EntityManager em = (EntityManager) getInstance("restrictedEntityManager");
                WikiComment c = (WikiComment)
                        em.createQuery("select c from WikiComment c where c.id = :id")
                                .setParameter("id", 10l)
                                .getSingleResult();

                assert c.getPermURL(".lace").equals("6.lace#comment10");
                assert c.getWikiURL().equals("CCC/One#comment10");

            }
        }.run();
    }
View Full Code Here

TOP

Related Classes of org.jboss.seam.wiki.core.model.WikiComment

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.