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

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


        new FacesRequest() {

            protected void updateModelValues() throws Exception {
                WikiNodeDAO nodeDAO = (WikiNodeDAO)getInstance(WikiNodeDAO.class);
                WikiDirectory forumDir = nodeDAO.findWikiDirectory(102l);
                Contexts.getPageContext().set("currentDirectory", forumDir);
            }

            protected void invokeApplication() throws Exception {
View Full Code Here


        new FacesRequest() {

            protected void updateModelValues() throws Exception {
                WikiNodeDAO nodeDAO = (WikiNodeDAO)getInstance(WikiNodeDAO.class);
                WikiDirectory forumDir = nodeDAO.findWikiDirectory(109l);
                Contexts.getPageContext().set("currentDirectory", forumDir);
            }

            protected void invokeApplication() throws Exception {
View Full Code Here

    public void trash(N node) {

        // Check if the cut item was a default file for its parent
        if (node.getParent().isInstance(WikiDirectory.class)) {
            WikiDirectory parent = (WikiDirectory)node.getParent();
            if ( parent.getDefaultFile() != null && parent.getDefaultFile().getId().equals(node.getId())) {
                getLog().debug("trashing default file of directory: " + parent);
                parent.setDefaultFile(null);
            }
        }

        // Generate a new (hopefully unique) name
        String newName = node.getName() + "." + new Date().getTime(); // Just append a timestamp

        // Add to trash area
        WikiDirectory persistentTrashArea = getEntityManager().find(WikiDirectory.class, trashArea.getId());
        node.setParent(persistentTrashArea);
        node.setAreaNumber(persistentTrashArea.getAreaNumber());
        node.setName(newName);
        node.setWikiname(WikiUtil.convertToWikiName(node.getName()));

    }
View Full Code Here

                assert dirHome.getMenuItems().size() == 1;

                assert dirHome.getAvailableMenuItems().size() == 1;

                WikiDirectory newMenuItem = dirHome.getAvailableMenuItems().iterator().next();
                dirHome.setSelectedChildDirectory(newMenuItem);
                dirHome.addMenuItem();

                assert dirHome.getMenuItems().size() == 2;
View Full Code Here

                DirectoryHome dirHome = (DirectoryHome)getInstance(DirectoryHome.class);
                assert dirHome.getInstance().getId().equals(3l); // Init!

                assert dirHome.getMenuItems().size() == 1;

                WikiDirectory newMenuItem = dirHome.getAvailableMenuItems().iterator().next();
                dirHome.setSelectedChildDirectory(newMenuItem);
                dirHome.addMenuItem();

                WikiMenuItem removedMenuItem = dirHome.getMenuItems().get(0);
                dirHome.removeMenuItem(removedMenuItem.getDirectoryId());
View Full Code Here

                DirectoryHome dirHome = (DirectoryHome)getInstance(DirectoryHome.class);
                assert dirHome.getInstance().getId().equals(3l); // Init!

                assert dirHome.getMenuItems().size() == 1;

                WikiDirectory newMenuItem = dirHome.getAvailableMenuItems().iterator().next();
                dirHome.setSelectedChildDirectory(newMenuItem);
                dirHome.addMenuItem();

                dirHome.moveMenuItem(1, 0);
View Full Code Here

        // Have we been called with an areaName and nodeName request parameter
        } else if (areaName != null && nodeName != null) {
            log.debug("trying to resolve area name: " + areaName + " and node name: " + nodeName);

            // Try to find the area/directory
            WikiDirectory area = wikiNodeDAO.findArea(areaName);
            if (area != null) {

                // Try to find the document
                WikiDocument doc = wikiNodeDAO.findWikiDocumentInArea(area.getAreaNumber(), nodeName);
                if (doc != null) {
                    // Found it, let's use that
                    currentDocument = doc;
                    // TODO: Avoid cast
                    currentDirectory = (WikiDirectory)currentDocument.getParent();
                } else {
                    // Didn't find a document for the node name, let's see if it's a directory
                    currentDirectory = wikiNodeDAO.findWikiDirectoryInArea(area.getAreaNumber(), nodeName);
                }
            }

        // Or have we been called just with an areaName request parameter
        } else if (areaName != null) {
View Full Code Here

        }.run();
    }

    private boolean checkDirectoryInDatabase(long nodeId) throws Exception {
        Session s = getHibernateSession();
        WikiDirectory dir = (WikiDirectory ) s.createQuery("select d from WikiDirectory d left join fetch d.parent where d.id = :id").setParameter("id", nodeId).uniqueResult();
        s.close();
        return dir != null;
    }
View Full Code Here

TOP

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

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.