protected void buildTitleJSON() throws Exception {

    SourceBean confSB = null;
    String titleName = null;

    logger.debug("IN");
    confSB = (SourceBean) template.getAttribute(MobileConstants.TITLE_TAG);
    if (confSB == null) {
      logger.warn(
          "Cannot find title configuration settings: tag name " + MobileConstants.TITLE_TAG);
      return;
    }
    titleName = (String) confSB.getAttribute(MobileConstants.TITLE_VALUE_ATTR);

    //		Map<String, String> params = getNotNullPrameters();
    //
    String titleWithPars = titleName;
    //		if(params!=null && titleName!=null){
    //			titleWithPars = StringUtilities.substituteParametersInString(titleName, params, null,
    // false);
    //		}

    String titleStyle = (String) confSB.getAttribute(MobileConstants.TITLE_STYLE_ATTR);

    title.put("value", titleWithPars);
    title.put("style", titleStyle);
    documentProperties.put("title", title);
    logger.debug("OUT");
  }
Ejemplo n.º 2
0
  public Target(SourceBean sb) {
    documentLabel = (String) sb.getAttribute(WhatIfXMLTemplateParser.TAG_TG_DOCUMENT_LABEL);
    customizedView = (String) sb.getAttribute(WhatIfXMLTemplateParser.TAG_TG_CUSTOMIZED_VIEW);
    List list = sb.getAttributeAsList(WhatIfXMLTemplateParser.TAG_TG_TITLE);
    targetCross = (String) sb.getAttribute(WhatIfXMLTemplateParser.TAG_TG_TARGET);
    Object titleObject = list.get(0);
    if (titleObject instanceof String) {
      titleCross = (String) list.get(0);
    } else {
      titleCross = ((SourceBean) list.get(0)).getCharacters();
    }

    if (customizedView != null && customizedView.trim().equals("")) {
      customizedView = null;
    }
    SourceBean descrSB = (SourceBean) sb.getAttribute(WhatIfXMLTemplateParser.TAG_CN_DESCRIPTION);
    description = descrSB.getCharacters();
    SourceBean titleSB = (SourceBean) list.get(1);
    title = titleSB.getCharacters();
    List parametersSB = sb.getAttributeAsList(WhatIfXMLTemplateParser.TAG_TN_PARAMETERS);
    List parameterSB =
        ((SourceBean) parametersSB.get(0))
            .getAttributeAsList(WhatIfXMLTemplateParser.TAG_TN_PARAMETER);
    boolean hasParameters = parameterSB != null && !parameterSB.isEmpty();
    parameters = new ArrayList<TargetParameter>();
    if (hasParameters) {
      for (int i = 0; i < parameterSB.size(); i++) {
        SourceBean temp = (SourceBean) parameterSB.get(i);
        TargetParameter aParameter = new TargetParameter(temp);
        if (aParameter != null) {
          parameters.add(aParameter);
        }
      }
    }
  }
Ejemplo n.º 3
0
  /**
   * Creates a form into the jsp page.
   *
   * @throws JspException If any exception occurs.
   */
  protected void makeForm() throws JspException {

    String titleCode = (String) _layout.getAttribute("TITLE");
    SourceBean buttonsSB = (SourceBean) _layout.getAttribute("BUTTONS");
    List buttons = buttonsSB.getContainedSourceBeanAttributes();

    if (titleCode != null && buttons.size() > 0) {
      // String title = PortletUtilities.getMessage(titleCode, "messages");
      String title = msgBuilder.getMessage(titleCode, _bundle, httpRequest);
      _htmlStream.append(" <table class=\"header-table-portlet-section\">\n");
      _htmlStream.append("	<tr class='header-row-portlet-section'>\n");
      _htmlStream.append(
          "			<td class=\"header-title-column-portlet-section\" style=\"vertical-align:middle;padding-left:5px;\" >"
              + title
              + "</td>\n");
      _htmlStream.append("			<td class=\"header-empty-column-portlet-section\">&nbsp;</td>\n");
      _htmlStream.append(makeButton(buttons) + "\n");
      _htmlStream.append("	</tr>\n");
      _htmlStream.append(" </table>\n");
    }

    makeColumns();
    makeRows();
    makeNavigationButton();
  } // public void makeForm()
