Package it.eng.spago.error

Examples of it.eng.spago.error.EMFErrorHandler


   */
  private void execute(ExecutionInstance instance, SubObject subObj, String[] vpParameters,
      SourceBean response) {
    logger.debug("IN");

    EMFErrorHandler errorHandler = getErrorHandler();

    BIObject obj = instance.getBIObject();
    // GET ENGINE ASSOCIATED TO THE BIOBJECT
    Engine engine = obj.getEngine();

    // GET THE TYPE OF ENGINE (INTERNAL / EXTERNAL) AND THE SUITABLE
    // BIOBJECT TYPES
    Domain engineType = null;
    Domain compatibleBiobjType = null;
    try {
      engineType = DAOFactory.getDomainDAO().loadDomainById(
          engine.getEngineTypeId());
      compatibleBiobjType = DAOFactory.getDomainDAO().loadDomainById(
          engine.getBiobjTypeId());
    } catch (EMFUserError error) {
      logger.error("Error retrieving document's engine information",
          error);
      errorHandler.addError(error);
      return;
    }
    String compatibleBiobjTypeCd = compatibleBiobjType.getValueCd();
    String biobjTypeCd = obj.getBiObjectTypeCode();

    // CHECK IF THE BIOBJECT IS COMPATIBLE WITH THE TYPES SUITABLE FOR THE
    // ENGINE
    if (!compatibleBiobjTypeCd.equalsIgnoreCase(biobjTypeCd)) {
      // the engine document type and the biobject type are not compatible
      logger.warn("Engine cannot execute input document type: "
          + "the engine " + engine.getName() + " can execute '"
          + compatibleBiobjTypeCd + "' type documents "
          + "while the input document is a '" + biobjTypeCd + "'.");
      Vector params = new Vector();
      params.add(engine.getName());
      params.add(compatibleBiobjTypeCd);
      params.add(biobjTypeCd);
      errorHandler.addError(new EMFUserError(EMFErrorSeverity.ERROR,
          2002, params));
      return;
    }

    // GET USER PROFILE
    IEngUserProfile profile = getUserProfile();

    // IF USER CAN'T EXECUTE THE OBJECT RETURN
    if (!canExecute(profile, obj))
      return;

    // GET THE EXECUTION ROLE FROM SESSION
    String executionRole = instance.getExecutionRole();

    // IF THE ENGINE IS EXTERNAL
    if ("EXT".equalsIgnoreCase(engineType.getValueCd())) {
      try {
        response.setAttribute(SpagoBIConstants.PUBLISHER_NAME, "ExecuteBIObjectPageExecution");
        // instance the driver class
        String driverClassName = obj.getEngine().getDriverName();
        IEngineDriver aEngineDriver = (IEngineDriver) Class.forName(
            driverClassName).newInstance();
        // get the map of the parameters
        Map mapPars = null;

        if (subObj != null)
          mapPars = aEngineDriver.getParameterMap(obj, subObj,
              profile, executionRole);
        else
          mapPars = aEngineDriver.getParameterMap(obj, profile,
              executionRole);

        // adding or substituting parameters for viewpoint
        if (vpParameters != null) {
          for (int i = 0; i < vpParameters.length; i++) {
            String param = (String) vpParameters[i];
            String name = param.substring(0, param.indexOf("="));
            String value = param.substring(param.indexOf("=") + 1);
            if (mapPars.get(name) != null) {
              mapPars.remove(name);
              mapPars.put(name, value);
            } else
              mapPars.put(name, value);
          }
        }

        //GET DOC CONFIG FOR DOCUMENT COMPOSITION
        if (contextManager.get("docConfig") != null)
          mapPars.put("docConfig", (DocumentCompositionConfiguration) contextManager.get("docConfig"));

        // set into the reponse the parameters map
        response.setAttribute(ObjectsTreeConstants.REPORT_CALL_URL,
            mapPars);
        if (subObj != null) {
          response.setAttribute(SpagoBIConstants.SUBOBJECT, subObj);
        }

      } catch (Exception e) {
        logger.error("Error During object execution", e);
        errorHandler.addError(new EMFUserError(EMFErrorSeverity.ERROR,
            100));
      }

      // IF THE ENGINE IS INTERNAL
    } else {

      String className = engine.getClassName();
      logger.debug("Try instantiating class " + className
          + " for internal engine " + engine.getName() + "...");
      InternalEngineIFace internalEngine = null;
      // tries to instantiate the class for the internal engine
      try {
        if (className == null && className.trim().equals(""))
          throw new ClassNotFoundException();
        internalEngine = (InternalEngineIFace) Class.forName(className)
        .newInstance();
      } catch (ClassNotFoundException cnfe) {
        logger.error("The class ['" + className
            + "'] for internal engine " + engine.getName()
            + " was not found.", cnfe);
        Vector params = new Vector();
        params.add(className);
        params.add(engine.getName());
        errorHandler.addError(new EMFUserError(EMFErrorSeverity.ERROR,
            2001, params));
        return;
      } catch (Exception e) {
        logger.error("Error while instantiating class " + className, e);
        errorHandler.addError(new EMFUserError(EMFErrorSeverity.ERROR,
            100));
        return;
      }

      logger
      .debug("Class "
          + className
          + " instantiated successfully. Now engine's execution starts.");

      // starts engine's execution
      try {

        if (subObj != null)
          internalEngine.executeSubObject(this.getRequestContainer(),
              obj, response, subObj);
        else
          internalEngine.execute(this.getRequestContainer(), obj,
              response);
      } catch (EMFUserError e) {
        logger.error("Error while engine execution", e);
        errorHandler.addError(e);
      } catch (Exception e) {
        logger.error("Error while engine execution", e);
        errorHandler.addError(new EMFUserError(EMFErrorSeverity.ERROR,
            100));
      }

    }
    logger.debug("OUT");
View Full Code Here


   * call the correct jsp reference.
   */
  public String getPublisherName(RequestContainer requestContainer, ResponseContainer responseContainer) {

    //SourceBean serviceRequest = requestContainer.getServiceRequest();
    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)) {
        return "listModalitiesChecks";
      }
    }
   
    if (errorHandler.isOKBySeverity(EMFErrorSeverity.ERROR))
      return new String("listModalitiesChecks");
    else
      return new String("error");
  }
