Package org.apache.lenya.cms.site

Examples of org.apache.lenya.cms.site.SiteException


            }

            if (!sourceNode.hasLink(srcDoc.getLanguage())) {
                // the node that we're trying to publish
                // doesn't have this language
                throw new SiteException("The node " + srcDoc.getPath()
                        + " doesn't contain a label for language " + srcDoc.getLanguage());
            }

            String destPath = destDoc.getPath();

            Link link = sourceNode.getLink(srcDoc.getLanguage());
            SiteNode destNode = destinationTree.getNode(destPath);
            if (destNode == null) {
                if (siblingPath == null) {
                    // called for side effect of add, not return result
                    destNode = destinationTree.add(destPath);
                } else {
                    // called for side effect of add, not return result
                    destNode = destinationTree.add(destPath, siblingPath);
                }
                destinationTree.add(destPath, destDoc);
            } else {
                destDoc.getLink().setLabel(link.getLabel());
            }
        } catch (DocumentException e) {
            throw new SiteException(e);
        }
    }
View Full Code Here


        SiteTree tree;
        try {
            pub = factory.getPublication(locator.getPublicationId());
            tree = getTree(pub.getArea(locator.getArea()));
        } catch (PublicationException e) {
            throw new SiteException(e);
        }

        String suffix = null;
        int version = 0;
        String idwithoutsuffix = null;
View Full Code Here

            throws SiteException {
        Area areaObj;
        try {
            areaObj = pub.getArea(area);
        } catch (PublicationException e) {
            throw new SiteException(e);
        }
        SiteTree tree = getTree(areaObj);
        SiteNode[] preOrder = tree.preOrder();
        List docs = new ArrayList();
        for (int i = 0; i < preOrder.length; i++) {
View Full Code Here

    public SiteStructure getSiteStructure(DocumentFactory map, Publication publication, String area)
            throws SiteException {
        try {
            return getTree(publication.getArea(area));
        } catch (PublicationException e) {
            throw new SiteException(e);
        }
    }
View Full Code Here

    public boolean isVisibleInNav(Document document) throws SiteException {
        try {
            return document.getLink().getNode().isVisible();
        } catch (DocumentException e) {
            throw new SiteException(e);
        }
    }
View Full Code Here

        return depending.getPath().startsWith(required.getPath() + "/");
    }

    public void set(String path, Document document) throws SiteException {
        if (contains(document)) {
            throw new SiteException("The document [" + document + "] is already contained!");
        }
        SiteTreeImpl tree = (SiteTreeImpl) getTree(document.area());
        TreeNodeImpl node = (TreeNodeImpl) tree.getNode(path);
        node.setUuid(document.getUUID());
        tree.changed();
View Full Code Here

    public void setVisibleInNav(Document document, boolean visibleInNav) throws SiteException {
        try {
            document.getLink().getNode().setVisible(visibleInNav);
        } catch (DocumentException e) {
            throw new SiteException(e);
        }
    }
View Full Code Here

        DefaultSiteTree sitetree;
        RepositoryItemFactory factory = new SiteTreeFactory(this.manager, getLogger());
        try {
            sitetree = (DefaultSiteTree) map.getSession().getRepositoryItem(factory, key);
        } catch (Exception e) {
            throw new SiteException(e);
        }

        return sitetree;
    }
View Full Code Here

                parent = node.getParent();
                ancestors.add(parent);
                ancestors.addAll(getAncestors(parent));
            }
        } catch (Exception e) {
            throw new SiteException(e);
        }
        return ancestors;
    }
View Full Code Here

            }

            if (!sourceNode.hasLink(sourceDocument.getLanguage())) {
                // the node that we're trying to publish
                // doesn't have this language
                throw new SiteException("The node " + sourceDocument.getPath()
                        + " doesn't contain a label for language " + sourceDocument.getLanguage());
            }
            Link link = sourceNode.getLink(sourceDocument.getLanguage());
            SiteTreeNode destinationNode = (SiteTreeNode) destinationTree.getNode(destinationDocument.getPath());
            if (destinationNode == null) {
                if (siblingPath == null) {
                    destinationTree.addNode(destinationDocument.getPath(),
                            destinationDocument.getUUID(),
                            sourceNode.isVisible(),
                            sourceNode.getHref(),
                            sourceNode.getSuffix(),
                            sourceNode.hasLink());
                    destinationTree.addLabel(destinationDocument.getPath(),
                            destinationDocument.getLanguage(),
                            link.getLabel());
                } else {
                    destinationTree.addNode(destinationDocument.getPath(),
                            destinationDocument.getUUID(),
                            sourceNode.isVisible(),
                            sourceNode.getHref(),
                            sourceNode.getSuffix(),
                            sourceNode.hasLink(),
                            siblingPath);
                    destinationTree.addLabel(destinationDocument.getPath(),
                            destinationDocument.getLanguage(),
                            link.getLabel());
                }

            } else {
                // if the node already exists in the live
                // tree simply insert the label in the
                // live tree
                destinationDocument.getLink().setLabel(link.getLabel());
            }
        } catch (DocumentException e) {
            throw new SiteException(e);
        }

    }
View Full Code Here

TOP

Related Classes of org.apache.lenya.cms.site.SiteException

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.