Package it.eng.spago.error

Examples of it.eng.spago.error.EMFUserError


 
    try {
 
        if (obj == null) {
        logger.error("The input object is null.");
        throw new EMFUserError(EMFErrorSeverity.ERROR, "100", messageBundle);
        }
 
        if (!obj.getBiObjectTypeCode().equalsIgnoreCase("DASH")) {
        logger.error("The input object is not a dashboard.");
        throw new EMFUserError(EMFErrorSeverity.ERROR, "1001", messageBundle);
        }
 
        byte[] contentBytes = null;
        try {
      ObjTemplate template = DAOFactory.getObjTemplateDAO().getBIObjectActiveTemplate(obj.getId());
      if (template == null)
          throw new Exception("Active Template null");
      contentBytes = template.getContent();
      if (contentBytes == null)
          throw new Exception("Content of the Active template null");
        } catch (Exception e) {
        logger.error("Error while recovering template content: \n" , e);
        throw new EMFUserError(EMFErrorSeverity.ERROR, "1002", messageBundle);
        }
        // get bytes of template and transform them into a SourceBean
        SourceBean content = null;
        try {
        String contentStr = new String(contentBytes);
        content = SourceBean.fromXMLString(contentStr);
        } catch (Exception e) {
        logger.error("Error while converting the Template bytes into a SourceBean object");
        throw new EMFUserError(EMFErrorSeverity.ERROR, "1003", messageBundle);
        }
        // get information from the conf SourceBean and pass them into the
        // response
        String movie = (String) content.getAttribute("movie");
        String width = (String) content.getAttribute("DIMENSION.width");
        String height = (String) content.getAttribute("DIMENSION.height");
 
        String dataurl = (String) content.getAttribute("DATA.url");
       
        // get all the parameters for data url
        dataParameters = new LinkedHashMap();
        confParameters = new LinkedHashMap();
        drillParameters = new LinkedHashMap();
       
        SessionContainer session = requestContainer.getSessionContainer();
        IEngUserProfile profile = (IEngUserProfile) session.getPermanentContainer().getAttribute(
          IEngUserProfile.ENG_USER_PROFILE);
       
        SourceBean serviceRequest=requestContainer.getServiceRequest();
       
       // get all the parameters for dash configuration       
        defineDataParameters(content, obj, profile);
        defineConfParameters(content, profile);
        defineLinkParameters(content, serviceRequest);
       
        // set information into reponse
        response.setAttribute(ObjectsTreeConstants.SESSION_OBJ_ATTR, obj);
        response.setAttribute("movie", movie);
        response.setAttribute("dataurl", dataurl);
        response.setAttribute("width", width);
        response.setAttribute("height", height);
       
        response.delAttribute("confParameters");
        response.setAttribute("confParameters", getConfParameters());
        response.delAttribute("dataParameters");
        response.setAttribute("dataParameters", getDataParameters())
        response.delAttribute("drillParameters");
        response.setAttribute("drillParameters", getDrillParameters())

        // set information for the publisher
        response.setAttribute(SpagoBIConstants.PUBLISHER_NAME, "DASHBOARD");
 
    } catch (EMFUserError error) {
        logger.error("Cannot exec the dashboard", error);
        throw error;
    } catch (Exception e) {
        logger.error("Cannot exec the dashboard", e);
        throw new EMFUserError(EMFErrorSeverity.ERROR, "100", messageBundle);
    } finally {
        logger.debug("OUT");
    }
    }
View Full Code Here


     */
    public void executeSubObject(RequestContainer requestContainer, BIObject obj, SourceBean response,
      Object subObjectInfo) throws EMFUserError {
      // it cannot be invoked
    logger.error("SpagoBIDashboardInternalEngine cannot exec subobjects.");
    throw new EMFUserError(EMFErrorSeverity.ERROR, "101", messageBundle);
    }