Ejemplo n.º 4
0
  /* (non-Javadoc)
   * @see it.eng.spago.dispatching.service.list.basic.IFaceBasicListService#getList(it.eng.spago.base.SourceBean, it.eng.spago.base.SourceBean)
   */
  public ListIFace getList(SourceBean request, SourceBean response) throws Exception {

    logger.debug("IN");
    ListIFace list = null;
    // get role / par id / par field name name
    String roleName = (String) request.getAttribute("roleName");
    String parIdStr = (String) request.getAttribute("parameterId");
    logger.debug("roleName=" + roleName);
    logger.debug("parameterId=" + parIdStr);

    Integer parId = new Integer(parIdStr);
    // check if the parameter use is manual input
    IParameterUseDAO parusedao = DAOFactory.getParameterUseDAO();
    ParameterUse paruse = parusedao.loadByParameterIdandRole(parId, roleName);
    Integer manInp = paruse.getManualInput();
    if (manInp.intValue() == 1) {
      String message = "";
      try {
        message =
            PortletUtilities.getMessage(
                "scheduler.fillparmanually", "component_scheduler_messages");
      } catch (Exception e) {
        IMessageBuilder msgBuilder = MessageBuilderFactory.getMessageBuilder();
        message =
            msgBuilder.getMessage("scheduler.fillparmanually", "component_scheduler_messages");
      }
      response.setAttribute(SpagoBIConstants.MESSAGE_INFO, message);
    } else {
      list = loadSpagoList(request, response, parId, roleName);
    }
    // fill response
    response.setAttribute(SpagoBIConstants.PUBLISHER_NAME, "LovLookupAjax");
    logger.debug("OUT");
    return list;
  }
Ejemplo n.º 5
0
  private Map applyService(Map parameters, BIObject biObject) {
    logger.debug("IN");

    try {
      Assert.assertNotNull(parameters, "Input [parameters] cannot be null");

      ObjTemplate objectTemplate = biObject.getActiveTemplate();
      byte[] content = objectTemplate.getContent();
      SourceBean sbTemplate = getTemplateAsSourceBean(content);

      if (sbTemplate.getName().equals(EngineConstants.SMART_FILTER_TAG)) {
        parameters.put(PARAM_SERVICE_NAME, "FORM_ENGINE_FROM_DATASET_START_ACTION");
        if (sbTemplate.containsAttribute("DATASET")) {
          String label =
              (String) ((SourceBean) sbTemplate.getAttribute("DATASET")).getAttribute("label");
          parameters.put("dataset_label", label);
        }
      } else {
        parameters.put(PARAM_SERVICE_NAME, "FORM_ENGINE_START_ACTION");
      }
      parameters.put(PARAM_MODALITY, "VIEW");

      parameters.put(PARAM_NEW_SESSION, "TRUE");
    } catch (Throwable t) {
      throw new RuntimeException("Cannot apply service parameters", t);
    } finally {
      logger.debug("OUT");
    }

    return parameters;
  }
 private void deleteConfiguredDocumentHandler(SourceBean request, SourceBean response)
     throws Exception {
   logger.debug("IN");
   String tempFolder = (String) request.getAttribute(DossierConstants.DOSSIER_TEMP_FOLDER);
   String confDocIdent = (String) request.getAttribute("configureddocumentidentifier");
   IDossierDAO dossierDao = new DossierDAOHibImpl();
   // delete the configured document
   dossierDao.deleteConfiguredDocument(confDocIdent, tempFolder);
   response.setAttribute(DossierConstants.PUBLISHER_NAME, "DossierLoopbackDossierDetail");
   logger.debug("OUT");
 }
