org.apache.lenya.cms.publication.xsp
Class DocumentReferencesHelper

java.lang.Object
  extended by org.apache.lenya.cms.publication.xsp.DocumentReferencesHelper

public class DocumentReferencesHelper
extends java.lang.Object

Helper class for finding references to the current document.


Constructor Summary
DocumentReferencesHelper(java.util.Map objectModel)
          Create a new DocumentReferencesHelper
 
Method Summary
protected  java.lang.String[] getInternalLinks(java.io.File file)
          Finds all internal links in the given file.
 Document[] getInternalReferences()
          Find all internal references in the current document to documents which have not been published yet.
 Document[] getReferences(java.lang.String area)
          Find a list of document-ids which have references to the current document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentReferencesHelper

public DocumentReferencesHelper(java.util.Map objectModel)
                         throws org.apache.cocoon.ProcessingException
Create a new DocumentReferencesHelper

Parameters:
objectModel - the objectModel
Throws:
org.apache.cocoon.ProcessingException - if the page envelope could not be created.
Method Detail

getInternalLinks

protected java.lang.String[] getInternalLinks(java.io.File file)
                                       throws javax.xml.parsers.ParserConfigurationException,
                                              javax.xml.transform.TransformerException,
                                              org.xml.sax.SAXException,
                                              java.io.IOException
Finds all internal links in the given file. An internal link has the format /context-path/publication-id/foo

Parameters:
file -
Returns:
the webapp url of the link without the context prefix
Throws:
javax.xml.parsers.ParserConfigurationException
javax.xml.transform.TransformerException
org.xml.sax.SAXException
java.io.IOException

getReferences

public Document[] getReferences(java.lang.String area)
                         throws org.apache.cocoon.ProcessingException
Find a list of document-ids which have references to the current document.

Returns:
an array of documents if there are references, an empty array otherwise
Throws:
org.apache.cocoon.ProcessingException - if the search for references failed.

getInternalReferences

public Document[] getInternalReferences()
                                 throws org.apache.cocoon.ProcessingException
Find all internal references in the current document to documents which have not been published yet.

Returns:
an array of Document of references from the current document to documents which have not been published yet.
Throws:
org.apache.cocoon.ProcessingException - if the current document cannot be opened.


Copyright © 1999-2005 Apache Software Foundation. All Rights Reserved.