Package org.apache.jetspeed.page

Examples of org.apache.jetspeed.page.PageManager


    private void securityConstraintAction(String action, String constraint,
            String oldConstraintName)
    {
        SiteTreeNode node = getUserSelectedNode();
        Node jetspeedNode = null;
        PageManager pageManager = getServiceLocator().getPageManager();
        if (node.getDocType() == SiteTreeNode.FileType.Folder)
        {
            jetspeedNode = (Node) getJetspeedFolder(node.getNodePath());
            if (action.equals(ADD_ACTION) || action.equals(SAVE_ACTION))
            {
View Full Code Here


            JetspeedDocumentMetaData metaData,
            JetspeedDocumentMetaData oldMetaData)
    {
        SiteTreeNode node = getUserSelectedNode();
        Node jetspeedNode = null;
        PageManager pageManager = getServiceLocator().getPageManager();
        if (node.getDocType() == SiteTreeNode.FileType.Folder)
        {
            jetspeedNode = (Node) getJetspeedFolder(node.getNodePath());
            if (action.equals(ADD_ACTION) || action.equals(SAVE_ACTION))
            {
View Full Code Here

    }

    private void metaOrderAction(JetspeedDocument document, String choices)
    {
        SiteTreeNode node = getUserSelectedNode();
        PageManager pageManger = getServiceLocator().getPageManager();
        List<String> documentOrder = null;
        if (node != null)
        {
            if (choices != null)
            {
View Full Code Here

    }

    private void excuteAction(JetspeedDocument document, String action)
    {
        SiteTreeNode node = getUserSelectedNode();
        PageManager pageManger = getServiceLocator().getPageManager();
        if (node != null)
        {
            if (node.getDocType() == SiteTreeNode.FileType.Folder)
            {
                Folder folder = getJetspeedFolder(node.getNodePath());
View Full Code Here

        ExportObject jetspeedObject = null;
        String objectPath = siteNode.getNodePath();
        if (!cleanUserFolder(userName)) success = false;
        if (success)
        {
            PageManager pageManager = getServiceLocator().getPageManager();
            PageManager castorPageManager = getServiceLocator()
                    .getCastorPageManager();
            try
            {
                if (siteNode.getDocType() == SiteTreeNode.FileType.Folder)
                {
                    Folder folder = pageManager.getFolder(siteNode
                            .getNodePath());
                    if (recursive)
                    {
                        PortalSiteManagerUtil
                                .importFolder(castorPageManager, folder,
                                        userName, getRealPath(folder.getPath()), true);
                    } else
                    {
                        Folder destFolder = castorPageManager.copyFolder(
                                folder, PortalSiteManagerUtil.getUserFolder(
                                        userName, true)
                                        + siteNode.getNodeName());
                        castorPageManager.updateFolder(destFolder);
                    }
                } else if (siteNode.getDocType() == SiteTreeNode.FileType.Page)
                {
                    objectPath = PortalSiteManagerUtil
                            .getParentPath(objectPath);
                    Folder folder = pageManager.getFolder(objectPath);
                    Page page = folder.getPage(siteNode.getNodeName());
                    Page destPage = castorPageManager.copyPage(page,
                            PortalSiteManagerUtil.getUserFolder(userName, true)
                                    + siteNode.getNodeName(),
                                    true);
                    castorPageManager.updatePage(destPage);
                } else if (siteNode.getDocType() == SiteTreeNode.FileType.Link)
                {
                    objectPath = PortalSiteManagerUtil
                            .getParentPath(objectPath);
                    Folder folder = pageManager.getFolder(objectPath);
                    Link link = folder.getLink(siteNode.getNodeName());
                    Link destLink = castorPageManager.copyLink(link,
                            PortalSiteManagerUtil.getUserFolder(userName, true)
                                    + siteNode.getNodeName());
                    castorPageManager.updateLink(destLink);
                }
                String link = userName + "_" + siteNode.getNodeName();
                if (siteNode.getDocType() == SiteTreeNode.FileType.Folder)
                {
                    contentType = "application/zip";
View Full Code Here

        menuDefinitions.add(definition);
    }

    protected Object copyMenuElement(String type, Object srcElement)
    {
        PageManager pageManger = getServiceLocator().getPageManager();
        if (srcElement instanceof MenuDefinition)
        {
            // create the new menu element and copy attributes
            MenuDefinition source = (MenuDefinition) srcElement;
            MenuDefinition menu = null;
            if (type.equals(PAGE_NODE_TYPE))
            {
                menu = pageManger.newPageMenuDefinition();
            } else if (type.equals(FOLDER_NODE_TYPE))
            {
                menu = pageManger.newFolderMenuDefinition();
            }
            menu.setDepth(source.getDepth());
            menu.setName(source.getName());
            menu.setOptions(source.getOptions());
            menu.setOrder(source.getOrder());
            menu.setPaths(source.isPaths());
            menu.setProfile(source.getProfile());
            menu.setRegexp(source.isRegexp());
            menu.setShortTitle(source.getShortTitle());
            menu.setSkin(source.getSkin());
            menu.setTitle(source.getTitle());
            // copy locale specific metadata
            menu.getMetadata().copyFields(source.getMetadata().getFields());
            // recursively copy menu elements
            List elements = source.getMenuElements();
            if (elements != null)
            {
                List copiedElements = new ArrayList();
                Iterator elementsIter = elements.iterator();
                while (elementsIter.hasNext())
                {
                    Object element = elementsIter.next();
                    Object copiedElement = copyMenuElement(type, element);
                    if (copiedElement != null)
                    {
                        copiedElements.add(copiedElement);
                    }
                }
                menu.setMenuElements(copiedElements);
            }
            return menu;
        } else if (srcElement instanceof MenuExcludeDefinition)
        {
            // create the new menu exclude element and copy attributes
            MenuExcludeDefinition source = (MenuExcludeDefinition) srcElement;
            MenuExcludeDefinition menuExclude = null;
            if (type.equals(PAGE_NODE_TYPE))
            {
                menuExclude = pageManger.newPageMenuExcludeDefinition();
            } else if (type.equals(FOLDER_NODE_TYPE))
            {
                menuExclude = pageManger.newFolderMenuExcludeDefinition();
            }
            menuExclude.setName(source.getName());
            return menuExclude;
        } else if (srcElement instanceof MenuIncludeDefinition)
        {
            // create the new menu include element and copy attributes
            MenuIncludeDefinition source = (MenuIncludeDefinition) srcElement;
            MenuIncludeDefinition menuInclude = null;
            if (type.equals(PAGE_NODE_TYPE))
            {
                menuInclude = pageManger.newPageMenuIncludeDefinition();
            } else if (type.equals(FOLDER_NODE_TYPE))
            {
                menuInclude = pageManger.newFolderMenuIncludeDefinition();
            }
            menuInclude.setName(source.getName());
            menuInclude.setNest(source.isNest());
            return menuInclude;
        } else if (srcElement instanceof MenuOptionsDefinition)
        {
            // create the new menu options element and copy attributes
            MenuOptionsDefinition source = (MenuOptionsDefinition) srcElement;
            MenuOptionsDefinition menuOptions = null;
            if (type.equals(PAGE_NODE_TYPE))
            {
                menuOptions = pageManger.newPageMenuOptionsDefinition();
            } else if (type.equals(FOLDER_NODE_TYPE))
            {
                menuOptions = pageManger.newFolderMenuOptionsDefinition();
            }
            menuOptions.setDepth(source.getDepth());
            menuOptions.setOptions(source.getOptions());
            menuOptions.setOrder(source.getOrder());
            menuOptions.setPaths(source.isPaths());
            menuOptions.setProfile(source.getProfile());
            menuOptions.setRegexp(source.isRegexp());
            menuOptions.setSkin(source.getSkin());
            return menuOptions;
        } else if (srcElement instanceof MenuSeparatorDefinition)
        {
            // create the new menu separator element and copy attributes
            MenuSeparatorDefinition source = (MenuSeparatorDefinition) srcElement;
            MenuSeparatorDefinition menuSeparator = null;
            if (type.equals(PAGE_NODE_TYPE))
            {
                menuSeparator = pageManger.newPageMenuSeparatorDefinition();
            } else if (type.equals(FOLDER_NODE_TYPE))
            {
                menuSeparator = pageManger.newFolderMenuSeparatorDefinition();
            }
            menuSeparator.setSkin(source.getSkin());
            menuSeparator.setTitle(source.getTitle());
            menuSeparator.setText(source.getText());
            // copy locale specific metadata
View Full Code Here

            if (typeParam != null)
            {
                type = typeParam;
            }
           
            PageManager pageManager = getServiceLocator().getPageManager();
            DefaultMutableTreeNode treeRootNode = null;
           
            try
            {
                if (PAGE_NODE_TYPE.equals(type))
                {
                    Page page = pageManager.getPage(pathParam);
                    siteTreeNode = new SiteTreeNode(page.getName(), page.getPath(), SiteTreeNode.FileType.Page, true);
                    treeRootNode = new DefaultMutableTreeNode(new SiteTreeNode(page));
                }
                else if (FOLDER_NODE_TYPE.equals(type))
                {
                    Folder folder = pageManager.getFolder(pathParam);
                    siteTreeNode = new SiteTreeNode(folder.getName(), folder.getPath(), SiteTreeNode.FileType.Folder, true);
                    treeRootNode = new DefaultMutableTreeNode(new SiteTreeNode(folder, true));
                }
                else if (LINK_NODE_TYPE.equals(type))
                {
                    Link link = pageManager.getLink(pathParam);
                    siteTreeNode = new SiteTreeNode(link.getName(), link.getPath(), SiteTreeNode.FileType.Link, true);
                    treeRootNode = new DefaultMutableTreeNode(new SiteTreeNode(link));
                }
            }
            catch (Exception e)
View Full Code Here

                        boolean success = false;
                        if (upload != null)
                        {
                            try
                            {
                                PageManager pageManager = getServiceLocator()
                                        .getPageManager();
                                String fileName = upload.getClientFileName();
                                String fileType = fileExt(upload.getClientFileName());
                                cleanUserFolder(userName);
                                String usrFolder = getTempFolder(userName);
                                String destPath = node.getNodePath();
                                upload.writeTo(new File(usrFolder
                                        + pathSeparator
                                        + upload.getClientFileName()));
                                // File writed in temp folder
                                if (fileType != null && !fileType.equals("")
                                        && fileName != null
                                        && !fileName.equals("")
                                        && destPath != null
                                        && !destPath.equals(""))
                                {
                                    // if "/" is path, then file separator will
                                    // work, as root.
                                    if (destPath.equals("/")) destPath = "";
                                    Folder folder = getServiceLocator()
                                            .getCastorPageManager().getFolder(
                                                    userName);
                                    if (fileType.equalsIgnoreCase("psml"))
                                    {
                                        Page source = folder.getPage(fileName);
                                        Page page = null;
                                        if (pageManager.pageExists(destPath
                                                + pathSeparator + fileName))
                                        {
                                            pageManager.removePage(pageManager
                                                    .getPage(destPath
                                                            + pathSeparator
                                                            + fileName));
                                        }
                                        page = pageManager.copyPage(source,
                                                destPath + pathSeparator
                                                        + fileName,
                                                        copyIds);
                                        pageManager.updatePage(page);
                                        success = true;
                                    } else if (fileType.equalsIgnoreCase("tpsml"))
                                    {
                                        PageTemplate source = folder.getPageTemplate(fileName);
                                        PageTemplate pageTemplate = null;
                                        if (pageManager.pageTemplateExists(destPath
                                                + pathSeparator + fileName))
                                        {
                                            pageManager.removePageTemplate(pageManager
                                                    .getPageTemplate(destPath
                                                            + pathSeparator
                                                            + fileName));
                                        }
                                        pageTemplate = pageManager.copyPageTemplate(source,
                                                destPath + pathSeparator
                                                + fileName,
                                                copyIds);
                                        pageManager.updatePageTemplate(pageTemplate);
                                        success = true;
                                    } else if (fileType.equalsIgnoreCase("dpsml"))
                                    {
                                        DynamicPage source = folder.getDynamicPage(fileName);
                                        DynamicPage dynamicPage = null;
                                        if (pageManager.dynamicPageExists(destPath
                                                + pathSeparator + fileName))
                                        {
                                            pageManager.removeDynamicPage(pageManager
                                                    .getDynamicPage(destPath
                                                            + pathSeparator
                                                            + fileName));
                                        }
                                        dynamicPage = pageManager.copyDynamicPage(source,
                                                destPath + pathSeparator
                                                + fileName,
                                                copyIds);
                                        pageManager.updateDynamicPage(dynamicPage);
                                        success = true;
                                    } else if (fileType.equalsIgnoreCase("fpsml"))
                                    {
                                        FragmentDefinition source = folder.getFragmentDefinition(fileName);
                                        FragmentDefinition fragmentDefinition = null;
                                        if (pageManager.fragmentDefinitionExists(destPath
                                                + pathSeparator + fileName))
                                        {
                                            pageManager.removeFragmentDefinition(pageManager
                                                    .getFragmentDefinition(destPath
                                                            + pathSeparator
                                                            + fileName));
                                        }
                                        fragmentDefinition = pageManager.copyFragmentDefinition(source,
                                                destPath + pathSeparator
                                                + fileName,
                                                copyIds);
                                        pageManager.updateFragmentDefinition(fragmentDefinition);
                                        success = true;
                                    } else if (fileType
                                            .equalsIgnoreCase("link"))
                                    {
                                        Link source = folder.getLink(fileName);
                                        Link link;
                                        if (pageManager.linkExists(destPath
                                                + pathSeparator + fileName))
                                        {
                                            pageManager.removeLink(pageManager
                                                    .getLink(destPath
                                                            + pathSeparator
                                                            + fileName));
                                            link = pageManager.copyLink(source,
                                                    destPath + pathSeparator
                                                            + fileName);
                                        }
                                        link = pageManager.copyLink(source,
                                                destPath + pathSeparator
                                                        + fileName);
                                        pageManager.updateLink(link);
                                        success = true;
                                    } else if (fileType.equalsIgnoreCase("zip"))
                                    {
                                        unzipfile(fileName, StringUtils.removeEnd(usrFolder, pathSeparator), pathSeparator);
                                        folder = getServiceLocator()
View Full Code Here

        super(id);
        this.paNodeBean = paNodeBean;
        Panel panel = initLayout();
       
        jetspeedSecurityContraintNames = new ArrayList<String>(Arrays.asList(""));
        PageManager pageManager = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPageManager();
        try
        {
            for (Object secConstDefObj : pageManager.getPageSecurity().getSecurityConstraintsDefs())
            {
                SecurityConstraintsDef secConstDef = (SecurityConstraintsDef) secConstDefObj;
                jetspeedSecurityContraintNames.add(secConstDef.getName());
            }
        }
View Full Code Here

    private List<String> getSubSites()
    {
        List<String> subsites = new ArrayList<String>();
        subsites.add("");
        PageManager pageManager = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPageManager();
        if (!StringUtils.isEmpty(getSubSiteRoot()))
        {
            try
            {
                Folder subsiteFolder = pageManager.getFolder(getSubSiteRoot());
                NodeSet set = pageManager.getFolders(subsiteFolder);
                if (set != null && !set.isEmpty())
                {
                    Iterator setIterator = set.iterator();
                    while (setIterator.hasNext())
                    {
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.page.PageManager

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.