Package org.apache.lenya.cms.linking

Examples of org.apache.lenya.cms.linking.LinkTarget


        if (uri != null && uri.equals(NAV_NAMESPACE) && localName.equals(ELEM_LINK)) {
            AttributesImpl attrs = new AttributesImpl(attr);
            String href = attrs.getValue(ATTR_HREF);
            try {
                if (href != null && href.startsWith("lenya-document:")) {
                    LinkTarget target = linkResolver.resolve(this.area.getPublication()
                            .getFactory(), getLinkUri(href));
                    if (target.exists()) {
                        Document doc = target.getDocument();
                        int hrefIndex = attrs.getIndex(ATTR_HREF);
                        if (isFolderNode(doc)) {
                            attrs.removeAttribute(hrefIndex);
                        } else {
                            String externalLink = getExternalLink(doc);
View Full Code Here


            try {
                linkMgr = (LinkManager) this.manager.lookup(LinkManager.ROLE);
                resolver = (LinkResolver) this.manager.lookup(LinkResolver.ROLE);
                org.apache.lenya.cms.linking.Link[] links = linkMgr.getLinksFrom(this.document);
                for (int i = 0; i < links.length; i++) {
                    LinkTarget target = resolver.resolve(this.document, links[i].getUri());
                    if (target.exists()) {
                        Document doc = target.getDocument();
                        if (!doc.existsAreaVersion(Publication.LIVE_AREA)) {
                            docs.add(doc);
                        }
                    }
                }
View Full Code Here

            }

            resolver = (LinkResolver) this.manager.lookup(LinkResolver.ROLE);
            DocumentFactory factory = DocumentUtil.getDocumentFactory(this.manager, request);
            String webappUrl = ServletHelper.getWebappURI(request);
            LinkTarget target;
            if (factory.isDocument(webappUrl)) {
                Document currentDoc = factory.getFromURL(webappUrl);
                target = resolver.resolve(currentDoc, linkUri);
            }
            else {
                Link link = new Link(linkUri);
                contextualize(link, webappUrl);
                target = resolver.resolve(factory, link.getUri());
            }
           
            if (!target.exists()) {
                throw new SourceNotFoundException("Source not found: [" + location + "]");
            }

            Document doc = target.getDocument();

            if (target.isRevisionSpecified()) {
                if (queryString == null) {
                    queryString = "";
                }
                queryString += "rev=" + target.getRevisionNumber();
            }

            String format = null;
            if (queryString != null) {
                Query query = new Query(queryString);
View Full Code Here

            if (url.length() > PROTOCOL.length()) {
                String suffix = url.substring(PROTOCOL.length());
                String linkUri = "lenya-document:" + suffix;
                try {
                    Link link = getLink(linkUri, pubId, area);
                    LinkTarget target = IconUrlTransformer.this.linkResolver.resolve(
                            IconUrlTransformer.this.factory, link.getUri());
                    if (target.exists()) {
                        Document doc = target.getDocument();
                        ResourceType type = doc.getResourceType();
                        if (Arrays.asList(type.getFormats()).contains("icon")) {
                            name = type.getName();
                        }
                    }
View Full Code Here

                Document[] docs = area.getDocuments();
                for (int d = 0; d < docs.length; d++) {
                    Link[] links = linkManager.getLinksFrom(docs[d]);
                    for (int l = 0; l < links.length; l++) {
                        String uri = links[l].getUri();
                        LinkTarget target = linkResolver.resolve(docs[d], uri);
                        if (!target.exists()) {
                            BrokenLink brokenLink = new BrokenLink(docs[d].getCanonicalWebappURL(), uri);
                            brokenLinks.add(brokenLink);
                        }
                    }
                }
View Full Code Here

TOP

Related Classes of org.apache.lenya.cms.linking.LinkTarget

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.