Ejemplo n.º 7
0
  @Override
  public void service(SourceBean request, SourceBean response) {

    try {
      if (!request.containsAttribute(START)) request.setAttribute(START, new Integer(0));
      if (!request.containsAttribute(LIMIT)) request.setAttribute(LIMIT, Integer.MAX_VALUE);
    } catch (SourceBeanException e) {
      throw new SpagoBIEngineServiceException(getActionName(), e);
    }
    super.service(request, response);
  }
  private void goToDocumentRating(SourceBean request, String mod, SourceBean response)
      throws EMFUserError, SourceBeanException {

    RequestContainer requestContainer = this.getRequestContainer();
    SessionContainer session = requestContainer.getSessionContainer();
    SessionContainer permanentSession = session.getPermanentContainer();
    String objId = (String) request.getAttribute("OBJECT_ID");

    response.setAttribute("OBJECT_ID", objId);
    response.setAttribute("MESSAGEDET", mod);
    response.setAttribute(SpagoBIConstants.PUBLISHER_NAME, "ratingBIObjectPubJ");
  }
 private void newConfiguredDocumentHandler(SourceBean request, SourceBean response)
     throws SourceBeanException, EMFUserError {
   logger.debug("IN");
   String tempFolder = (String) request.getAttribute(DossierConstants.DOSSIER_TEMP_FOLDER);
   Object objIdObj = request.getAttribute(DossierConstants.DOSSIER_CONFIGURED_BIOBJECT_ID);
   if (!(objIdObj instanceof String)) {
     Map errBackPars = new HashMap();
     errBackPars.put("PAGE", DossierConstants.DOSSIER_MANAGEMENT_PAGE);
     errBackPars.put(DossierConstants.DOSSIER_TEMP_FOLDER, tempFolder);
     errBackPars.put(LightNavigationManager.LIGHT_NAVIGATOR_DISABLED, "true");
     errBackPars.put(SpagoBIConstants.OPERATION, DossierConstants.OPERATION_DETAIL_DOSSIER);
     throw new EMFUserError(
         EMFErrorSeverity.ERROR, "102", null, errBackPars, "component_dossier_messages");
   }
   String objIdStr = (String) objIdObj;
   Integer objId = new Integer(objIdStr);
   BIObject obj = null;
   List params = null;
   List roleList = null;
   try {
     IBIObjectDAO biobjdao = DAOFactory.getBIObjectDAO();
     obj = biobjdao.loadBIObjectById(objId);
     Integer id = obj.getId();
     IBIObjectParameterDAO biobjpardao = DAOFactory.getBIObjectParameterDAO();
     params = biobjpardao.loadBIObjectParametersById(id);
     IRoleDAO roleDao = DAOFactory.getRoleDAO();
     roleList = roleDao.loadAllRoles();
   } catch (Exception e) {
     SpagoBITracer.major(
         DossierConstants.NAME_MODULE,
         this.getClass().getName(),
         "newConfiguredDocumentHandler",
         "Error while loading biobje parameters and roles",
         e);
   }
   Integer id = obj.getId();
   String descr = obj.getDescription();
   String label = obj.getLabel();
   String name = obj.getName();
   Iterator iterParams = params.iterator();
   HashMap parNamesMap = new HashMap();
   HashMap parValueMap = new HashMap();
   while (iterParams.hasNext()) {
     BIObjectParameter par = (BIObjectParameter) iterParams.next();
     String parLabel = par.getLabel();
     String parUrlName = par.getParameterUrlName();
     parNamesMap.put(parLabel, parUrlName);
     parValueMap.put(parUrlName, "");
   }
   response.setAttribute("parnamemap", parNamesMap);
   response.setAttribute("parvaluemap", parValueMap);
   response.setAttribute("idobj", id);
   response.setAttribute("description", descr);
   response.setAttribute("label", label);
   response.setAttribute("name", name);
   response.setAttribute(DossierConstants.PUBLISHER_NAME, "DossierConfiguredDocumentDetail");
   logger.debug("OUT");
 }
Ejemplo n.º 10
0
  /**
   * Function not implemented. Thid method should not be called
   *
   * @param biobject The BIOBject to edit
   * @param profile the profile
   * @return the edits the document template build url
   * @throws InvalidOperationRequest the invalid operation request
   */
  public EngineURL getEditDocumentTemplateBuildUrl(Object biobject, IEngUserProfile profile)
      throws InvalidOperationRequest {

    EngineURL engineURL;
    BIObject obj;
    String documentId;
    Engine engine;
    String url;
    HashMap parameters;

    logger.debug("IN");

    try {
      obj = null;
      try {
        obj = (BIObject) biobject;
      } catch (ClassCastException cce) {
        logger.error("The input object is not a BIObject type", cce);
        return null;
      }

      documentId = obj.getId().toString();
      engine = obj.getEngine();
      url = engine.getUrl();

      parameters = new HashMap();

      // getting the dataset label from template, if smart filter is based on a dataset
      ObjTemplate objectTemplate = obj.getActiveTemplate();
      byte[] content = objectTemplate.getContent();
      SourceBean sbTemplate = getTemplateAsSourceBean(content);
      if (sbTemplate.getName().equals(EngineConstants.SMART_FILTER_TAG)
          && sbTemplate.containsAttribute("DATASET")) {
        String label =
            (String) ((SourceBean) sbTemplate.getAttribute("DATASET")).getAttribute("label");
        parameters.put("dataset_label", label);
      }
      parameters.put("document", documentId);
      parameters.put(PARAM_SERVICE_NAME, "FORM_ENGINE_TEMPLATE_BUILD_ACTION");
      parameters.put(PARAM_NEW_SESSION, "TRUE");
      parameters.put(PARAM_MODALITY, "EDIT");
      applySecurity(parameters, profile);

      engineURL = new EngineURL(url, parameters);
    } catch (Throwable t) {
      throw new RuntimeException("Cannot get engine edit URL", t);
    } finally {
      logger.debug("OUT");
    }

    return engineURL;
  }
