Ejemplo n.º 1
0
  /**
   * @exception ValidationException when entry is not valid. This function validates the user input
   *     and builds the search object
   * @return the Audit search object
   */
  public AuditSearchObject getAuditSearchObject() throws ValidationException {
    AuditSearchObject auditSearchObject = new AuditSearchObject();

    // if user enters LID and SystemCode get the EUID and set it to the AuditSearchObject
    if (super.getUpdateableFeildsMap().get("LID") != null
        && super.getUpdateableFeildsMap().get("SystemCode") != null) {
      String LID = (String) super.getUpdateableFeildsMap().get("LID");
      String SystemCode = (String) super.getUpdateableFeildsMap().get("SystemCode");
      if (LID.trim().length() > 0 && SystemCode.trim().length() > 0) {
        try {
          // remove masking for LID field
          LID = LID.replaceAll("-", "");

          SystemObject so = masterControllerService.getSystemObject(SystemCode, LID);
          if (so == null) {
            errorMessage = bundle.getString("system_object_not_found_error_message");
            FacesContext.getCurrentInstance()
                .addMessage(
                    null,
                    new FacesMessage(FacesMessage.SEVERITY_ERROR, errorMessage, errorMessage));
            // mLogger.error("LID/SYSTEM CODE:: " + errorMessage);
            mLogger.info(mLocalizer.x("AUD018: LID/SYSTEM CODE : {0}", errorMessage));

          } else {
            EnterpriseObject eo = masterControllerService.getEnterpriseObjectForSO(so);
            auditSearchObject.setEUID(eo.getEUID());
          }
        } catch (Exception ex) {
          if (ex instanceof ValidationException) {
            mLogger.error(
                mLocalizer.x("AUD019: Service Layer Validation Exception has occurred"), ex);
            FacesContext.getCurrentInstance()
                .addMessage(
                    null,
                    new FacesMessage(
                        FacesMessage.SEVERITY_ERROR,
                        QwsUtil.getRootCause(ex).getMessage(),
                        exceptionMessaage));
          } else if (ex instanceof UserException) {
            mLogger.error(mLocalizer.x("AUD020: Service Layer User Exception occurred"), ex);
            FacesContext.getCurrentInstance()
                .addMessage(
                    null,
                    new FacesMessage(
                        FacesMessage.SEVERITY_ERROR,
                        QwsUtil.getRootCause(ex).getMessage(),
                        exceptionMessaage));
          } else if (!(ex instanceof ProcessingException)) {
            mLogger.error(mLocalizer.x("AUD021: Error  occurred"), ex);
            FacesContext.getCurrentInstance()
                .addMessage(
                    null,
                    new FacesMessage(
                        FacesMessage.SEVERITY_ERROR,
                        QwsUtil.getRootCause(ex).getMessage(),
                        exceptionMessaage));
          } else if (ex instanceof ProcessingException) {
            String exceptionMessage = QwsUtil.getRootCause(ex).getMessage();
            if (exceptionMessage.indexOf("stack trace") != -1) {
              String parsedString =
                  exceptionMessage.substring(0, exceptionMessage.indexOf("stack trace"));
              if (exceptionMessage.indexOf("message=") != -1) {
                parsedString =
                    parsedString.substring(
                        exceptionMessage.indexOf("message=") + 8, parsedString.length());
              }
              mLogger.error(
                  mLocalizer.x("AUD022: Service Layer Processing Exception occurred"), ex);
              FacesContext.getCurrentInstance()
                  .addMessage(
                      null,
                      new FacesMessage(
                          FacesMessage.SEVERITY_ERROR, parsedString, exceptionMessaage));
            } else {
              mLogger.error(mLocalizer.x("AUD023: Error  occurred"), ex);
              FacesContext.getCurrentInstance()
                  .addMessage(
                      null,
                      new FacesMessage(
                          FacesMessage.SEVERITY_ERROR, exceptionMessage, exceptionMessaage));
            }
          }
          return null;
        }
      }
    }

    // set EUID VALUE IF lid/system code not supplied
    if (super.getUpdateableFeildsMap().get("EUID") != null
        && super.getUpdateableFeildsMap().get("EUID").toString().trim().length() > 0) {
      auditSearchObject.setEUID((String) super.getUpdateableFeildsMap().get("EUID"));
      //          } else {
      //              auditSearchObject.setEUID(null);
    }

    // added as fix of bug with Id 113 on 21-10-08
    if (((super.getUpdateableFeildsMap().get("StartDate") != null)
            && (super.getUpdateableFeildsMap().get("StartDate").toString().trim().length() > 0))
        && ((super.getUpdateableFeildsMap().get("EndDate") != null)
            && (super.getUpdateableFeildsMap().get("EndDate").toString().trim().length() > 0))) {

      Date fromdate =
          DateUtil.string2Date(
              super.getUpdateableFeildsMap().get("StartDate").toString()
                  + ((super.getUpdateableFeildsMap().get("StartTime") != null
                          && super.getUpdateableFeildsMap()
                                  .get("StartTime")
                                  .toString()
                                  .trim()
                                  .length()
                              > 0)
                      ? " " + super.getUpdateableFeildsMap().get("StartTime").toString()
                      : " 00:00:00"));
      Date todate =
          DateUtil.string2Date(
              super.getUpdateableFeildsMap().get("EndDate").toString()
                  + ((super.getUpdateableFeildsMap().get("EndTime") != null
                          && super.getUpdateableFeildsMap()
                                  .get("EndTime")
                                  .toString()
                                  .trim()
                                  .length()
                              > 0)
                      ? " " + super.getUpdateableFeildsMap().get("EndTime").toString()
                      : " 23:59:59"));
      long startDate = fromdate.getTime();
      long endDate = todate.getTime();
      if (endDate < startDate) {
        errorMessage = bundle.getString("ERROR_INVALID_FROMDATE_RANGE");
        FacesContext.getCurrentInstance()
            .addMessage(
                null, new FacesMessage(FacesMessage.SEVERITY_ERROR, errorMessage, errorMessage));
        return null;
      }
    }

    String startTime = (String) super.getUpdateableFeildsMap().get("StartTime");
    String searchStartDate = (String) super.getUpdateableFeildsMap().get("StartDate");
    if (startTime != null && startTime.trim().length() > 0) {
      // if only time fields are entered validate for the date fields
      if ((searchStartDate != null && searchStartDate.trim().length() == 0)) {
        errorMessage = bundle.getString("enter_date_from");
        FacesContext.getCurrentInstance()
            .addMessage(
                null, new FacesMessage(FacesMessage.SEVERITY_ERROR, errorMessage, errorMessage));
        return null;
      }
    }

    // Set StartDate to the AuditSearchObject
    if (super.getUpdateableFeildsMap().get("StartDate") != null
        && super.getUpdateableFeildsMap().get("StartDate").toString().trim().length() > 0) {
      // append the time aling with date
      if (startTime != null && startTime.trim().length() > 0) {
        searchStartDate = searchStartDate + " " + startTime;
      } else {
        searchStartDate = searchStartDate + " 00:00:00";
      }

      Date date = DateUtil.string2Date(searchStartDate);
      if (date != null) {
        auditSearchObject.setCreateStartDate(new Timestamp(date.getTime()));
      }
    }

    String endTime = (String) super.getUpdateableFeildsMap().get("EndTime");
    String searchEndDate = (String) super.getUpdateableFeildsMap().get("EndDate");
    if (endTime != null && endTime.trim().length() > 0) {
      // if only time fields are entered validate for the date fields
      if ((searchEndDate != null && searchEndDate.trim().length() == 0)) {
        errorMessage = bundle.getString("enter_date_to");
        FacesContext.getCurrentInstance()
            .addMessage(
                null, new FacesMessage(FacesMessage.SEVERITY_ERROR, errorMessage, errorMessage));
        return null;
      }
    }

    // Set StartDate to the AuditSearchObject
    if (super.getUpdateableFeildsMap().get("EndDate") != null
        && super.getUpdateableFeildsMap().get("EndDate").toString().trim().length() > 0) {
      // append the time aling with date
      if (endTime != null && endTime.trim().length() > 0) {
        searchEndDate = searchEndDate + " " + endTime;
      } else {
        searchEndDate = searchEndDate + " 23:59:59";
      }
      Date date = DateUtil.string2Date(searchEndDate);
      if (date != null) {
        auditSearchObject.setCreateEndDate(new Timestamp(date.getTime()));
      }
    }
    // EndTime=, StartTime=, EndDate=, StartDate=, Function=null, SystemUser=, SystemCode=null,
    // LID=, EUID=
    if (super.getUpdateableFeildsMap().get("SystemUser") != null
        && super.getUpdateableFeildsMap().get("SystemUser").toString().trim().length() > 0) {
      auditSearchObject.setCreateUser((String) super.getUpdateableFeildsMap().get("SystemUser"));
    } else {
      auditSearchObject.setCreateUser(null);
    }

    if (super.getUpdateableFeildsMap().get("Function") != null
        && super.getUpdateableFeildsMap().get("Function").toString().trim().length() > 0) {
      auditSearchObject.setFunction((String) super.getUpdateableFeildsMap().get("Function"));
    } else {
      auditSearchObject.setFunction(null);
    }

    // Set to static values need clarification from prathiba
    // This will be revoked when login module is implemented.
    // auditSearchObject.setPageSize(ConfigManager.getInstance().getMatchingConfig().getItemPerSearchResultPage());
    // auditSearchObject.setMaxElements(ConfigManager.getInstance().getMatchingConfig().getMaxResultSize());

    // set max results and page size here
    auditSearchObject.setPageSize(super.getPageSize());
    auditSearchObject.setMaxElements(super.getMaxRecords());
    Date date = null;

    if (errorMessage != null && errorMessage.length() != 0) {
      throw new ValidationException(mLocalizer.t("AUD501: {0}", errorMessage));
    }
    return auditSearchObject;
  }
