Document doc=(Document)docMap.get(key);
String label=doc.getSbiObjLabel();
logger.debug("Document "+label);
// get document container information
DocumentContainer documentContainer=documentsMap.get(label);
// Recover BIObject
IBIObjectDAO dao=DAOFactory.getBIObjectDAO();
BIObject objectID=dao.loadBIObjectByLabel(label);
BIObject object=null;
// get roles
Collection roles = null;
roles = ((UserProfile)profile).getRolesForUse();
for (Iterator iterator2 = roles.iterator(); iterator2.hasNext();) {
Object role = (Object) iterator2.next();
try{
object=dao.loadBIObjectForExecutionByIdAndRole(objectID.getId(), role.toString());
}
catch (Exception e) {
logger.error("error in recovering the role");
}
if(object!=null) break;
}
// set parameters: from url retrieved by iframe, fill BiObjectParameters with value
logger.debug("fill parameters from URL");
fillBIObjectWithParameterValues(object, currentConfs.get(label));
//only for highcharts document is necessary to pass the svg parameter to the engine.
//At the moment it force the svgContent into description attribute of the object (only for background execution)
if (currentConfs.get("SVG_"+label) != null){
Map tmpSvg = currentConfs.get("SVG_"+label).getParameters();
String tmpContent = tmpSvg.get("SVG_"+label).toString();
object.setDescription(tmpContent);
}
logger.debug("call execution proxy");
// Calling execution proxy
ExecutionProxy proxy = new ExecutionProxy();
proxy.setBiObject(object);
// if engine is Birt, export in PDF, elsewhere in JPG
Engine engine = object.getEngine();
String driverName = engine.getDriverName();
if (driverName != null && driverName.endsWith("BirtReportDriver")) {
output = "PDF";
} else {
output = "JPG";
}
byte[] returnByteArray = proxy.exec(profile, "EXPORT", output);
// add content retrieved to Document Container
logger.debug("add content retrieved to Document Container");
if( returnByteArray.length==0)logger.warn("empty byte array retrieved for document "+label);
documentContainer.setContent(returnByteArray);
documentContainer.setDocumentLabel(label);
documentContainer.setDocumentType(object.getBiObjectTypeCode());
// FileOutputStream fos=null;
// File dir = new File("C:/zzzEsportazione.pdf");
// File toReturn=null;
// if(i==0){