Ejemplo n.º 11
0
 /**
  * This function returns the value of the attribute required, if existent in the xml field
  *
  * @param String attribute for which the value is requested
  * @return The value of the attribute
  */
 public String getValueFromStandardXmlValue(String attribute) {
   String valToReturn = "";
   if (valueXml != null) {
     try {
       SourceBean xmlValueSB = SourceBean.fromXMLString(valueXml);
       valToReturn = (String) xmlValueSB.getAttribute(attribute);
     } catch (SourceBeanException e) {
       logger.error("Source Bean Exception", e);
       e.printStackTrace();
     }
   }
   return valToReturn;
 }
  private String parametersJsonToXML(String parsJson) {
    String xml = null;
    SourceBean sb = null;

    try {
      JSONObject json = new JSONObject(parsJson);
      sb = new SourceBean("PARAMETERSLIST");
      SourceBean sb1 = new SourceBean("ROWS");
      for (Iterator iterator = json.keys(); iterator.hasNext(); ) {
        String key = (String) iterator.next();
        String t = json.getString(key);
        SourceBean b = new SourceBean("ROW");
        b.setAttribute("NAME", key);
        b.setAttribute("TYPE", t);
        sb1.setAttribute(b);
      }

      sb.setAttribute(sb1);
      xml = sb.toXML(false);
    } catch (Exception e) {
      logger.error("error in parsing " + parsJson, e);
    }
    Assert.assertNotNull(xml, "There was an error in parsing " + parsJson);

    return xml;
  }
 private void exitFromDetailHandler(SourceBean request, SourceBean response)
     throws EMFUserError, SourceBeanException {
   logger.debug("IN");
   String tempFolder = (String) request.getAttribute(DossierConstants.DOSSIER_TEMP_FOLDER);
   IDossierDAO dossierDao = DAOFactory.getDossierDAO();
   // cleans temp folder
   dossierDao.clean(tempFolder);
   // propagates dossier id (usefull to return to document main detail page if light navigator is
   // disabled)
   Integer dossierId = dossierDao.getDossierId(tempFolder);
   response.setAttribute(ObjectsTreeConstants.OBJECT_ID, dossierId.toString());
   response.setAttribute(DossierConstants.PUBLISHER_NAME, "ExitFromDossierDetailLoop");
   logger.debug("OUT");
 }
  /* (non-Javadoc)
   * @see it.eng.spagobi.commons.services.BaseProfileAction#service(it.eng.spago.base.SourceBean, it.eng.spago.base.SourceBean)
   */
  public void service(SourceBean request, SourceBean response) throws Exception {
    logger.debug("IN");

    String message = (String) request.getAttribute("MESSAGEDET");

    EMFErrorHandler errorHandler = getErrorHandler();
    try {
      if (message == null) {
        EMFUserError userError = new EMFUserError(EMFErrorSeverity.ERROR, 101);
        logger.debug("The message parameter is null");
        throw userError;
      }
      logger.debug("The message parameter is: " + message.trim());
      if (message.trim().equalsIgnoreCase("GOTO_DOCUMENT_RATE")) {
        goToDocumentRating(request, "GOTO_DOCUMENT_RATE", response);
      } else if (message.trim().equalsIgnoreCase("DOCUMENT_RATE")) {
        documentRating(request, "DOCUMENT_RATE", response);
      }
    } catch (EMFUserError eex) {
      errorHandler.addError(eex);
      return;
    } catch (Exception ex) {
      EMFInternalError internalError = new EMFInternalError(EMFErrorSeverity.ERROR, ex);
      errorHandler.addError(internalError);
      return;
    }

    logger.debug("OUT");
  }
Ejemplo n.º 15
0
  /**
   * Get a new ticket.
   *
   * @param session HttpSession
   * @return String
   * @throws IOException Signals that an I/O exception has occurred.
   */
  public String readTicket(HttpSession session) throws IOException {
    logger.debug("IN");
    String ticket = null;
    String spagoBiServerURL = EnginConf.getInstance().getSpagoBiServerUrl();
    logger.debug("Read spagoBiServerURL=" + spagoBiServerURL);
    SourceBean engineConfig = EnginConf.getInstance().getConfig();
    SourceBean sourceBeanConf = (SourceBean) engineConfig.getAttribute("FILTER_RECEIPT");
    String filterReceipt = (String) sourceBeanConf.getCharacters();
    logger.debug("Read filterReceipt=" + filterReceipt);
    filterReceipt = spagoBiServerURL + filterReceipt;

    Assertion assertion = (Assertion) session.getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION);
    ticket = assertion.getPrincipal().getProxyTicketFor(filterReceipt);

    logger.debug("OUT.ticket=" + ticket);
    return ticket;
  }