Ejemplo n.º 2
0
  /**
   * This method calls the service layer method MasterControllerService.lookupAuditLog to fetch the
   * Audit Log Search results The method builds the array of AuditDataObject to be displayed on the
   * resulting JSF
   *
   * @return AUDIT_LOG_SEARCH_RES the Navigation rule for the JSF framework
   * @throws com.sun.mdm.index.presentation.exception.HandlerException
   */
  public ArrayList auditLogSearch() throws HandlerException {
    try {
      super.setUpdateableFeildsMap(parametersMap);

      // check one of many condtion here
      if (super.checkOneOfManyCondition()) {
        errorMessage = bundle.getString("ERROR_one_of_many");
        FacesContext.getCurrentInstance()
            .addMessage(
                null, new FacesMessage(FacesMessage.SEVERITY_ERROR, errorMessage, errorMessage));
        // mLogger.error("Validation failed. Message displayed to the user: "******"One of Many :: " +
        // errorMessage);
        mLogger.info(mLocalizer.x("AUD001: Validation failed : {0}", errorMessage));
        return null;
      }

      // Check if all the required values in the group are entered by the user
      HashMap oneOfErrors = super.checkOneOfGroupCondition();
      if (oneOfErrors.size() > 0) {
        Iterator iter = oneOfErrors.keySet().iterator();
        while (iter.hasNext()) {
          String key = (String) iter.next();
          String message =
              bundle.getString("ERROR_ONE_OF_GROUP_TEXT1")
                  + (key == null ? " " : " " + key + " ")
                  + bundle.getString("ERROR_ONE_OF_GROUP_TEXT2");
          FacesContext.getCurrentInstance()
              .addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, message, message));
          ArrayList fieldsInGroup = (ArrayList) oneOfErrors.get(key);
          for (int i = 0; i < fieldsInGroup.size(); i++) {
            String fields = (String) fieldsInGroup.get(i);
            FacesContext.getCurrentInstance()
                .addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, fields, fields));
          }
        }
        return null;
      }

      // Check if all required values are entered by the user
      ArrayList requiredErrorsList = super.isRequiredCondition();
      if (requiredErrorsList.size() > 0) {
        for (int i = 0; i < requiredErrorsList.size(); i++) {
          String fields = (String) requiredErrorsList.get(i);
          fields += " " + bundle.getString("ERROR_ONE_OF_GROUP_TEXT2");
          FacesContext.getCurrentInstance()
              .addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, fields, fields));
        }
        return null;
      }

      // Added  to check the format of the user enter LID value adheres to the
      // System defined LID format
      if ((getUpdateableFeildsMap().get("LID") != null
          && getUpdateableFeildsMap().get("LID").toString().trim().length() > 0)) {
        if (!super.checkMasking(
            (String) getUpdateableFeildsMap().get("LID"),
            (String) getUpdateableFeildsMap().get("lidmask"))) {
          String localIdDesignation =
              ConfigManager.getInstance().getConfigurableQwsValue(ConfigManager.LID, "Local ID");
          String messages =
              localIdDesignation
                  + " "
                  + bundle.getString("lid_format_error_text")
                  + " "
                  + (String) getUpdateableFeildsMap().get("lidmask");
          FacesContext.getCurrentInstance()
              .addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, messages, messages));
          ArrayList lidErrorList = new ArrayList(); // fix of 6703149
          HashMap lidError = new HashMap();
          lidError.put("LID_SYSTEM_CODE_ERROR", messages);
          lidErrorList.add(lidError);
          return lidErrorList;
        }
      }

      // if user enters LID ONLY
      if ((super.getUpdateableFeildsMap().get("LID") != null
              && super.getUpdateableFeildsMap().get("LID").toString().trim().length() > 0)
          && super.getUpdateableFeildsMap().get("SystemCode") == null) {
        errorMessage = bundle.getString("LID_only");
        FacesContext.getCurrentInstance()
            .addMessage(
                null, new FacesMessage(FacesMessage.SEVERITY_ERROR, errorMessage, errorMessage));
        // mLogger.error("Validation failed. Message displayed to the user: "******"LID/SystemCode
        // Validation :: " + errorMessage);
        mLogger.info(mLocalizer.x("AUD002: {0} ", errorMessage));
        ArrayList lidErrorList = new ArrayList(); // fix of 6703149
        HashMap lidError = new HashMap();
        lidError.put("LID_SYSTEM_CODE_ERROR", errorMessage);
        lidErrorList.add(lidError);
        return lidErrorList;
      }
      // if user enters LID and SystemCode Validate the LID
      if (super.getUpdateableFeildsMap().get("LID") != null
          && super.getUpdateableFeildsMap().get("SystemCode") != null) {
        String LID = (String) super.getUpdateableFeildsMap().get("LID");
        String SystemCode = (String) super.getUpdateableFeildsMap().get("SystemCode");
        if (SystemCode.trim().length() > 0 && LID.trim().length() == 0) {
          errorMessage = bundle.getString("enter_LID");
          FacesContext.getCurrentInstance()
              .addMessage(
                  null, new FacesMessage(FacesMessage.SEVERITY_ERROR, errorMessage, errorMessage));
          // mLogger.error("Validation failed. Message displayed to the user: "******"LID/SystemCode
          // Validation :: " + errorMessage);
          mLogger.info(
              mLocalizer.x("AUD003: LID/SystemCode Validation failed : {0}", errorMessage));
          ArrayList lidErrorList = new ArrayList(); // fix of 6703149
          HashMap lidError = new HashMap();
          lidError.put("LID_SYSTEM_CODE_ERROR", errorMessage);
          lidErrorList.add(lidError);
          return lidErrorList;
        }
      }

      // if user enters LID and SystemCode Validate the LID
      if (super.getUpdateableFeildsMap().get("LID") != null
          && super.getUpdateableFeildsMap().get("SystemCode") != null) {
        String LID = (String) super.getUpdateableFeildsMap().get("LID");
        String SystemCode = (String) super.getUpdateableFeildsMap().get("SystemCode");
        if (LID.trim().length() > 0 && SystemCode.trim().length() > 0) {
          try {
            // remove masking for LID field
            LID = LID.replaceAll("-", "");
            SystemObject so = masterControllerService.getSystemObject(SystemCode, LID);
            if (so == null) {
              errorMessage = bundle.getString("system_object_not_found_error_message");
              String msg = bundle.getString("LID_SYSTEM_CODE");
              FacesContext.getCurrentInstance()
                  .addMessage(
                      null,
                      new FacesMessage(
                          FacesMessage.SEVERITY_ERROR, msg + errorMessage, errorMessage));
              mLogger.info(mLocalizer.x("AUD004: LID Validation failed : {0}", LID, errorMessage));
              ArrayList lidErrorList = new ArrayList(); // fix of 6703149
              HashMap lidError = new HashMap();
              lidError.put("LID_SYSTEM_CODE_ERROR", errorMessage);
              lidErrorList.add(lidError);
              return lidErrorList;
            }
          } catch (Exception ex) {
            if (ex instanceof ValidationException) {
              mLogger.error(
                  mLocalizer.x("AUD005: Service Layer Validation Exception has occurred"), ex);
              FacesContext.getCurrentInstance()
                  .addMessage(
                      null,
                      new FacesMessage(
                          FacesMessage.SEVERITY_ERROR,
                          QwsUtil.getRootCause(ex).getMessage(),
                          exceptionMessaage));
            } else if (ex instanceof UserException) {
              mLogger.error(mLocalizer.x("AUD006: Service Layer User Exception occurred"), ex);
              FacesContext.getCurrentInstance()
                  .addMessage(
                      null,
                      new FacesMessage(
                          FacesMessage.SEVERITY_ERROR,
                          QwsUtil.getRootCause(ex).getMessage(),
                          exceptionMessaage));
            } else if (!(ex instanceof ProcessingException)) {
              mLogger.error(mLocalizer.x("AUD007: Error  occurred"), ex);
              FacesContext.getCurrentInstance()
                  .addMessage(
                      null,
                      new FacesMessage(
                          FacesMessage.SEVERITY_ERROR,
                          QwsUtil.getRootCause(ex).getMessage(),
                          exceptionMessaage));
            } else if (ex instanceof ProcessingException) {
              String exceptionMessage = QwsUtil.getRootCause(ex).getMessage();
              if (exceptionMessage.indexOf("stack trace") != -1) {
                String parsedString =
                    exceptionMessage.substring(0, exceptionMessage.indexOf("stack trace"));
                if (exceptionMessage.indexOf("message=") != -1) {
                  parsedString =
                      parsedString.substring(
                          exceptionMessage.indexOf("message=") + 8, parsedString.length());
                }
                mLogger.error(
                    mLocalizer.x("AUD008: Service Layer Processing Exception occurred"), ex);
                FacesContext.getCurrentInstance()
                    .addMessage(
                        null,
                        new FacesMessage(
                            FacesMessage.SEVERITY_ERROR, parsedString, exceptionMessaage));
              } else {
                mLogger.error(mLocalizer.x("AUD009: Error  occurred"), ex);
                FacesContext.getCurrentInstance()
                    .addMessage(
                        null,
                        new FacesMessage(
                            FacesMessage.SEVERITY_ERROR, exceptionMessage, exceptionMessaage));
              }
            }
            return null;
          }
        }
      }

      // Validate all date fields entered by the user
      if (super.validateDateFields().size() > 0) {
        Object[] messObjs = super.validateDateFields().toArray();
        for (int i = 0; i < messObjs.length; i++) {
          String obj = (String) messObjs[i];
          String[] fieldErrors = obj.split(">>");
          FacesContext.getCurrentInstance()
              .addMessage(
                  null,
                  new FacesMessage(
                      FacesMessage.SEVERITY_ERROR,
                      fieldErrors[0] + " : " + fieldErrors[1],
                      fieldErrors[1]));

          mLogger.info(
              mLocalizer.x(
                  "AUD010: Invalid date format : {0} : {1}", fieldErrors[0], fieldErrors[1]));
          return null;
        }
      }

      // Validate all time fields entered by the user
      if (super.validateTimeFields().size() > 0) {
        Object[] messObjs = super.validateTimeFields().toArray();
        for (int i = 0; i < messObjs.length; i++) {
          String obj = (String) messObjs[i];
          String[] fieldErrors = obj.split(">>");
          FacesContext.getCurrentInstance()
              .addMessage(
                  null,
                  new FacesMessage(
                      FacesMessage.SEVERITY_ERROR,
                      fieldErrors[0] + " : " + fieldErrors[1],
                      fieldErrors[1]));
          mLogger.info(
              mLocalizer.x(
                  "AUD011: Invalid time format : {0} :{1}", fieldErrors[0], fieldErrors[1]));
          return null;
        }
      }

      AuditSearchObject aso = this.getAuditSearchObject();
      if (aso == null) return null;

      // Lookup Audit log Controller
      AuditIterator alPageIter = masterControllerService.lookupAuditLog(aso);
      // AuditIterator alPageIterOutput = masterControllerService.lookupAuditLog(aso);

      int i = 0;
      // Set the size of the VO Array
      setAuditLogVO(new AuditDataObject[alPageIter.count()]);

      // SimpleDateFormat sdf = new SimpleDateFormat(ConfigManager.getDateFormat() + " HH:mm:ss");
      SimpleDateFormat simpleDateFormatFields =
          new SimpleDateFormat(ConfigManager.getDateFormat() + " HH:mm:ss");
      // Populate the Value Object to be displayed on the JSF page.
      while (alPageIter.hasNext()) {
        auditLogVO[i] = new AuditDataObject(); // to be safe with malloc
        auditLogVO[i] = alPageIter.next();
        AuditDataObject auditDataObject = auditLogVO[i]; // to be safe with malloc

        /*String outputValues = "{AuditId:" + "\"" + auditDataObject.getId() +  "\"" +
                              ", EUID1: " + "\"" + ((auditDataObject.getEUID1() != null) ? auditDataObject.getEUID1() : "")  +"\"" +
                              ", EUID2: " + "\"" + ((auditDataObject.getEUID2() != null) ? auditDataObject.getEUID2() : "") +"\""  +
                              ", Function: " + "\"" + ((auditDataObject.getFunction()  != null) ? auditDataObject.getFunction()  : "") +"\"" +
                              ", Detail: " + "\"" + ((auditDataObject.getDetail()  != null) ? auditDataObject.getDetail()  : "") +"\""  +
                              ", CreateDate: " + "\"" + ((auditDataObject.getCreateDate()  != null) ? sdf.format(auditDataObject.getCreateDate())  : "") +"\""  +
                              ", CreateUser: "******"\"" + ((auditDataObject.getCreateUser()  != null) ? auditDataObject.getCreateUser()  : "") +"\""
                             +  "}";
        */
        HashMap resultsMap = new HashMap();
        resultsMap.put("AUDITID", auditDataObject.getId());
        resultsMap.put("EUID1", auditDataObject.getEUID1());
        resultsMap.put("EUID2", auditDataObject.getEUID2());
        resultsMap.put("Function", auditDataObject.getFunction());
        resultsMap.put("Detail", auditDataObject.getDetail());
        resultsMap.put("PrimaryObjectType", auditDataObject.getPrimaryObjectType());
        resultsMap.put(
            "CreateDate", simpleDateFormatFields.format(auditDataObject.getCreateDate()));
        resultsMap.put("CreateUser", auditDataObject.getCreateUser());
        resultsArrayList.add(resultsMap);

        // Logger.getLogger(AuditLogHandler.class.getName()).log(Level.INFO, null,
        // this.getClass().getName() + "Audit Log Handler EUID is " + this.getEuid());
        i++;
      }

    } catch (ValidationException ex) {
      FacesContext.getCurrentInstance()
          .addMessage(
              null,
              new FacesMessage(FacesMessage.SEVERITY_ERROR, exceptionMessaage, exceptionMessaage));
      mLogger.error(
          mLocalizer.x("AUD012: ValidationException has encountered : {0}", ex.getMessage()),
          QwsUtil.getRootCause(ex));
      // mLogger.error("ValidationException ex : " + ex.toString());
      return null;
    } catch (Exception ex) {
      if (ex instanceof ValidationException) {
        mLogger.error(mLocalizer.x("AUD013: Service Layer Validation Exception has occurred"), ex);
        FacesContext.getCurrentInstance()
            .addMessage(
                null,
                new FacesMessage(
                    FacesMessage.SEVERITY_ERROR,
                    QwsUtil.getRootCause(ex).getMessage(),
                    exceptionMessaage));
      } else if (ex instanceof UserException) {
        mLogger.error(mLocalizer.x("AUD014: Service Layer User Exception occurred"), ex);
        FacesContext.getCurrentInstance()
            .addMessage(
                null,
                new FacesMessage(
                    FacesMessage.SEVERITY_ERROR,
                    QwsUtil.getRootCause(ex).getMessage(),
                    exceptionMessaage));
      } else if (!(ex instanceof ProcessingException)) {
        mLogger.error(mLocalizer.x("AUD015: Error  occurred"), ex);
        FacesContext.getCurrentInstance()
            .addMessage(
                null,
                new FacesMessage(
                    FacesMessage.SEVERITY_ERROR,
                    QwsUtil.getRootCause(ex).getMessage(),
                    exceptionMessaage));
      } else if (ex instanceof ProcessingException) {
        String exceptionMessage = QwsUtil.getRootCause(ex).getMessage();
        if (exceptionMessage.indexOf("stack trace") != -1) {
          String parsedString =
              exceptionMessage.substring(0, exceptionMessage.indexOf("stack trace"));
          if (exceptionMessage.indexOf("message=") != -1) {
            parsedString =
                parsedString.substring(
                    exceptionMessage.indexOf("message=") + 8, parsedString.length());
          }
          mLogger.error(mLocalizer.x("AUD016: Service Layer Processing Exception occurred"), ex);
          FacesContext.getCurrentInstance()
              .addMessage(
                  null,
                  new FacesMessage(FacesMessage.SEVERITY_ERROR, parsedString, exceptionMessaage));
        } else {
          mLogger.error(mLocalizer.x("AUD017: Error  occurred"), ex);
          FacesContext.getCurrentInstance()
              .addMessage(
                  null,
                  new FacesMessage(
                      FacesMessage.SEVERITY_ERROR, exceptionMessage, exceptionMessaage));
        }
      }
      return null;
    }
    return resultsArrayList;
  }