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

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


        textEditor.setAllowPlaintext(true);// Topics can be plain text, regular documents can't
    }

    @Override
    public WikiDocument afterNodeCreated(WikiDocument doc) {
        WikiDocument newTopic = super.afterNodeCreated(doc);
        newTopic.setDefaults(new TopicDefaults());
        setPushOnFeeds(true);
        return newTopic;
    }
View Full Code Here


        setParentNodeId(faqBrowser.getSelectedDir().getNode().getId());
    }

    @Override
    public WikiDocument afterNodeCreated(WikiDocument doc) {
        WikiDocument newQuestion = super.afterNodeCreated(doc);
        newQuestion.setDefaults(new FaqQuestionDefaults());
        return newQuestion;
    }
View Full Code Here

    @In
    WikiDocument currentDocument;

    public WikiDocument getPrevious(WikiPluginMacro macro) {
        WikiDocument previous = (WikiDocument) macro.getAttributes().get(MACRO_ATTR_PAGER_PREVIOUS);
        if (previous == null) {
            previous = WikiNodeDAO.instance().findSiblingWikiDocumentInDirectory(currentDocument, getSortingProperty(macro), true);
            macro.getAttributes().put(MACRO_ATTR_PAGER_PREVIOUS, previous);
        }
        return previous;
View Full Code Here

        }
        return previous;
    }

    public WikiDocument getNext(WikiPluginMacro macro) {
        WikiDocument next = (WikiDocument) macro.getAttributes().get(MACRO_ATTR_PAGER_NEXT);
        if (next == null) {
            next = WikiNodeDAO.instance().findSiblingWikiDocumentInDirectory(currentDocument, getSortingProperty(macro), false);
            macro.getAttributes().put(MACRO_ATTR_PAGER_NEXT, next);
        }
        return next;
View Full Code Here

    public String getCacheKey(Object o) {
        return getCacheKey(new Object[]{o});
    }

    public String getCacheKey(Object... objects) {
        WikiDocument currentDocument = (WikiDocument)Component.getInstance("currentDocument");
        Integer accessLevel = (Integer) Component.getInstance("currentAccessLevel");
        Hash hash = (Hash)Component.getInstance(Hash.class);

        log.debug("generating cache key for document: " + currentDocument + " and macro: " + this + " and access level: " + accessLevel);
        StringBuilder builder = new StringBuilder();

        if (log.isDebugEnabled()) log.debug("including id of document: " + currentDocument.getId());
        builder.append( currentDocument.getId() );

        int namePositionHash = (getName() + "_" + getPosition()).hashCode();
        if (log.isDebugEnabled()) log.debug("including name/position of this macro: " + Math.abs(namePositionHash));
        builder.append( Math.abs(namePositionHash) );
View Full Code Here

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

            protected void invokeApplication() throws Exception {
                EntityManager em = (EntityManager) getInstance("restrictedEntityManager");
                WikiDocument d = (WikiDocument)
                        em.createQuery("select d from WikiDocument d where d.id = :id")
                                .setParameter("id", 6l)
                                .getSingleResult();
                assert d.getName().equals("One");

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

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

            protected void invokeApplication() throws Exception {
                EntityManager em = (EntityManager) getInstance("restrictedEntityManager");
                WikiDocument d = (WikiDocument)
                        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");
View Full Code Here

                assert invokeMethod("#{topicHome.persist}") == null;

                Long newId = (Long)getValue("#{topicHome.instance.id}");

                WikiNodeDAO nodeDAO = (WikiNodeDAO)getInstance(WikiNodeDAO.class);
                WikiDocument newTopic = nodeDAO.findWikiDocument(newId);

                assert newTopic.getAreaNumber().equals(100l);

                FeedDAO feedDAO = (FeedDAO)getInstance(FeedDAO.class);
                FeedEntry fe = feedDAO.findFeedEntry(newTopic);
                assert fe.getTitle().equals("[Seam Users] New Topic");

                assert newTopic.getHeaderMacrosString().contains("forumPosting");
                assert newTopic.getFooterMacrosString().contains("forumReplies");
                assert newTopic.getContent().equals("This is a new topic.");
                assert !newTopic.isNameAsTitle();
                assert newTopic.isEnableCommentForm();
                assert newTopic.isEnableComments();
                assert newTopic.isEnableCommentsOnFeeds();
                assert newTopic.getWriteAccessLevel() == Role.ADMINROLE_ACCESSLEVEL;
            }
        }.run();

    }
View Full Code Here

                assert invokeMethod("#{topicHome.persist}") == null;
               
                Long newId = (Long)getValue("#{topicHome.instance.id}");

                WikiNodeDAO nodeDAO = (WikiNodeDAO)getInstance(WikiNodeDAO.class);
                WikiDocument newTopic = nodeDAO.findWikiDocument(newId);

                assert newTopic.getAreaNumber().equals(100l);

                FeedDAO feedDAO = (FeedDAO)getInstance(FeedDAO.class);
                FeedEntry fe = feedDAO.findFeedEntry(newTopic);
                assert fe.getTitle().equals("[Seam Users] New Topic");

                assert newTopic.getHeaderMacrosString().contains("forumStickyPosting");
                assert newTopic.getFooterMacrosString().contains("forumReplies");
                assert newTopic.getContent().equals("This is a new topic.");
                assert !newTopic.isNameAsTitle();
                assert newTopic.isEnableCommentForm();
                assert newTopic.isEnableComments();
                assert newTopic.isEnableCommentsOnFeeds();
            }
        }.run();
    }
View Full Code Here

    // TODO: This method is a mess...
    // Returns a detached object
    public WikiDocument findHistoricalDocumentAndDetach(String entityName, Long historyId) {
        // Initialize bytecode-enhanced fields with 'fetch all properties'!
        log.debug("fetching WikiFile historical revision with id: " + historyId + " and initializing all properties");
        WikiDocument historicalFile = (WikiDocument)
                getSession(true).createQuery("select f from " + entityName + " f fetch all properties where f.historicalFileId = :id")
                .setParameter("id", historyId)
                .uniqueResult();
        if (historicalFile != null) {
            historicalFile.getContent(); // TODO: the fetch all properties doesn't work for some reason..
            getSession(true).evict(historicalFile);
            return historicalFile;
        } else {
            return null;
        }
View Full Code Here

TOP

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

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.