View Full Code Here

    String modelNodeInstance = (String) requestContainer.getAttribute("model_node_instance");
    logger.info("ModelNodeInstance : " + modelNodeInstance);

    if (modelNodeInstance == null) {
      logger.error("The modelNodeInstance specified in the template is null");
      throw new EMFUserError(EMFErrorSeverity.ERROR, "10106", messageBundle);
    }

    List kpiRBlocks = new ArrayList();// List of KpiValues Trees for each Resource: it will be sent to the jsp

    if(!parametersObject.containsKey("ParKpiDate")){
View Full Code Here

    //setting locale, formats, profile, parameters, startDate, endDate
    setGeneralVariables(requestContainer);

    if (obj == null) {
      logger.error("The input object is null.");
      throw new EMFUserError(EMFErrorSeverity.ERROR, "100", messageBundle);
    }
    if (!obj.getBiObjectTypeCode().equalsIgnoreCase("KPI")) {
      logger.error("The input object is not a KPI.");
      throw new EMFUserError(EMFErrorSeverity.ERROR, "1001", messageBundle);
    }
    String userId = null;

    if(profile!=null){
      userId=(String) ((UserProfile) profile).getUserId();
    }
    else{
      userId=userIdField;
    }

    String documentId = obj.getId().toString();
    logger.debug("Loaded documentId:" + documentId);   
    ModelInstanceNode mI = null;
    try {
      // **************get the template*****************   
      SourceBean content = getTemplate(documentId);
      logger.debug("Got the template.");

      // Date for which we want to see the KpiValues
      this.dateOfKPI = new Date();
      this.parametersObject = readParameters(obj.getBiObjectParameters());
      addBIParameterDescriptions(obj, this.parametersObject);
     
      if(!parametersObject.containsKey("ParKpiDate")){
        String dateForDataset = getDateForDataset(dateOfKPI)
        parametersObject.put("ParKpiDate", dateForDataset);
      }
      logger.debug("Got the date for which the KpiValues have to be calculated. Date:" + this.dateOfKPI);

      // **************take informations on the modelInstance and its KpiValues*****************
      String modelNodeInstance = (String) content.getAttribute("model_node_instance");
      logger.info("ModelNodeInstance : " + modelNodeInstance);

      if (modelNodeInstance == null) {
        logger.error("The modelNodeInstance specified in the template is null");
        throw new EMFUserError(EMFErrorSeverity.ERROR, "10106", messageBundle);
      }
      String periodInstanceID = (String) content.getAttribute("periodicity_id");
      logger.debug("PeriodInstanceID : " + (periodInstanceID!=null ? periodInstanceID : "null"));

      if (periodInstanceID == null) {
        logger.debug("No periodInstID specified will use default one");
      }else{
        periodInstID = new Integer(periodInstanceID);
      }
      getSetConf(content);
      logger.debug("Setted the configuration of the template");

      List kpiRBlocks = new ArrayList();// List of KpiValues Trees for each Resource: it will be sent to the jsp

      // gets the ModelInstanceNode
      mI = DAOFactory.getModelInstanceDAO().loadModelInstanceByLabel(modelNodeInstance, this.dateOfKPI);
      if (mI==null) {
        logger.error("MODEL INSTANCE IS NULL, CHECK model_node_instance IN DOCUMENT TEMPLATE.!!!!!!!!!!!!!!");
      }else {
        logger.debug("ModelInstanceNode, ID=" + (mI.getModelInstanceNodeId()!=null ? mI.getModelInstanceNodeId().toString():"null"));
        modelInstanceRootId = (mI.getModelInstanceNodeId()!=null ? mI.getModelInstanceNodeId() : null );
        logger.debug("Loaded the modelInstanceNode with LABEL " + modelNodeInstance);
      }

      if(dataset_multires){//if datasets return a value for each resource
        this.resources = mI.getResources(); //Set all the Resources for the Model Instance
        logger.info("Dataset multiresource");

        calculateAndInsertKpiValueWithResources(mI.getModelInstanceNodeId(),this.resources);   
        logger.info("Inserted all values!!");
        return;     
      }

      // I set the list of resources of that specific ModelInstance
      if (this.resources == null || this.resources.isEmpty()) {
        this.resources = mI.getResources();
      }
      logger.debug("Setted the List of Resources related to the specified Model Instance");

      KpiLineVisibilityOptions options = setVisibilityOptions();

      //sets up register values
      ModelInstanceNode modI = DAOFactory.getModelInstanceDAO().loadModelInstanceById(mI.getModelInstanceNodeId(), dateOfKPI);

      logger.debug("Setted the List of Kpis that does not need to be persisted in db");
      if (this.resources == null || this.resources.isEmpty()) {
        logger.debug("There are no resources assigned to the Model Instance");
        KpiResourceBlock block = new KpiResourceBlock();
        block.setD(this.dateOfKPI);
        block.setParMap(this.parametersObject);
        KpiLine line = getBlock(mI.getModelInstanceNodeId(), null);
        block.setRoot(line);
        block.setTitle(name);
        block.setSubtitle(subName);
        block.setOptions(options);
        logger.debug("Setted the tree Root.");
        kpiRBlocks.add(block);

      }else {
        Iterator resourcesIt = this.resources.iterator();
        while (resourcesIt.hasNext()) {
          Resource r = (Resource) resourcesIt.next();
          logger.info("Resource: " + r.getName());
          KpiResourceBlock block = new KpiResourceBlock();
          block.setR(r);
          block.setD(dateOfKPI);
          block.setParMap(this.parametersObject);
          KpiLine line = getBlock(mI.getModelInstanceNodeId(), r);
          block.setRoot(line);
          block.setOptions(options);
          logger.debug("Setted the tree Root.");
          kpiRBlocks.add(block);
        }
      }

      try {
        logger.debug("Successfull kpis creation");

        response.setAttribute(ObjectsTreeConstants.SESSION_OBJ_ATTR, obj);
        response.setAttribute(SpagoBIConstants.PUBLISHER_NAME, publisher_Name);
        response.setAttribute("metadata_publisher_Name", metadata_publisher_Name);
        response.setAttribute("trend_publisher_Name", trend_publisher_Name);

        if (name != null) {
          response.setAttribute("title", name);
          response.setAttribute("styleTitle", styleTitle);
        }
        if (subName != null) {
          response.setAttribute("subName", subName);
          response.setAttribute("styleSubTitle", styleSubTitle);
        }
        response.setAttribute("kpiRBlocks", kpiRBlocks);
        response.setAttribute(AuditManager.AUDIT_ID, auditId);
        kpiResultsList = kpiRBlocks;
      } catch (Exception eex) {
        EMFUserError userError = new EMFUserError(EMFErrorSeverity.ERROR, 10107);
        userError.setBundle("messages");
        throw userError;
      }
      logger.debug("OUT");
    } catch (EMFUserError e) {
      logger.error("User Error", e);
      errorHandler.addError(e);
      if(auditId!=null){
        auditManager.updateAudit(auditId, null, new Long(System.currentTimeMillis()), "EXECUTION_FAILED", e
              .getMessage(), null);   
         }
    }  
    catch (Exception e) {
      EMFUserError userError = new EMFUserError(EMFErrorSeverity.ERROR, 101);
      logger.error("Generic Error", e);
      errorHandler.addError(userError)
      if(auditId!=null){
        auditManager.updateAudit(auditId, null, new Long(System.currentTimeMillis()), "EXECUTION_FAILED", e
              .getMessage(), null);   
View Full Code Here

      String contentStr = new String(contentBytes);
      content = SourceBean.fromXMLString(contentStr);
      logger.debug("Got the content of the template");
    } catch (Exception e) {
      logger.error("Error while converting the Template bytes into a SourceBean object");
      EMFUserError userError = new EMFUserError(EMFErrorSeverity.ERROR, 2003);
      userError.setBundle("messages");
      throw userError;
    }
    logger.debug("OUT");
    return content;
  }
View Full Code Here

      tx.commit();
    } catch (HibernateException he) {
      logger.error("Error while loading the udp with label " + label, he);
      if (tx != null)
        tx.rollback();
      throw new EMFUserError(EMFErrorSeverity.ERROR, 100);
    } finally {
      if (tmpSession!=null){
        if (tmpSession.isOpen()) tmpSession.close();
      }
    }
