setAnalyticalDriversValues(dossier, (Map) contextInstance.getVariable(DossierConstants.DOSSIER_PARAMETERS));
logger.debug("Dossier variable retrived " + dossier);
dossierDAO = DAOFactory.getDossierDAO();
pathTmpFold = dossierDAO.init(dossier);
logger.debug("Using tmp folder path " + pathTmpFold);
ConfigSingleton config = ConfigSingleton.getInstance();
tempDir = new File(pathTmpFold);
logger.debug("Create tmp folders " + tempDir);
// GETS OO TEMPLATE AND WRITE IT INTO THE TMP DIRECTORY
String templateFileName = dossierDAO.getPresentationTemplateFileName(pathTmpFold);
logger.debug("dossier oo template name retrived " + templateFileName);
InputStream contentTempIs = null;
byte[] contentTempBytes = null;
try {
contentTempIs = dossierDAO.getPresentationTemplateContent(pathTmpFold);
logger.debug("dossier oo template input stream retrived " + contentTempIs);
contentTempBytes = GeneralUtilities.getByteArrayFromInputStream(contentTempIs);
logger.debug("dossier oo template bytes retrived ");
} finally {
if (contentTempIs != null) contentTempIs.close();
}
// write template content into a temp file
File templateOOFile = new File(tempDir, templateFileName);
FileOutputStream fosTemplate = new FileOutputStream(templateOOFile);
fosTemplate.write(contentTempBytes);
logger.debug("oo template bytes written into a tmp file ");
fosTemplate.flush();
fosTemplate.close();
// INITIALIZE OFFICE ENVIRONMENT
SourceBean officeConnectSB = (SourceBean) config.getAttribute("DOSSIER.OFFICECONNECTION");
if (officeConnectSB == null) {
logger.error("Cannot found sourcebean DOSSIER.OFFICECONNECTION into configuration");
throw new Exception("Cannot found sourcebean DOSSIER.OFFICECONNECTION into configuration");
} else {
logger.debug("Dossier office connection sourcebean retrived " + officeConnectSB);