Package org.apache.lenya.cms.publication

Examples of org.apache.lenya.cms.publication.DocumentException


        SiteTree tree = null;
        tree = getPublication().getTree(area);
        SiteTreeNode node = tree.getNode(documentid);

        if (node == null) {
            throw new DocumentException(
                "Document-id " + documentid + " not found.");
        }
        //if node is visible change to fale and vice versa
        String visibility = "false";
View Full Code Here


    /**
     * @see org.apache.lenya.modules.collection.Collection#remove(org.apache.lenya.cms.publication.Document)
     */
    public void remove(Document document) throws DocumentException {
        if (!documents().contains(document)) {
            throw new DocumentException("Collection [" + this + "] does not contain document ["
                    + document + "]");
        }
        documents().remove(document);
    }
View Full Code Here

        try {
            Element documentElement = helper.createElement(ELEMENT_DOCUMENT);
            documentElement.setAttributeNS(null, ATTRIBUTE_UUID, document.getUUID());
            return documentElement;
        } catch (final DOMException e) {
            throw new DocumentException(e);
        }
    }
View Full Code Here

     * @see org.apache.lenya.modules.collection.Collection#getFirstPosition(org.apache.lenya.cms.publication.Document)
     */
    public int getFirstPosition(Document document) throws DocumentException {
        load();
        if (!contains(document)) {
            throw new DocumentException("The collection [" + this
                    + "] does not contain the document [" + document + "]");
        }
        return documents().indexOf(document);
    }
View Full Code Here

    /**
     * @see org.apache.lenya.modules.collection.Collection#remove(org.apache.lenya.cms.publication.Document)
     */
    public void remove(Document document) throws DocumentException {
        if (!documents().contains(document)) {
            throw new DocumentException("Collection [" + this + "] does not contain document ["
                    + document + "]");
        }
        documents().remove(document);
    }
View Full Code Here

        try {
            Element documentElement = helper.createElement(ELEMENT_DOCUMENT);
            documentElement.setAttributeNS(null, ATTRIBUTE_UUID, document.getUUID());
            return documentElement;
        } catch (final DOMException e) {
            throw new DocumentException(e);
        }
    }
View Full Code Here

     * @see org.apache.lenya.modules.collection.Collection#getFirstPosition(org.apache.lenya.cms.publication.Document)
     */
    public int getFirstPosition(Document document) throws DocumentException {
        load();
        if (!contains(document)) {
            throw new DocumentException("The collection [" + this
                    + "] does not contain the document [" + document + "]");
        }
        return documents().indexOf(document);
    }
View Full Code Here

     */
    public boolean exists() throws DocumentException {
        try {
            return SourceUtil.exists(getSourceURI(), this.manager);
        } catch (Exception e) {
            throw new DocumentException(e);
        }
    }
View Full Code Here

        Document xmlDoc = null;
        try {
            xmlDoc = SourceUtil.readDOM(initialContentsURI, manager);
        } catch (Exception e) {
            throw new DocumentException("could not read document at location [ "
                    + initialContentsURI + "]", e);
        }

        if (getLogger().isDebugEnabled())
            getLogger().debug("transform sample file: ");
View Full Code Here

        Publication publication = document.getPublication();

        String[] languages = document.getLanguages();

        if (languages.length == 0) {
            throw new DocumentException("The document [" + document.getId()
                    + "] does not exist in any language!");
        }

        List languageList = Arrays.asList(languages);

        String existingLanguage = null;

        if (languageList.contains(preferredLanguage)) {
            existingLanguage = preferredLanguage;
        } else if (languageList.contains(publication.getDefaultLanguage())) {
            existingLanguage = publication.getDefaultLanguage();
        } else {
            existingLanguage = languages[0];
        }

        Document existingVersion = null;
        try {
            existingVersion = document.getIdentityMap().getLanguageVersion(document,
                    existingLanguage);
        } catch (DocumentBuildException e) {
            throw new DocumentException(e);
        }

        return existingVersion;
    }
View Full Code Here

TOP

Related Classes of org.apache.lenya.cms.publication.DocumentException

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.