Ejemplo n.º 16
0
 private SourceBean getSubreports(Integer id, Map subreportMap) {
   SourceBean subreports = null;
   try {
     subreports = new SourceBean("ROWS");
     Iterator it = subreportMap.keySet().iterator();
     while (it.hasNext()) {
       String key = (String) it.next();
       Integer value = (Integer) subreportMap.get(key);
       SourceBean row = new SourceBean("ROW");
       row.setAttribute("MASTER_ID", id);
       row.setAttribute("SUBREPORT_ID", value);
       subreports.setAttribute(row);
     }
   } catch (SourceBeanException e) {
     e.printStackTrace();
   }
   return subreports;
 }
  private void saveDossierDetailHandler(SourceBean request, SourceBean response) throws Exception {
    logger.debug("IN");
    String tempFolder = (String) request.getAttribute(DossierConstants.DOSSIER_TEMP_FOLDER);
    IDossierDAO dossierDao = new DossierDAOHibImpl();
    List docs = dossierDao.getConfiguredDocumentList(tempFolder);
    EMFErrorHandler errorHandler = getErrorHandler();
    if (dossierDao.getPresentationTemplateFileName(tempFolder) == null) {
      logger.error("Presentation template not loaded");
      EMFValidationError error =
          new EMFValidationError(EMFErrorSeverity.ERROR, "", "104", "component_dossier_messages");
      errorHandler.addError(error);
    }
    if (dossierDao.getProcessDefinitionFileName(tempFolder) == null) {
      logger.error("Process definition file not loaded");
      EMFValidationError error =
          new EMFValidationError(EMFErrorSeverity.ERROR, "", "105", "component_dossier_messages");
      errorHandler.addError(error);
    }
    if (docs == null || docs.size() == 0) {
      logger.error("No documents configured in dossier");
      EMFValidationError error =
          new EMFValidationError(EMFErrorSeverity.ERROR, "", "106", "component_dossier_messages");
      errorHandler.addError(error);
    }

    Integer dossierId = dossierDao.getDossierId(tempFolder);
    adjustRequiredAnalyticalDrivers(dossierId, docs);
    if (errorHandler.isOKBySeverity(EMFErrorSeverity.ERROR)) {
      dossierDao.storeTemplate(dossierId, tempFolder);
    }

    String saveAndGoBackStr = (String) request.getAttribute("SAVE_AND_GO_BACK");
    boolean saveAndGoBack =
        saveAndGoBackStr != null && saveAndGoBackStr.trim().equalsIgnoreCase("TRUE");
    if (saveAndGoBack) {
      response.setAttribute(DossierConstants.PUBLISHER_NAME, "DossierSaveAndGoBackLoop");
    } else {
      response.setAttribute(DossierConstants.DOSSIER_SAVED_MSG_CODE_ATTR_NAME, "dossier.savedOk");
      response.setAttribute(DossierConstants.PUBLISHER_NAME, "DossierLoopbackDossierDetail");
    }

    logger.debug("OUT");
  }
Ejemplo n.º 18
0
  public SourceBean getTemplateAsSourceBean(byte[] content) {
    SourceBean templateSB = null;
    try {
      templateSB = SourceBean.fromXMLString(getTemplateAsString(content));
    } catch (SourceBeanException e) {
      logger.error("Error while getting template source bean", e);
    }

    return templateSB;
  }
 public void getFooter() throws Exception {
   String footer = (String) template.getCharacters(MobileConstants.FOOTER);
   if (footer != null) {
     //			Map<String, String> params = getNotNullPrameters();
     //			if(params!=null){
     //				footer= StringUtilities.substituteParametersInString(footer,params , null, false);
     //			}
   }
   documentProperties.put("footer", footer);
 }
Ejemplo n.º 20
0
  /**
   * Builds Table list columns, reading all request information.
   *
   * @throws JspException If any Exception occurs.
   */
  protected void makeColumns() throws JspException {

    SourceBean captionSB = (SourceBean) _layout.getAttribute("CAPTIONS");
    List captions = captionSB.getContainedSourceBeanAttributes();
    int numCaps = captions.size();

    _columns = new Vector();
    List columnsVector = _layout.getAttributeAsList("COLUMNS.COLUMN");
    for (int i = 0; i < columnsVector.size(); i++) {
      String hidden = (String) ((SourceBean) columnsVector.get(i)).getAttribute("HIDDEN");
      if (hidden == null || hidden.trim().equalsIgnoreCase("FALSE"))
        _columns.add((SourceBean) columnsVector.get(i));
    }
    if ((_columns == null) || (_columns.size() == 0)) {
      SpagoBITracer.critical("Admintools", "ListTag", "doStartTag", "Columns names not defined");
      throw new JspException("Columns names not defined");
    }

    _htmlStream.append("<TABLE style='width:100%;margin-top:1px'>\n");
    _htmlStream.append("	<TR>\n");

    for (int i = 0; i < _columns.size(); i++) {
      String nameColumn = (String) ((SourceBean) _columns.elementAt(i)).getAttribute("NAME");
      String labelColumnCode = (String) ((SourceBean) _columns.elementAt(i)).getAttribute("LABEL");
      String labelColumn = "";
      if (labelColumnCode != null)
        labelColumn = msgBuilder.getMessage(labelColumnCode, _bundle, httpRequest);
      else labelColumn = nameColumn;
      // if an horizontal-align is specified it is considered, otherwise the defualt is align='left'
      String align = (String) ((SourceBean) _columns.elementAt(i)).getAttribute("horizontal-align");
      if (align == null || align.trim().equals("")) align = "left";
      _htmlStream.append(
          "<TD class='portlet-section-header' valign='center' align='"
              + align
              + "'  >"
              + labelColumn
              + "</TD>\n");
    }
    for (int i = 0; i < numCaps; i++) {
      _htmlStream.append("<TD class='portlet-section-header' align='center'>&nbsp;</TD>\n");
    }
    _htmlStream.append("</TR>\n");
  }
 private void newTemplateHandler(SourceBean request, SourceBean response)
     throws SourceBeanException, EMFUserError {
   logger.debug("IN");
   String tempOOFileName = "";
   List confDoc = new ArrayList();
   WorkflowConfiguration workConf = new WorkflowConfiguration();
   List functionalities;
   try {
     functionalities = DAOFactory.getLowFunctionalityDAO().loadAllLowFunctionalities(true);
   } catch (EMFUserError e) {
     logger.error("Error while loading documents tree", e);
     throw new EMFUserError(EMFErrorSeverity.ERROR, 100);
   }
   response.setAttribute(SpagoBIConstants.FUNCTIONALITIES_LIST, functionalities);
   response.setAttribute(DossierConstants.CONFIGURED_DOCUMENT_LIST, confDoc);
   response.setAttribute(DossierConstants.PUBLISHER_NAME, "DossierDetail");
   response.setAttribute(DossierConstants.OO_TEMPLATE_FILENAME, tempOOFileName);
   response.setAttribute(DossierConstants.WORKFLOW_CONFIGURATION, workConf);
   logger.debug("OUT");
 }
 private String initDossier(SourceBean request, SourceBean response)
     throws EMFUserError, SourceBeanException {
   logger.debug("IN");
   String objIdStr = (String) request.getAttribute(SpagoBIConstants.OBJECT_ID);
   Integer objId = new Integer(objIdStr);
   BIObject dossier = DAOFactory.getBIObjectDAO().loadBIObjectById(objId);
   IDossierDAO dossierDao = DAOFactory.getDossierDAO();
   String tempFolder = dossierDao.init(dossier);
   logger.debug("OUT");
   return tempFolder;
 }
