Package it.eng.spago.error

Examples of it.eng.spago.error.EMFErrorHandler


      logger.debug("OUT");
    }   
  }
 
  public void validateInput() {
    EMFErrorHandler errorHandler = getErrorHandler();
    if (!errorHandler.isOKBySeverity(EMFErrorSeverity.ERROR)) {
      Collection errors = errorHandler.getErrors();
      Iterator it = errors.iterator();
      while (it.hasNext()) {
        EMFAbstractError error = (EMFAbstractError) it.next();
        if (error.getSeverity().equals(EMFErrorSeverity.ERROR)) {
          throw new SpagoBIEngineServiceException(getActionName(), error.getMessage(), null);
View Full Code Here


   * @throws Exception the exception
   */
  public void service(SourceBean request, SourceBean response) throws Exception {
    String message = (String) request.getAttribute("MESSAGEDET");
    logger.debug("begin of detail Data Source service with message =" +message);
    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(SpagoBIConstants.DETAIL_SELECT)) {
        getObjMetadata(request, response);
      } else if (message.trim().equalsIgnoreCase(SpagoBIConstants.DETAIL_MOD)) {
        modifyObjMetadata(request, SpagoBIConstants.DETAIL_MOD, response);
      } else if (message.trim().equalsIgnoreCase(SpagoBIConstants.DETAIL_NEW)) {
        newObjMetadata(response);
      } else if (message.trim().equalsIgnoreCase(SpagoBIConstants.DETAIL_INS)) {
        modifyObjMetadata(request, SpagoBIConstants.DETAIL_INS, response);
      } else if (message.trim().equalsIgnoreCase(SpagoBIConstants.DETAIL_DEL)) {
        deleteObjMetadata(request, SpagoBIConstants.DETAIL_DEL, response);
      }
    } catch (EMFUserError eex) {
      errorHandler.addError(eex);
      return;
    } catch (Exception ex) {
      EMFInternalError internalError = new EMFInternalError(EMFErrorSeverity.ERROR, ex);
      errorHandler.addError(internalError);
      return;
    }
  }
View Full Code Here

      IObjMetadataDAO dao=DAOFactory.getObjMetadataDAO();
      dao.setUserProfile(profile);
     
      ObjMetadata metaNew = recoverObjMetadataDetails(serviceRequest);
     
      EMFErrorHandler errorHandler = getErrorHandler();
      
      // if there are some validation errors into the errorHandler does not write into DB
      Collection errors = errorHandler.getErrors();
      if (errors != null && errors.size() > 0) {
        Iterator iterator = errors.iterator();
        while (iterator.hasNext()) {
          Object error = iterator.next();
          if (error instanceof EMFValidationError) {
View Full Code Here

    public static transient Logger logger = Logger.getLogger(EngineStartupExceptionAction.class);
 
  
  public void service(SourceBean serviceRequest, SourceBean serviceResponse)  {
   
    EMFErrorHandler errorHandler;
    Collection errors ;
    Iterator it;
   
    logger.debug("IN");
    try {
     
      errorHandler = getErrorHandler();
      Assert.assertNotNull(errorHandler, "error handler cannot be null");
     
      errors = errorHandler.getErrors();
      logger.debug("error handler contains [" + errors.size() + "] error/s");
     
      it = errors.iterator();
      while(it.hasNext()) {
        Object o = it.next();
View Full Code Here

   * @return A string representing the name of the correct publisher, which will
   * call the correct jsp reference.
   */
  public String getPublisherName(RequestContainer requestContainer, ResponseContainer responseContainer) {
    logger.debug("IN");
    EMFErrorHandler errorHandler = responseContainer.getErrorHandler();
   
    // if there are errors and they are only validation errors return the name for the detail publisher
    if(!errorHandler.isOK()) {
      if(GeneralUtilities.isErrorHandlerContainingOnlyValidationError(errorHandler)) {       
        logger.info("Publish: listMetadata"  );
        logger.debug("OUT");
        return "listMetadata";
      }
    }
   
    if (errorHandler.isOKBySeverity(EMFErrorSeverity.ERROR)){
      logger.info("Publish: listObjMetadata"  );
      logger.debug("OUT");     
      return new String("listObjMetadata");
    }
    else {
View Full Code Here

   * call the correct jsp reference.
   */
  public String getPublisherName(RequestContainer requestContainer, ResponseContainer responseContainer) {
    logger.debug("IN");

    EMFErrorHandler errorHandler = responseContainer.getErrorHandler();
   
    // get the module response
    SourceBean moduleResponse = (SourceBean)responseContainer.getServiceResponse().getAttribute("DetailObjMetadataModule");
   
    // if the module response is null throws an error and return the name of the errors publisher
    if(moduleResponse==null) {
      logger.error("Module response null");
      EMFUserError error = new EMFUserError(EMFErrorSeverity.ERROR, 10 );
      errorHandler.addError(error);     
      return "error";
    }
   
    // if there are errors and they are only validation errors return the name for the detail publisher
    if(!errorHandler.isOK()) {
      if(GeneralUtilities.isErrorHandlerContainingOnlyValidationError(errorHandler)) {
        logger.info("Publish: detailMetadata"  );
        return "detailObjMetadata";
      }
    }
   
    // if there are some errors into the errorHandler (not validation errors), return the name for the errors publisher
    if(!errorHandler.isOKBySeverity(EMFErrorSeverity.ERROR)) {
      return new String("error");
    }

        Object loop = moduleResponse.getAttribute("loopback");
        if (loop != null) {
View Full Code Here

   *
   * @throws Exception the exception
   */
  public void service(SourceBean serviceRequest, SourceBean serviceResponse) throws Exception {   
   
    EMFErrorHandler errorHandler = getErrorHandler();
   
//    if(ChannelUtilities.isPortletRunning()){
//      if(PortletUtilities.isMultipartRequest()) {
//        serviceRequest = ChannelUtilities.getSpagoRequestFromMultipart();
//        fillRequestContainer(serviceRequest, errorHandler);   
//      }
//    }
    String message = (String) serviceRequest.getAttribute("MESSAGEDET");
    TracerSingleton.log(SpagoBIConstants.NAME_MODULE, TracerSingleton.DEBUG,  "begin of detail Map modify/visualization service with message =" + message);
   
    try {
      if (message == null) {
        EMFUserError userError = new EMFUserError(EMFErrorSeverity.ERROR, 101);       
        TracerSingleton.log(SpagoBIConstants.NAME_MODULE, TracerSingleton.DEBUG,  "The message parameter is null");
        throw userError;
      }
      if (message.trim().equalsIgnoreCase(SpagoBIConstants.DETAIL_INS) ||
        message.trim().equalsIgnoreCase( SpagoBIConstants.DETAIL_MOD)){ 
        ValidationCoordinator.validate("PAGE", "DetailMapPost", this);
      }
      if (message.trim().equalsIgnoreCase(SpagoBIConstants.DETAIL_SELECT)) {
        getDetailMap(serviceRequest, serviceResponse);
      } else if (message.trim().equalsIgnoreCase(SpagoBIConstants.DETAIL_MOD)) {
        modDetailMap(serviceRequest, SpagoBIConstants.DETAIL_MOD, serviceResponse);
      } else if (message.trim().equalsIgnoreCase(SpagoBIConstants.DETAIL_NEW)) {
        newDetailMap(serviceResponse);
      } else if (message.trim().equalsIgnoreCase(SpagoBIConstants.DETAIL_INS)) {
        modDetailMap(serviceRequest, SpagoBIConstants.DETAIL_INS, serviceResponse);
      } else if (message.trim().equalsIgnoreCase(SpagoBIConstants.DETAIL_DEL)) {
        delDetailMap(serviceRequest, SpagoBIConstants.DETAIL_DEL, serviceResponse);
      } else if (message.trim().equalsIgnoreCase(MOD_DEL_MAP_FEATURE)) {
        delRelMapFeature(serviceRequest, serviceResponse);       
      } else if (message.trim().equalsIgnoreCase(MOD_RETURN_FROM_LOOKUP)) {
        insRelMapFeature(serviceRequest, serviceResponse);       
      }else if (message.trim().equalsIgnoreCase(MOD_DOWNLOAD_MAP)) {
        downloadFile(serviceRequest);       
      }
    } catch (EMFUserError eex) {
      errorHandler.addError(eex);
      return;
    } catch (Exception ex) {
      EMFInternalError internalError = new EMFInternalError(EMFErrorSeverity.ERROR, ex);
      errorHandler.addError(internalError);
      return;
    }
  }
View Full Code Here

    ISbiGeoMapsDAO daoGeoMaps=DAOFactory.getSbiGeoMapsDAO();
    daoGeoMaps.setUserProfile(profile);
   
    GeoMap mapNew = recoverMapDetails(serviceRequest);
   
    EMFErrorHandler errorHandler = getErrorHandler();
    
    // if there are some validation errors into the errorHandler does not write into DB
    Collection errors = errorHandler.getErrors();
    if (errors != null && errors.size() > 0) {
      Iterator iterator = errors.iterator();
      while (iterator.hasNext()) {
        Object error = iterator.next();
        if (error instanceof EMFValidationError) {
View Full Code Here

    dao.setUserProfile(profile);
   
    String mapId = (String) request.getAttribute("MAP_ID");
    String featureId = (String)request.getAttribute("FEATURE_ID")
    GeoMap map = DAOFactory.getSbiGeoMapsDAO().loadMapByID(new Integer(mapId));
    EMFErrorHandler errorHandler = getErrorHandler();
   
    // if there are some validation errors into the errorHandler does not write into DB
    Collection errors = errorHandler.getErrors();
    if (errors != null && errors.size() > 0) {
      Iterator iterator = errors.iterator();
      while (iterator.hasNext()) {
        Object error = iterator.next();
        if (error instanceof EMFValidationError) {
View Full Code Here

            null);
      }
    }
   
    ResponseContainer responseContainer = ResponseContainer.getResponseContainer();
    EMFErrorHandler errorHandler = responseContainer.getErrorHandler();
    //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

TOP

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

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.