com.silverpeas.kmelia.export
Class ODTDocumentBuilder

java.lang.Object
  extended by com.silverpeas.kmelia.export.ODTDocumentBuilder

public class ODTDocumentBuilder
extends Object

A builder of an ODT document based on a given template and from a specified Kmelia publication.


Constructor Summary
ODTDocumentBuilder()
           
 
Method Summary
static String anODTAt(String documentPath)
          A convenient method to improve the readability in the call of the method buildFromPublication().
static ODTDocumentBuilder anODTDocumentBuilder()
          Gets an instance of a builder of ODT documents.
 File buildFrom(KmeliaPublication publication, String documentPath)
          Builds an ODT document at the specified path and from the specified Kmelia publication.
 ODTDocumentBuilder forUser(com.stratelia.webactiv.beans.admin.UserDetail user)
          Informs this builder the build is for the specified user.
protected  KmeliaBm getKmeliaService()
          Gets the Kmelia service.
protected  com.stratelia.webactiv.beans.admin.OrganizationController getOrganizationService()
          Gets the organization controller.
 ODTDocumentBuilder inLanguage(String language)
          Informs this builder the prefered language to use for the content of the documents to build.
 ODTDocumentBuilder inTopic(String topicId)
          Informs explicitly the topic to consider when building a document from publications.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ODTDocumentBuilder

public ODTDocumentBuilder()
Method Detail

anODTDocumentBuilder

public static ODTDocumentBuilder anODTDocumentBuilder()
Gets an instance of a builder of ODT documents.

Returns:
an ODTDocumentBuilder instance.

forUser

public ODTDocumentBuilder forUser(com.stratelia.webactiv.beans.admin.UserDetail user)
Informs this builder the build is for the specified user. If not set, then the builds will be performed for the publication creator. Only information the user is authorized to access will be rendered into the ODT documents.

Parameters:
user - the user for which the build of the documents should be done.
Returns:
itself.

inLanguage

public ODTDocumentBuilder inLanguage(String language)
Informs this builder the prefered language to use for the content of the documents to build. If the publication doesn't have a content in the specified language, then it is the default publication's text that will be taken (whatever the language in which it is written).

Parameters:
language - the language in which the text should be displayed in the built documents.
Returns:
itself.

inTopic

public ODTDocumentBuilder inTopic(String topicId)
Informs explicitly the topic to consider when building a document from publications. This topic can be provided by the caller itself as it was already computed for the publications to export and according to the rights of the user on a such topic. If this topic isn't provided explicitly, then it is computed directly from the publication and according to the rights of the user on the topics the publication belongs to.

Parameters:
topicId - the topic to explicitly consider.
Returns:
itself.

anODTAt

public static String anODTAt(String documentPath)
A convenient method to improve the readability in the call of the method buildFromPublication(). It can be uses as: File odt = builder.buildFrom(mypublication, anODTAt("/tmp/foo.odt"));

Parameters:
documentPath - the path of the document to build.
Returns:
the document path as passed as parameter.

buildFrom

public File buildFrom(KmeliaPublication publication,
                      String documentPath)
Builds an ODT document at the specified path and from the specified Kmelia publication. If an error occurs while building the document, a runtime exception DocumentBuildException is thrown.

Parameters:
publication - the publication from which an ODT document is built.
documentPath - the path of the ODT document to build.
Returns:
the file corresponding to the ODT document built from the publication.

getKmeliaService

protected KmeliaBm getKmeliaService()
Gets the Kmelia service.

Returns:
an instance of KmeliaBm.

getOrganizationService

protected com.stratelia.webactiv.beans.admin.OrganizationController getOrganizationService()
Gets the organization controller.

Returns:
an instance of OrganizationController.


Copyright © 2016 Silverpeas. All Rights Reserved.