Ejemplo n.º 23
0
  public Object deserialize(Object o, Class clazz) throws DeserializationException {
    Object result = null;

    try {
      Assert.assertNotNull(o, "Input parameter [" + o + "] cannot be null");
      Assert.assertNotNull(o, "Input parameter [" + clazz + "] cannot be null");

      SourceBean xml = null;
      if (o instanceof SourceBean) {
        xml = (SourceBean) o;
      } else if (o instanceof String) {
        xml = SourceBean.fromXMLString((String) o);
      } else {
        throw new DeserializationException(
            "Impossible to deserialize from an object of type [" + o.getClass().getName() + "]");
      }

      Deserializer deserializer = mappings.get(clazz);
      if (deserializer == null) {
        throw new DeserializationException(
            "Impossible to deserialize to an object of type [" + clazz.getName() + "]");
      }

      if (xml.getAttribute("ROWS") != null) {
        List list = new ArrayList();
        List<SourceBean> rows = xml.getAttributeAsList("ROWS.ROW");
        for (SourceBean row : rows) {
          list.add(deserializer.deserialize(row, clazz));
        }
        result = list;
      } else {
        result = deserializer.deserialize(o, clazz);
      }
    } catch (Throwable t) {
      throw new DeserializationException("An error occurred while deserializing object: " + o, t);
    } finally {

    }

    return result;
  }
 private void dossierDetailHandler(SourceBean request, SourceBean response)
     throws SourceBeanException, EMFUserError {
   logger.debug("IN");
   String tempFolder = (String) request.getAttribute(DossierConstants.DOSSIER_TEMP_FOLDER);
   IDossierDAO dossierDao = new DossierDAOHibImpl();
   //		List roleList = null;
   //		try{
   //			IRoleDAO roleDao = DAOFactory.getRoleDAO();
   //			roleList = roleDao.loadAllRoles();
   //		} catch(Exception e) {
   //			logger.error("Error while loading all roles", e);
   //		}
   // get the current template file name
   String tempFileName = dossierDao.getPresentationTemplateFileName(tempFolder);
   if (tempFileName == null) tempFileName = "";
   // get list of the configured document
   List confDoc = dossierDao.getConfiguredDocumentList(tempFolder);
   // get the current process definition file name
   String procDefFileName = dossierDao.getProcessDefinitionFileName(tempFolder);
   if (procDefFileName == null) procDefFileName = "";
   // WorkflowConfiguration workConf = bookDao.getWorkflowConfiguration(pathConfBook);
   List functionalities;
   try {
     functionalities = DAOFactory.getLowFunctionalityDAO().loadAllLowFunctionalities(true);
   } catch (EMFUserError e) {
     logger.error("Error while loading documents tree", e);
     throw new EMFUserError(EMFErrorSeverity.ERROR, 100);
   }
   response.setAttribute(SpagoBIConstants.FUNCTIONALITIES_LIST, functionalities);
   response.setAttribute(DossierConstants.CONFIGURED_DOCUMENT_LIST, confDoc);
   response.setAttribute(DossierConstants.PUBLISHER_NAME, "DossierDetail");
   response.setAttribute(DossierConstants.OO_TEMPLATE_FILENAME, tempFileName);
   response.setAttribute(DossierConstants.WF_PROCESS_DEFINTIION_FILENAME, procDefFileName);
   logger.debug("OUT");
 }