View Full Code Here

      tx.commit();
    } catch (HibernateException he) {
      logger.error("Error while loading the udp with label " + label, he);
      if (tx != null)
        tx.rollback();
      throw new EMFUserError(EMFErrorSeverity.ERROR, 100);
    } finally {
      if (tmpSession!=null){
        if (tmpSession.isOpen()) tmpSession.close();
      }
    }
View Full Code Here

    } catch (HibernateException he) {
      logger.error("Error while loading the list of SbiUdp", he)
      if (tx != null)
        tx.rollback()
      throw new EMFUserError(EMFErrorSeverity.ERROR, 9104);
   
    } finally {
      if (aSession != null) {
        if (aSession.isOpen())
          aSession.close();
View Full Code Here

    } catch (HibernateException he) {
      logger.error("Error while loading the list of Resources", he)
      if (tx != null)
        tx.rollback()
      throw new EMFUserError(EMFErrorSeverity.ERROR, 9104);
   
    } finally {
      if (aSession != null) {
        if (aSession.isOpen())
          aSession.close();
View Full Code Here

   */
  public void executeSubObject(RequestContainer requestContainer, BIObject obj, SourceBean response,
      Object subObjectInfo) throws EMFUserError {
    // it cannot be invoked
    logger.error("SpagoBIKpiInternalEngine cannot exec subobjects.");
    throw new EMFUserError(EMFErrorSeverity.ERROR, "101", messageBundle);
  }
View Full Code Here

TOP

Related Classes of it.eng.spago.error.EMFUserError

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.