View Full Code Here

   */

  public String getPublisherName(RequestContainer requestContainer, ResponseContainer responseContainer) {

    //SourceBean serviceRequest = requestContainer.getServiceRequest();
    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)) {
        return "checklist";
      }
    }
   
    if (errorHandler.isOKBySeverity(EMFErrorSeverity.ERROR))
      return new String("checklist");
    else
      return new String("error");
  }
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) {

    EMFErrorHandler errorHandler = responseContainer.getErrorHandler();
   
    // get the module response
    SourceBean moduleResponse = (SourceBean)responseContainer.getServiceResponse().getAttribute("DetailChecksModule");
   
    // if the module response is null throws an error and return the name of the errors publisher
    if(moduleResponse==null) {
      SpagoBITracer.major(SpagoBIConstants.NAME_MODULE,
                "DetailModalitiesChecksPublisher",
                "getPublisherName",
                "Module response null");
      EMFUserError error = new EMFUserError(EMFErrorSeverity.ERROR, 10 );
      errorHandler.addError(error);
      return new String("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)) {
        return "detailModalitiesChecks";
      }
    }
   
   
    // 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

  public String getPublisherName(RequestContainer request, ResponseContainer response) {
   
    SourceBean moduleResponse = (SourceBean)response.getServiceResponse().getAttribute("CheckLinksModule");
       
    // SourceBean serviceRequest = requestContainer.getServiceRequest();
    EMFErrorHandler errorHandler = response.getErrorHandler();
   
    // if there are errors and they are only validation errors
    if(!errorHandler.isOK()) {
      if(GeneralUtilities.isErrorHandlerContainingOnlyValidationError(errorHandler)) {
        return getPublisherName(moduleResponse);
      }
    }
   
    if (errorHandler.isOKBySeverity(EMFErrorSeverity.ERROR))
      return getPublisherName(moduleResponse);
    else
      return new String("error");
   
   
View Full Code Here

    List rowsVector = null;
    if (rowsSourceBean != null)
      rowsVector = rowsSourceBean.getAttributeAsList(DataRow.ROW_TAG);
    if ((rowsSourceBean == null)) {//|| (rowsVector.size() == 0)) {
      EMFErrorHandler engErrorHandler = serviceRequestContext.getErrorHandler();
      engErrorHandler.addError(new EMFUserError(EMFErrorSeverity.INFORMATION, 10001));
    } // if ((rowsSourceBean == null) || (rowsVector.size() == 0))
    else{
      for (int i = 0; i < rowsVector.size(); i++)
        paginator.addRow(rowsVector.get(i));
    }
View Full Code Here

   * call the correct jsp reference.
   */
  public String getPublisherName(RequestContainer requestContainer, ResponseContainer responseContainer) {

    // recover error handler
    EMFErrorHandler errorHandler = responseContainer.getErrorHandler();
        // recover all the module responses
    getModuleResponses(responseContainer)
    // if there are no module response return error publisher
    if (noModuledResponse()) {
      notifyError(errorHandler, "Module response is null");
      return getErrorPublisherName();
    }
    // if there are some errors into the errorHandler, return the name for the errors publisher
    if(!errorHandler.isOKByCategory(EMFErrorCategory.USER_ERROR) || !errorHandler.isOKByCategory(EMFErrorCategory.INTERNAL_ERROR)) {
      return  getTestErrorPublisherName();
    }
    // check if the execution flow is after a test request   
        boolean afterTest = false;
        Object testExecuted = getAttributeFromModuleResponse(listTestLovMR, "testExecuted");
        if(testExecuted != null) {
          afterTest = true;
        }
       
    // check if the execution flow is after a delete request   
        boolean afterDelete = false;
        Object afterDeleteObj = getAttributeFromModuleResponse(detailMR, "afterDeleteLoop");
        if(afterDeleteObj != null) {
          afterDelete = true;
        }
       
        // check if the request want to do the test but he must fill profile attributes
        boolean fillProfAttr = false;
        Object profAttToFillList = getAttributeFromModuleResponse(detailMR, SpagoBIConstants.PROFILE_ATTRIBUTES_TO_FILL);
        if(profAttToFillList != null) {
          fillProfAttr = true;
        }
    // if there are errors and they are only validation errors return the name for the detail publisher
    if(!errorHandler.isOK()) {
      if(GeneralUtilities.isErrorHandlerContainingOnlyValidationError(errorHandler)) {
        if(afterTest) {
          return "detailLovTestResult";
        } else {
          return getModuleDefaultPublisherName();
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) {

    EMFErrorHandler errorHandler = responseContainer.getErrorHandler();
   
    // get the module response
    SourceBean moduleResponse = (SourceBean)responseContainer.getServiceResponse().getAttribute("ListObjParuseModule");
   
    // if the module response is null throws an error and return the name of the errors publisher
    if (moduleResponse==null) {
      SpagoBITracer.major(SpagoBIConstants.NAME_MODULE,
                "ListObjParusePublisher",
                "getPublisherName",
                "Module response null");
      EMFUserError error = new EMFUserError(EMFErrorSeverity.ERROR, 10 );
      errorHandler.addError(error);
      return "error";
    }
   
    // if there are some errors into the errorHandler returns the name for the errors publisher
    if(!errorHandler.isOKBySeverity(EMFErrorSeverity.ERROR)) return "error";

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

   * call the correct jsp reference.
   */

  public String getPublisherName(RequestContainer requestContainer, ResponseContainer responseContainer) {
    SessionContainer session = requestContainer.getSessionContainer();
    EMFErrorHandler errorHandler = responseContainer.getErrorHandler();
   
    // get the module response
    SourceBean moduleResponse = (SourceBean)responseContainer.getServiceResponse().getAttribute("DetailParameterModule");
   
    // 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)) {
        return "detailParameter";
      }
    }
   
   
    // 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");
    }

    //getting publisher name dependently from navigation (ie. document - insert parameter - back)
        Object loop = moduleResponse.getAttribute("loopback");
View Full Code Here

   * call the correct jsp reference.
   */
  public String getPublisherName(RequestContainer requestContainer, ResponseContainer responseContainer) {

    //SourceBean serviceRequest = requestContainer.getServiceRequest();
    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)) {
        return "listParameters";
      }
    }
   
    if (errorHandler.isOKBySeverity(EMFErrorSeverity.ERROR))
      return new String("listParameters");
    else
      return new String("error");
  }
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.