Package org.apache.lenya.cms.site

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


                            getLogger().debug("    Descendant: [" + version + "]");
                        }
                    }
                }
            } catch (PublicationException e) {
                throw new SiteException(e);
            }

            if (getLogger().isDebugEnabled()) {
                getLogger().debug("Obtaining requiring resources completed.");
            }
View Full Code Here


        SiteTree sourceTree = getTree(sourceDocument);
        SiteTree destinationTree = getTree(destinationDocument);

        SiteTreeNode sourceNode = sourceTree.getNode(sourceDocument.getId());
        if (sourceNode == null) {
            throw new SiteException("The node for source document [" + sourceDocument.getId()
                    + "] doesn't exist!");
        }

        SiteTreeNode[] siblings = sourceNode.getNextSiblings();
        SiteTreeNode parent = sourceNode.getParent();
        String parentId = "";
        if (parent != null) {
            parentId = parent.getAbsoluteId();
        }
        SiteTreeNode sibling = null;
        String siblingDocId = null;

        // same document ID -> insert at the same position
        if (sourceDocument.getId().equals(destinationDocument.getId())) {
            for (int i = 0; i < siblings.length; i++) {
                String docId = parentId + "/" + siblings[i].getId();
                sibling = destinationTree.getNode(docId);
                if (sibling != null) {
                    siblingDocId = docId;
                    break;
                }
            }
        }

        Label label = sourceNode.getLabel(sourceDocument.getLanguage());
        if (label == null) {
            // the node that we're trying to publish
            // doesn't have this language
            throw new SiteException("The node " + sourceDocument.getId()
                    + " doesn't contain a label for language " + sourceDocument.getLanguage());
        }
        SiteTreeNode destinationNode = destinationTree.getNode(destinationDocument.getId());
        if (destinationNode == null) {
            Label[] labels = { label };
View Full Code Here

                .getArea());

        SiteTreeNode node = tree.getNode(document.getId());

        if (node == null) {
            throw new SiteException("Sitetree node for document [" + document + "] does not exist!");
        }

        Label label = node.getLabel(document.getLanguage());

        if (label == null) {
            throw new SiteException("Sitetree label for document [" + document + "] in language ["
                    + document.getLanguage() + "]does not exist!");
        }

        if (node.getLabels().length == 1 && node.getChildren().length > 0) {
            throw new SiteException("Cannot delete last language version of document [" + document
                    + "] because this node has children.");
        }

        node.removeLabel(label);
View Full Code Here

        Label label = null;
        SiteTree siteTree = getTree(document);
        if (siteTree != null) {
            SiteTreeNode node = siteTree.getNode(document.getId());
            if (node == null) {
                throw new SiteException("Node for document [" + document + "] does not exist!");
            }
            label = node.getLabel(document.getLanguage());
        }

        if (label == null) {
            throw new SiteException("The label of document [" + document + "] is null!");
        }

        return label;
    }
View Full Code Here

                SiteTreeNode node = (SiteTreeNode) allNodes.get(i);
                documents[i - 1] = map.get(publication, area, node.getAbsoluteId());
            }
            return documents;
        } catch (DocumentBuildException e) {
            throw new SiteException(e);
        }
    }
View Full Code Here

     * @see org.apache.lenya.cms.site.SiteManager#add(org.apache.lenya.cms.publication.Document)
     */
    public void add(Document document) throws SiteException {

        if (contains(document)) {
            throw new SiteException("The document [" + document + "] is already contained!");
        }
        SiteTree tree = getTree(document);
        Label label = new Label("", document.getLanguage());

        SiteTreeNode node = tree.getNode(document.getId());
View Full Code Here

            availableDocument = document.getIdentityMap().get(document.getPublication(),
                    document.getArea(),
                    availableDocumentId,
                    document.getLanguage());
        } catch (DocumentBuildException e) {
            throw new SiteException(e);
        }
        return availableDocument;
    }
View Full Code Here

            String url = ServletHelper.getWebappURI(request);
            DocumentLocator loc;
            try {
                loc = pub.getDocumentBuilder().getLocator(pub.getFactory(), url);
            } catch (DocumentBuildException e) {
                throw new SiteException(e);
            }
            path = loc.getPath();
        } else {
            path = doc.getLocator().getPath();
        }
View Full Code Here

                String area = this.site.getArea();
                String type = pub.getArea(area).getDocument(node.getUuid(),
                        pub.getDefaultLanguage()).getMimeType();
                this.attributes.addAttribute("", ATTR_TYPE, ATTR_TYPE, "CDATA", type);
            } catch (PublicationException e) {
                throw new SiteException(e);
            }
        }

    }
View Full Code Here

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

        return sitetree;
    }
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.