HashMap requestParameters;
if(template == null) {
contentProxy = getContentServiceProxy();
if(contentProxy == null) {
throw new SpagoBIEngineStartupException("SpagoBIQbeEngine",
"Impossible to instatiate proxy class [" + ContentServiceProxy.class.getName() + "] " +
"in order to retrive the template of document [" + documentId + "]");
}
requestParameters = ParametersDecoder.getDecodedRequestParameters(httpRequest);
if(documentId != null){
template = contentProxy.readTemplate(documentId, requestParameters);
}
else if(documentLabel != null){
template = contentProxy.readTemplateByLabel(documentLabel, requestParameters);
}
try {
if(template == null)throw new SpagoBIEngineRuntimeException("There are no template associated to document [" + documentId + "]");
templateContent = DECODER.decodeBuffer(template.getContent());
} catch (Throwable e) {
SpagoBIEngineStartupException engineException = new SpagoBIEngineStartupException("COmmonj", "Impossible to get template's content", e);
engineException.setDescription("Impossible to get template's content: " + e.getMessage());
engineException.addHint("Check the document's template");
throw engineException;
}
}
return templateContent;
}