com.jurismarches.vradi.services.managers
Class TemplateManager

java.lang.Object
  extended by com.jurismarches.vradi.services.managers.TemplateManager

public class TemplateManager
extends Object

Template manager. Handle:

Author:
chatellier

Field Summary
protected  com.sun.star.uno.XComponentContext context
           
protected  com.sun.star.lang.XComponent document
           
protected  com.sun.star.frame.XComponentLoader loader
           
 
Constructor Summary
TemplateManager(String templateDoc)
           
 
Method Summary
 com.sun.star.lang.XComponent createDoc(String templateFile)
          Créer un document
protected  String filePathToURL(String file)
          Converti si besoin l'url.
protected  void fillFields(Map<String,Object> myValues)
          Remplir les champs de mailing.
 void generateDoc(String targetFileName, Map<String,Object> myValues, File... images)
           
 String[] getDocumentFields()
          Gets the user fields or database fields of the ooo document.
 void insertImageInEndOfDocument(File image)
          Inserts an image to the end of the document.
 void storeDocComponent(com.sun.star.lang.XComponent xDoc, String storeUrl)
          Sauver un doc donné a l'url donnée au format pdf.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

protected com.sun.star.uno.XComponentContext context

loader

protected com.sun.star.frame.XComponentLoader loader

document

protected com.sun.star.lang.XComponent document
Constructor Detail

TemplateManager

public TemplateManager(String templateDoc)
                throws VradiException
Throws:
VradiException
Method Detail

generateDoc

public void generateDoc(String targetFileName,
                        Map<String,Object> myValues,
                        File... images)
                 throws VradiException
Throws:
VradiException

createDoc

public com.sun.star.lang.XComponent createDoc(String templateFile)
                                       throws VradiException
Créer un document

Parameters:
templateFile - Le template du document
Returns:
Le document construit
Throws:
VradiException - if document can't be created

storeDocComponent

public void storeDocComponent(com.sun.star.lang.XComponent xDoc,
                              String storeUrl)
                       throws VradiException
Sauver un doc donné a l'url donnée au format pdf.

Parameters:
xDoc - Le document a sauvegarder (XComponent)
storeUrl - Url complete du fichier (String)
Throws:
VradiException - if pdf can't be exported

filePathToURL

protected String filePathToURL(String file)
Converti si besoin l'url.


fillFields

protected void fillFields(Map<String,Object> myValues)
                   throws VradiException
Remplir les champs de mailing.

Parameters:
myValues - value to replace into template fields
Throws:
VradiException - if values can't be replaced

insertImageInEndOfDocument

public void insertImageInEndOfDocument(File image)
                                throws VradiException
Inserts an image to the end of the document.

Parameters:
image - the file containing the image to insert
Throws:
VradiException

getDocumentFields

public String[] getDocumentFields()
Gets the user fields or database fields of the ooo document.

Returns:
an array of String containing the field names


Copyright © 2009-2010 JurisMarches. All Rights Reserved.