try {
HttpSession session = servletIOManager.getHttpSession();
cleanSessionAttributes(session);
IEngUserProfile profile = (IEngUserProfile) session.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
ContentServiceProxy contentProxy = new ContentServiceProxy((String)profile.getUserUniqueIdentifier(),session);
String documentId = (String) servletIOManager.getRequest().getParameter(DOCUMENT_ID);
String subobj = (String) servletIOManager.getRequest().getParameter(SUBOBJ_ID);
String isSpagoBIDev = (String) servletIOManager.getRequest().getParameter(IS_DEVELOPER);
String isNewDoc = (String) servletIOManager.getRequest().getParameter(IS_NEW_DOCUMENT);
Locale locale = servletIOManager.getLocale();
String country = locale.getCountry();
String language = locale.getLanguage();
if(language == null || country == null){
language = (String) servletIOManager.getRequest().getParameter(LANG);
country = (String) servletIOManager.getRequest().getParameter(COUNTRY);
}
String pass = AuthUserImpl.encrypt(rb.getString("jpalo.admin.password"));
jpaloUrl = PALO_BASE_URL;
jpaloUrl += "?locale=";
jpaloUrl += language+"_"+country;
jpaloUrl += "&theme=gray&options=(";
jpaloUrl += "user=\"";
jpaloUrl += rb.getString("jpalo.admin.user");
jpaloUrl += "\",pass=\"";
jpaloUrl += pass;
jpaloUrl += "\"";
if((isNewDoc != null && isNewDoc.equals("true")) &&
(isSpagoBIDev != null && isSpagoBIDev.equals("true"))){
//new document--> template doesn't exist!
//open editor with no view
if(documentId != null && profile != null){
jpaloUrl += ",spagobiusr=\""+(String)profile.getUserUniqueIdentifier()+"\"";
jpaloUrl += ",spagobidoc=\""+documentId+"\"";
}
if(isSpagoBIDev != null){
jpaloUrl += ",isdeveloper=\""+isSpagoBIDev+"\"";
}
}else{
Content templateContent = contentProxy.readTemplate(documentId,new HashMap());
byte[] byteContent = null;
try {
BASE64Decoder bASE64Decoder = new BASE64Decoder();
byteContent = bASE64Decoder.decodeBuffer(templateContent.getContent());
String xmlSourceBean = new String(byteContent);
SourceBean sb =SourceBean.fromXMLString(xmlSourceBean);
template = new JPaloEngineTemplate(sb);
if(template == null){
if(documentId != null && profile != null){
jpaloUrl += ",spagobiusr=\""+(String)profile.getUserUniqueIdentifier()+"\"";
jpaloUrl += ",spagobidoc=\""+documentId+"\"";
}
if(isSpagoBIDev != null){
jpaloUrl += ",isdeveloper=\""+isSpagoBIDev+"\"";
}
}else{
//looks for cube name to create view
//NB: methods to create view dinamically available only if already logged in Jpalo
String cubeName = template.getCubeName();
//adds information about spagobi context of execution
if(documentId != null && profile != null){
jpaloUrl += ",spagobiusr=\""+(String)profile.getUserUniqueIdentifier()+"\"";
jpaloUrl += ",spagobidoc=\""+documentId+"\"";
}
if(subobj != null){
jpaloUrl += ",spagobisubobj=\""+subobj+"\"";
}