Package it.eng.spago.error

Examples of it.eng.spago.error.EMFErrorHandler


  public String getPublisherName(RequestContainer requestContainer,
      ResponseContainer responseContainer) {
    logger.debug("IN");
    try {
      EMFErrorHandler errorHandler = responseContainer.getErrorHandler();
 
      // get the module response
      SourceBean executeModuleResponse = (SourceBean) responseContainer
          .getServiceResponse().getAttribute("ExecuteBIObjectModule");
      /*SourceBean checklistLookupModule = (SourceBean) responseContainer.getServiceResponse().getAttribute(
          "ChecklistLookupModalityValuesModule");*/
     
      // if the module response is null throws an error and return the name of
      // the errors publisher
      //if (executeModuleResponse == null && checklistLookupModule == null) {
      if (executeModuleResponse == null ) {
        logger.error("Module response null");
        EMFUserError error = new EMFUserError(EMFErrorSeverity.ERROR, 10);
        errorHandler.addError(error);
        return new String("error");
      }
     
      // if there are some errors into the errorHandler return the name for
      // the errors publisher
      if (!errorHandler.isOKBySeverity(EMFErrorSeverity.ERROR)) {
        if (executeModuleResponse != null) {
          Object publisherNameSetObj = executeModuleResponse
              .getAttribute(SpagoBIConstants.PUBLISHER_NAME);
          if (publisherNameSetObj != null) {
            String publisherName = (String) publisherNameSetObj;
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();
       
    if (errorHandler.isOKBySeverity(EMFErrorSeverity.ERROR))
      return new String("ViewSnapshot");
    else
      return new String("error");
  }
View Full Code Here

        delFunctionality(request, AdmintoolsConstants.DETAIL_DEL,
            response);
      }

    } catch (EMFUserError eex) {
      EMFErrorHandler errorHandler = getErrorHandler();
      errorHandler.addError(eex);
      return;
    } catch (Exception ex) {
      EMFInternalError internalError = new EMFInternalError(
          EMFErrorSeverity.ERROR, ex);
      EMFErrorHandler errorHandler = getErrorHandler();
      errorHandler.addError(internalError);
      return;
    }
  }
View Full Code Here

        LowFunctionality funct = DAOFactory.getLowFunctionalityDAO()
            .loadLowFunctionalityByPath(path, false);
        response.setAttribute(FUNCTIONALITY_OBJ, funct);
      }
    } catch (EMFUserError eex) {
      EMFErrorHandler errorHandler = getErrorHandler();
      errorHandler.addError(eex);
      return;
    } catch (Exception ex) {
      SpagoBITracer.major(AdmintoolsConstants.NAME_MODULE,
          "DetailFunctionalityModule", "getDetailFunctionality",
          "Cannot fill response container", ex);
View Full Code Here

      // **********************************************************************
      LowFunctionality lowFunct = recoverLowFunctionalityDetails(request,
          mod);
      response.setAttribute(FUNCTIONALITY_OBJ, lowFunct);
      response.setAttribute(AdmintoolsConstants.MODALITY, mod);
      EMFErrorHandler errorHandler = getErrorHandler();
      // if(mod.equalsIgnoreCase(AdmintoolsConstants.DETAIL_INS)) {
      // String pathParent =
      // (String)request.getAttribute(AdmintoolsConstants.PATH_PARENT);
      // response.setAttribute(AdmintoolsConstants.PATH_PARENT,
      // pathParent);
      // }

      // 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) {
            Integer parentFolderId = lowFunct.getParentId();
            LowFunctionality parentFolder = null;
            if (parentFolderId != null) {
              parentFolder = DAOFactory.getLowFunctionalityDAO()
                  .loadLowFunctionalityByID(parentFolderId,
                      false);
            }
            if (parentFolder == null) {
              throw new Exception("Parent folder not available.");
            } else {
              response.setAttribute(
                  AdmintoolsConstants.PATH_PARENT,
                  parentFolder.getPath());
            }
            return;
          }
        }
      }

      if (mod.equalsIgnoreCase(AdmintoolsConstants.DETAIL_INS)) {
        SessionContainer permSess = getRequestContainer()
            .getSessionContainer().getPermanentContainer();
        IEngUserProfile profile = (IEngUserProfile) permSess
            .getAttribute(IEngUserProfile.ENG_USER_PROFILE);
        DAOFactory.getLowFunctionalityDAO().insertLowFunctionality(
            lowFunct, profile);
      } else if (mod.equalsIgnoreCase(AdmintoolsConstants.DETAIL_MOD)) {
        DAOFactory.getLowFunctionalityDAO().modifyLowFunctionality(
            lowFunct);
        // at this point erase inconsistent child roles that have been
        // deleted from parents
        // prova debug
        // Set set1 = new HashSet();
        // loadRolesToErase(lowFunct,set1);
        Set set = new HashSet();
        loadRolesToErase(lowFunct, set);
        DAOFactory.getLowFunctionalityDAO()
            .deleteInconsistentRoles(set);
      }

    } catch (EMFUserError eex) {
      EMFErrorHandler errorHandler = getErrorHandler();
      errorHandler.addError(eex);
      return;
    } catch (Exception ex) {
      SpagoBITracer.major(AdmintoolsConstants.NAME_MODULE,
          "DetailFunctionalityModule", "modDettaglioFunctionality",
          "Cannot fill response container", ex);
View Full Code Here

        IEngUserProfile profile = (IEngUserProfile) permSess
            .getAttribute(IEngUserProfile.ENG_USER_PROFILE);
        funcdao.eraseLowFunctionality(funct, profile);
      }
    } catch (EMFUserError eex) {
      EMFErrorHandler errorHandler = getErrorHandler();
      errorHandler.addError(eex);
      return;
    } catch (Exception ex) {
      SpagoBITracer.major(AdmintoolsConstants.NAME_MODULE,
          "DetailFunctionalityModule", "delFunctionality",
          "Cannot fill response container", ex);
View Full Code Here

        funct.setCreateRoles(createRoles);
        response.setAttribute(FUNCTIONALITY_OBJ, funct);
      }

    } catch (EMFUserError eex) {
      EMFErrorHandler errorHandler = getErrorHandler();
      errorHandler.addError(eex);
      return;
    } catch (Exception ex) {
      SpagoBITracer.major(AdmintoolsConstants.NAME_MODULE,
          "DetailFunctionalityModule", "newDettaglioFunctionality",
          "Cannot prepare page for the insertion", ex);
View Full Code Here

            TracerSingleton.log(SpagoBIConstants.NAME_MODULE, TracerSingleton.CRITICAL,
                "ErrorTag::doStartTag:: responseContainer null");
            throw new JspException("responseContainer null");
        } // if (responseContainer == null)
        StringBuffer output = new StringBuffer();
        EMFErrorHandler engErrorHandler = responseContainer.getErrorHandler();

      Collection errors = engErrorHandler.getErrors();
     
     
      if (!errors.isEmpty()) {
        output.append("<div class='errors-object-details-div'>\n");
        output.append("  <div class='div_detail_errors'>\n");
View Full Code Here

      mp.addBodyPart(mbp1);
      mp.addBodyPart(mbp2);
      // add the Multipart to the message
      msg.setContent(mp);
      // send message
      EMFErrorHandler errorHandler = getErrorHandler();
      if(errorHandler.isOKBySeverity(EMFErrorSeverity.ERROR)) {
        Transport.send(msg);
        retCode = OK;
      }else{
        logger.error("Error while executing and sending object "+ errorHandler.getStackTrace());
        retCode = ERROR;
      }

     
View Full Code Here

     
      Monitor monitor = null;
      PortletTracer.info(Constants.NOME_MODULO, "AdapterPortlet", "processService", "Invocato");
        try {
            SourceBean serviceRequest = null;
            EMFErrorHandler emfErrorHandler = null;
           
            RequestContainer requestContainer = new RequestContainer();
            RequestContainer.setRequestContainer(requestContainer);
            ResponseContainer responseContainer = new ResponseContainer();
            ResponseContainer.setResponseContainer(responseContainer);
            RequestContextIFace requestContext = new DefaultRequestContext(requestContainer,
                    responseContainer);
           
            // try to get from the request the loopback attribute. If present the method has to serve
            // a loopback request (the method has been called from the doRenderService)
            // if not present is a normal request
            boolean isLoop = request.getAttribute(Constants.PUBLISHING_MODE_LOOPBACK) != null;
            if(isLoop) {
              // remove from the request the loopback attribute
              request.removeAttribute(Constants.PUBLISHING_MODE_LOOPBACK);
              //String responseContainerName = (String)request.getAttribute(Constants.RESPONSE_CONTAINER);
             
              //**************** START MODFIFICATION ZERBETTO 09-10-2006 ****************
              // get from the session the previous response container name
              //String responseContainerName = (String)request.getPortletSession().getAttribute(RESPONSE_CONTAINER_NAME);
              // get from the session the previous response container
              //ResponseContainer loopbackResponseContainer = (ResponseContainer)request.getPortletSession().getAttribute(responseContainerName);
              ResponseContainer loopbackResponseContainer = (ResponseContainer)request.getPortletSession().getAttribute(Constants.RESPONSE_CONTAINER);
              //**************** END MODFIFICATION ZERBETTO 09-10-2006 ****************
             
                TracerSingleton.log(
                    Constants.NOME_MODULO,
                    TracerSingleton.DEBUG,
                    "AdapterPortlet::service: loop-back rilevato");
                serviceRequest =
                    loopbackResponseContainer.getLoopbackServiceRequest();
                if (serviceRequest == null)
                    serviceRequest = new SourceBean(Constants.SERVICE_REQUEST);
                else {
                    Object newServiceRequest =
                        serviceRequest.getAttribute(Constants.SERVICE_REQUEST);
                    if ((newServiceRequest != null)
                        && (newServiceRequest instanceof SourceBean))
                        serviceRequest = (SourceBean) newServiceRequest;
                } // if (serviceRequest == null)
                emfErrorHandler = loopbackResponseContainer.getErrorHandler();
                if (emfErrorHandler == null)
                    emfErrorHandler = new EMFErrorHandler();
            } // if (isLoop)
            else {
              monitor = MonitorFactory.start("controller.adapter.portlet");
              serviceRequest = new SourceBean(Constants.SERVICE_REQUEST);
              requestContainer.setServiceRequest(serviceRequest);
             
                boolean isMultipart = false;
               
                // only an ActionRequest can have a multipart content
                if (request instanceof ActionRequest && PortletFileUpload.isMultipartContent((ActionRequest) request)) {
                  isMultipart = true;
                }
               
                if (isMultipart) {
                  handleMultipartForm((ActionRequest) request, requestContext);
                } else {
                  handleSimpleForm(request, requestContext);
                }
             
              // ***************** START SERVICE ***********************************************
              String actionName = (String) request.getAttribute("ACTION_NAME");
              if(actionName!=null) {
                request.removeAttribute("ACTION_NAME");
                serviceRequest.setAttribute("ACTION_NAME", actionName);
                serviceRequest.setAttribute(NEW_SESSION, "TRUE");
              }
              String page = (String)request.getAttribute("PAGE");
              if(page!=null) {
                request.removeAttribute("PAGE");
                serviceRequest.setAttribute("PAGE", page);
                serviceRequest.setAttribute(NEW_SESSION, "TRUE");
             
            // *******************************************************************************************
              emfErrorHandler = new EMFErrorHandler();
            }
           
            //***************** NAVIGATION CONTROL *******************************************************
            String navigation = getInitParameter("light_navigation");
            if ("enabled".equalsIgnoreCase(navigation)) {
              serviceRequest = LightNavigationManager.controlLightNavigation(request, serviceRequest);
            }
            //updates service request after LightNavigationManager control
            requestContainer.setServiceRequest(serviceRequest);
            //********************************************************************************************
           
            boolean isRequestedSessionIdValid = true;
            PortletSession session = request.getPortletSession(true);
            /*
            if (session.isNew()) {
                String newSessionString =
                    (String) (serviceRequest.getAttribute(NEW_SESSION));
                isRequestedSessionIdValid =
                    ((newSessionString != null)
                        && (newSessionString.equalsIgnoreCase("TRUE")));
            } // if (session.isNew())
            */
            synchronized (session) {
               
              // try to get the previous request container. Download from the session the previous
              // request container name and if it isn't null (it's null only formthe first invocation)
              //use it for download the request container object
              RequestContainer parentRequestContainer = null;
             
              //**************** START MODFIFICATION ZERBETTO 09-10-2006 ****************
              //String parentRequestContainerName =
              //  (String) session.getAttribute(REQUEST_CONTAINER_NAME);
              //if(parentRequestContainerName != null) {
              //  parentRequestContainer = (RequestContainer) session.getAttribute(parentRequestContainerName);
              //}
              parentRequestContainer = (RequestContainer) session.getAttribute(Constants.REQUEST_CONTAINER);
              //**************** END MODFIFICATION ZERBETTO 09-10-2006 ****************

                if (!Navigator.isNavigatorEnabled()) {
                    if (parentRequestContainer == null)
                        requestContainer.setSessionContainer(
                            new PortletSessionContainer(true));
                    else
                        requestContainer.setSessionContainer(
                            parentRequestContainer.getSessionContainer());
                }
                else {
                    if (parentRequestContainer == null)
                        requestContainer.setSessionContainer(
                            new PortletSessionContainer(true));
                    else {
                        requestContainer.setSessionContainer(
                            new PortletSessionContainer(false));
                        requestContainer.setParent(parentRequestContainer);
                    } // if (parentRequestContainer == null) else
                } // if (!Navigator.isNavigatorEnabled())
               
                //**************** START MODFIFICATION ZERBETTO 09-10-2006 ****************
                //session.setAttribute(Constants.REQUEST_CONTAINER, requestContainer);
                //**************** END MODFIFICATION ZERBETTO 09-10-2006 ****************
               
            } // synchronized (session)
            if (!isRequestedSessionIdValid) {
                TracerSingleton.log(
                    Constants.NOME_MODULO,
                    TracerSingleton.WARNING,
                    "AdapterPortlet::processAction: sessione scaduta !");
                SessionExpiredUtility.setSessionExpiredAction(serviceRequest);
            } // if (!isRequestedSessionIdValid)
           
            requestContainer.setAttribute(
                    HTTP_SESSION_ID,
                    request.getPortletSession().getId());
            String channelType = "PORTLET";
            String channelTypeParameter =
                (String) (serviceRequest.getAttribute(Constants.CHANNEL_TYPE));
            String channelTypeHeader =
                (String) (requestContainer.getAttribute(HTTP_ACCEPT_HEADER));
            if (((channelTypeParameter != null)
                && channelTypeParameter.equalsIgnoreCase(Constants.WAP_CHANNEL))
                || ((channelTypeHeader != null)
                    && (channelTypeHeader.indexOf(WAP_MIME_TYPE) != -1)))
                channelType = Constants.WAP_CHANNEL;
            requestContainer.setChannelType(channelType);


            TracerSingleton.log(
                Constants.NOME_MODULO,
                TracerSingleton.DEBUG,
                "AdapterPortlet::processAction: requestContainer",
                requestContainer);
            TracerSingleton.log(
                Constants.NOME_MODULO,
                TracerSingleton.DEBUG,
                "AdapterPortlet::processAction: sessionContainer",
                requestContainer.getSessionContainer());

            responseContainer.setErrorHandler(emfErrorHandler);
            SourceBean serviceResponse =
                new SourceBean(Constants.SERVICE_RESPONSE);
            responseContainer.setServiceResponse(serviceResponse);
            try {
                Navigator.checkNavigation(requestContainer);
            } // try
            catch (NavigationException ne) {
                TracerSingleton.log(
                    Constants.NOME_MODULO,
                    TracerSingleton.CRITICAL,
                    "AdapterPortlet::processAction: ",
                    ne);
                requestContainer.setServiceRequest(
                    NavigationErrorUtility.getNavigationErrorServiceRequest());
            } // catch (NavigationException ne)
            serviceRequest = requestContainer.getServiceRequest();

            CoordinatorIFace coordinator =
                DispatcherManager.getCoordinator(requestContext);
            Exception serviceException = null;
            if (coordinator == null) {
                TracerSingleton.log(
                    Constants.NOME_MODULO,
                    TracerSingleton.WARNING,
                    "AdapterPortlet::processAction: coordinator nullo !");
                serviceException = new Exception("Coordinatore non trovato");
                emfErrorHandler.addError(
                    new EMFInternalError(
                        EMFErrorSeverity.ERROR,
                        "Coordinatore non trovato !"));
            } // if (coordinator == null)
            else {
                ((RequestContextIFace) coordinator).setRequestContext(
                    requestContext);
                responseContainer.setBusinessType(
                        coordinator.getBusinessType());
                    responseContainer.setBusinessName(
                        coordinator.getBusinessName());
                try {
                    coordinator.service(serviceRequest, serviceResponse);
                } // try
                catch (Exception ex) {
                    TracerSingleton.log(
                        Constants.NOME_MODULO,
                        TracerSingleton.CRITICAL,
                        "AdapterPortlet::processAction:",
                        ex);
                    serviceException = ex;
                    emfErrorHandler.addError(
                        new EMFInternalError(EMFErrorSeverity.ERROR, ex));
                    responseContainer.setAttribute(PORTLET_EXCEPTION, serviceException);
                } // catch (Exception ex)
                 ((RequestContextIFace) coordinator).setRequestContext(null);
            } // if (coordinator == null) else
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.