Ejemplo n.º 25
0
 /**
  * Finds the user identifier from http request or from SSO system (by the http request in input).
  * Use the SsoServiceInterface for read the userId in all cases, if SSO is disabled use
  * FakeSsoService. Check spagobi_sso.xml
  *
  * @param httpRequest The http request
  * @param serviceRequest the service request
  * @return the current user unique identified
  * @throws Exception in case the SSO is enabled and the user identifier specified on service
  *     request is different from the SSO detected one.
  */
 private static String findUserId(SourceBean serviceRequest, HttpServletRequest httpRequest)
     throws Exception {
   logger.debug("IN");
   String userId = null;
   try {
     // Get userid from request
     Object requestUserIdObj = serviceRequest.getAttribute("userid");
     if (requestUserIdObj != null) userId = requestUserIdObj.toString();
   } finally {
     logger.debug("OUT: userId = [" + userId + "]");
   }
   return userId;
 }
Ejemplo n.º 26
0
  /**
   * Starting from the module <code>buttonsSB</code> object, creates all buttons for the jsp list.
   *
   * @param buttons The list of the buttons
   * @throws JspException If any exception occurs.
   */
  protected StringBuffer makeButton(List buttons) throws JspException {

    StringBuffer htmlStream = new StringBuffer();

    Iterator iter = buttons.listIterator();
    while (iter.hasNext()) {
      SourceBeanAttribute buttonSBA = (SourceBeanAttribute) iter.next();
      SourceBean buttonSB = (SourceBean) buttonSBA.getValue();
      List parameters = buttonSB.getAttributeAsList("PARAMETER");
      HashMap paramsMap = getParametersMap(parameters, null);

      String name = (String) buttonSB.getAttribute("name");
      String img = (String) buttonSB.getAttribute("image");
      String labelCode = (String) buttonSB.getAttribute("label");
      String label = msgBuilder.getMessage(labelCode, _bundle, httpRequest);

      PortletURL buttonUrl = createUrl(paramsMap);

      htmlStream.append("<td class=\"header-button-column-portlet-section\">\n");
      htmlStream.append(
          "<input type='image' "
              + "name='"
              + name
              + "' "
              + "title='"
              + label
              + "' "
              + "class='header-button-image-portlet-section'"
              + "src ='"
              + renderResponse.encodeURL(renderRequest.getContextPath() + img)
              + "' "
              + "alt='"
              + label
              + "'>\n");
      htmlStream.append("</td>\n");
    }

    return htmlStream;
  }
Ejemplo n.º 27
0
  public void service(SourceBean serviceRequest, SourceBean serviceResponse) throws Exception {
    logger.debug("IN");
    RequestContainer reqCont = RequestContainer.getRequestContainer();
    SessionContainer sessCont = reqCont.getSessionContainer();
    SessionContainer permSess = sessCont.getPermanentContainer();

    String theme_name = (String) serviceRequest.getAttribute(THEME_NAME);
    logger.debug("theme selected: " + theme_name);

    permSess.setAttribute(SpagoBIConstants.THEME, theme_name);

    IEngUserProfile profile =
        (IEngUserProfile) permSess.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
    userProfile = null;
    if (profile instanceof UserProfile) {
      userProfile = (UserProfile) profile;
    }

    MenuUtilities.getMenuItems(serviceRequest, serviceResponse, profile);

    serviceResponse.setAttribute("MENU_MODE", "ALL_TOP");
    serviceResponse.setAttribute(SpagoBIConstants.PUBLISHER_NAME, "userhome");
    logger.debug("OUT");
  }
 private void detailConfiguredDocumentHandler(SourceBean request, SourceBean response)
     throws Exception {
   logger.debug("IN");
   String tempFolder = (String) request.getAttribute(DossierConstants.DOSSIER_TEMP_FOLDER);
   String confDocIdent = (String) request.getAttribute("configureddocumentidentifier");
   // get configured document
   IDossierDAO dossierDao = new DossierDAOHibImpl();
   ConfiguredBIDocument confDoc = dossierDao.getConfiguredDocument(confDocIdent, tempFolder);
   // get parameter value map
   Map paramValueMap = confDoc.getParameters();
   // create parameter name map
   //		Integer idobj = confDoc.getId();
   String label = confDoc.getLabel();
   BIObject obj = DAOFactory.getBIObjectDAO().loadBIObjectByLabel(label);
   Integer idobj = obj.getId();
   IBIObjectParameterDAO biobjpardao = DAOFactory.getBIObjectParameterDAO();
   List params = biobjpardao.loadBIObjectParametersById(idobj);
   Iterator iterParams = params.iterator();
   Map paramNameMap = new HashMap();
   while (iterParams.hasNext()) {
     BIObjectParameter par = (BIObjectParameter) iterParams.next();
     String parLabel = par.getLabel();
     String parUrlName = par.getParameterUrlName();
     paramNameMap.put(parLabel, parUrlName);
   }
   // set attribute into response
   response.setAttribute("parnamemap", paramNameMap);
   response.setAttribute("parvaluemap", paramValueMap);
   //		response.setAttribute("idobj", confDoc.getId());
   response.setAttribute("description", confDoc.getDescription());
   response.setAttribute("label", confDoc.getLabel());
   response.setAttribute("name", confDoc.getName());
   response.setAttribute("logicalname", confDoc.getLogicalName());
   response.setAttribute(DossierConstants.PUBLISHER_NAME, "DossierConfiguredDocumentDetail");
   logger.debug("OUT");
 }
