Search in sources :

Example 1 with DocumentGeneratingException

use of com.cehome.apimanager.pdf.exception.DocumentGeneratingException in project api-manager by cehome-com.

the class PdfDocumentGenerator method generate.

public boolean generate(String template, DocumentVo documentVo, String outputFile) throws DocumentGeneratingException {
    Map<String, Object> variables = new HashMap<String, Object>();
    try {
        variables = documentVo.fillDataMap();
        String htmlContent = this.htmlGenerator.generate(template, variables);
        this.generate(htmlContent, outputFile);
        logger.info("The document [primarykey=" + documentVo.findPrimaryKey() + "] is generated successfully,and stored in [" + outputFile + "]");
    } catch (Exception e) {
        String error = "The document [primarykey=" + documentVo.findPrimaryKey() + "] is failed to generate";
        logger.error(error);
        throw new DocumentGeneratingException(error, e);
    }
    return true;
}
Also used : HashMap(java.util.HashMap) DocumentGeneratingException(com.cehome.apimanager.pdf.exception.DocumentGeneratingException) DocumentGeneratingException(com.cehome.apimanager.pdf.exception.DocumentGeneratingException)

Aggregations

DocumentGeneratingException (com.cehome.apimanager.pdf.exception.DocumentGeneratingException)1 HashMap (java.util.HashMap)1