Ejemplo n.º 29
0
  /**
   * Gets all parameter information from a module, putting them into a HashMap.
   *
   * @param parameters The parameters list
   * @param row The value objects Source Bean
   * @return The parameters Hash Map
   * @throws JspException If any Exception occurred
   */
  protected HashMap getParametersMap(List parameters, SourceBean row) throws JspException {

    HashMap params = new HashMap();

    for (int i = 0; i < parameters.size(); i++) {
      String name = (String) ((SourceBean) parameters.get(i)).getAttribute("NAME");
      String type = (String) ((SourceBean) parameters.get(i)).getAttribute("TYPE");
      String value = (String) ((SourceBean) parameters.get(i)).getAttribute("VALUE");
      String scope = (String) ((SourceBean) parameters.get(i)).getAttribute("SCOPE");

      if (name != null) {
        // name = JavaScript.escape(name.toUpperCase());
        name = name.toUpperCase();

        if ((type != null) && type.equalsIgnoreCase("RELATIVE")) {
          if ((scope != null) && scope.equalsIgnoreCase("LOCAL")) {
            if (row == null) {
              SpagoBITracer.critical(
                  "adminTools",
                  "ListTag",
                  "getParametersMap",
                  "Impossible to associate local scope to the button");
              throw new JspException("Impossible to associate local scope to the button");
            } // if (row == null)
            Object valueObject = row.getAttribute(value);
            if (valueObject != null) value = valueObject.toString();
          } // if ((scope != null) && scope.equalsIgnoreCase("LOCAL"))
          else
            value =
                (String)
                    (ContextScooping.getScopedParameter(
                            _requestContainer, _responseContainer, value, scope))
                        .toString();
        } // if ((type != null) && type.equalsIgnoreCase("RELATIVE"))
        if (value == null) value = "";
        // value = JavaScript.escape(value);
      } // if (name != null)

      params.put(name, value);
    } // for (int i = 0; i < parameters.size(); i++)
    return params;
  } // protected StringBuffer getParametersList(Vector parameters, SourceBean row) throws
  protected void buildDrillJSON() throws Exception {

    SourceBean confSB = null;
    String documentName = null;

    logger.debug("IN");
    confSB = (SourceBean) template.getAttribute(MobileConstants.DRILL_TAG);
    if (confSB == null) {
      logger.debug("Cannot find title drill settings: tag name " + MobileConstants.DRILL_TAG);
      return;
    }
    documentName = (String) confSB.getAttribute(MobileConstants.DRILL_DOCUMENT_ATTR);
    List paramslist =
        (List)
            template.getAttributeAsList(
                MobileConstants.DRILL_TAG + "." + MobileConstants.PARAM_TAG);

    if (paramslist != null) {
      JSONArray params = new JSONArray();
      for (int k = 0; k < paramslist.size(); k++) {
        SourceBean param = (SourceBean) paramslist.get(k);
        String paramName = (String) param.getAttribute(MobileConstants.PARAM_NAME_ATTR);
        String paramType = (String) param.getAttribute(MobileConstants.PARAM_TYPE_ATTR);
        String paramValue = (String) param.getAttribute(MobileConstants.PARAM_VALUE_ATTR);
        JSONObject paramJSON = new JSONObject();
        paramJSON.put("paramName", paramName);
        paramJSON.put("paramType", paramType);

        // FILLS RELATIVE TYPE PARAMETERS' VALUE FROM REQUEST
        if (paramType.equalsIgnoreCase(MobileConstants.PARAM_TYPE_RELATIVE)) {
          paramJSON.putOpt("paramValue", paramsMap.get(paramName));
        } else {
          paramJSON.putOpt("paramValue", paramValue); // should be applied only on absolute type
        }
        params.put(paramJSON);
      }
      drill.put("params", params);
    }

    drill.put("document", documentName);

    logger.debug("OUT");
  }