@Override
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    PurchasingAccountsPayableFormBase baseForm = (PurchasingAccountsPayableFormBase) form;

    ActionForward fwd = super.execute(mapping, form, request, response);

    AccountsPayableDocumentBase document = (AccountsPayableDocumentBase) baseForm.getDocument();
    boolean foundAccountExpiredWarning = false;
    for (int i = 0; i < KNSGlobalVariables.getMessageList().size(); i++) {
      if (StringUtils.equals(
          KNSGlobalVariables.getMessageList().get(i).getErrorKey(),
          PurapKeyConstants.MESSAGE_CLOSED_OR_EXPIRED_ACCOUNTS_REPLACED)) {
        foundAccountExpiredWarning = true;
      }
    }

    if (!foundAccountExpiredWarning) {
      SpringContext.getBean(AccountsPayableService.class)
          .generateExpiredOrClosedAccountWarning(document);
    }

    return fwd;
  }
  /**
   * This method should only be called if an audit error is intending to be added because it will
   * actually add a <code>{@link List<AuditError>}</code> to the auditErrorMap.
   *
   * @return List of AuditError instances
   */
  private List<AuditError> getAuditErrors() {
    List<AuditError> auditErrors = new ArrayList<AuditError>();

    if (!KNSGlobalVariables.getAuditErrorMap().containsKey("keyPersonnelAuditErrors")) {
      KNSGlobalVariables.getAuditErrorMap()
          .put(
              "keyPersonnelAuditErrors",
              new AuditCluster(KEY_PERSONNEL_PANEL_NAME, auditErrors, AUDIT_ERRORS));
    } else {
      auditErrors =
          ((AuditCluster) KNSGlobalVariables.getAuditErrorMap().get("keyPersonnelAuditErrors"))
              .getAuditErrorList();
    }

    return auditErrors;
  }
  /**
   * @see
   *     org.kuali.rice.kns.web.struts.action.KualiDocumentActionBase#route(org.apache.struts.action.ActionMapping,
   *     org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest,
   *     javax.servlet.http.HttpServletResponse)
   */
  @Override
  public ActionForward route(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    AccountsPayableFormBase apForm = (AccountsPayableFormBase) form;

    // set the last update user id
    AccountsPayableDocumentBase document = (AccountsPayableDocumentBase) apForm.getDocument();
    document.setLastActionPerformedByPersonId(
        GlobalVariables.getUserSession().getPerson().getPrincipalId());

    // if form is not yet calculated, return and prompt user to calculate
    if (requiresCaculate(apForm)) {
      GlobalVariables.getMessageMap()
          .putError(
              KFSConstants.DOCUMENT_ERRORS, PurapKeyConstants.ERROR_APPROVE_REQUIRES_CALCULATE);
      return mapping.findForward(KFSConstants.MAPPING_BASIC);
    }

    // recalculate
    customCalculate((AccountsPayableDocument) apForm.getDocument());

    // route
    ActionForward forward = super.route(mapping, form, request, response);

    // if successful, then redirect back to init
    boolean successMessageFound = false;
    MessageList messageList = KNSGlobalVariables.getMessageList();
    for (int i = 0; i < messageList.size(); i++) {
      if (StringUtils.equals(
          messageList.get(i).getErrorKey(), RiceKeyConstants.MESSAGE_ROUTE_SUCCESSFUL)) {
        successMessageFound = true;
        break;
      }
    }

    if (successMessageFound) {
      String basePath =
          SpringContext.getBean(ConfigurationService.class)
              .getPropertyValueAsString(KFSConstants.APPLICATION_URL_KEY);

      Properties parameters = new Properties();
      parameters.put(KFSConstants.DISPATCH_REQUEST_PARAMETER, KFSConstants.DOC_HANDLER_METHOD);
      parameters.put(KFSConstants.PARAMETER_COMMAND, "initiate");
      parameters.put(KFSConstants.DOCUMENT_TYPE_NAME, apForm.getDocTypeName());

      String lookupUrl =
          UrlFactory.parameterizeUrl(
              basePath + "/" + "purap" + this.getActionName() + ".do", parameters);
      forward = new ActionForward(lookupUrl, true);
    }

    return forward;
  }
  /**
   * This method should only be called if an audit error is intending to be added because it will
   * actually add a <code>{@link List<AuditError>}</code> to the auditErrorMap.
   *
   * @return List of AuditError instances
   */
  @SuppressWarnings("unchecked")
  private List<AuditError> getProposalS2sAuditErrorsByGroup(
      String formProperty, String usageLabel, Integer answerHeaderIndex) {
    List<AuditError> auditErrors = new ArrayList<AuditError>();
    String key =
        String.format(
            PROPOSAL_S2S_QUESTIONNAIRE_PANEL_KEY, formProperty, usageLabel, answerHeaderIndex);

    if (!KNSGlobalVariables.getAuditErrorMap().containsKey(key)) {
      KNSGlobalVariables.getAuditErrorMap()
          .put(key, new AuditCluster(usageLabel, auditErrors, AUDIT_ERRORS));
    } else {
      auditErrors =
          ((AuditCluster) KNSGlobalVariables.getAuditErrorMap().get(key)).getAuditErrorList();
    }

    return auditErrors;
  }
 /** This method creates and adds the AuditCluster to the Global AuditErrorMap. */
 @SuppressWarnings("unchecked")
 protected void reportAndCreateAuditCluster() {
   if (auditErrors.size() > 0) {
     KNSGlobalVariables.getAuditErrorMap()
         .put(
             PERSONNEL_AUDIT_ERRORS,
             new AuditCluster(
                 Constants.PROTOCOL_PERSONNEL_PANEL_NAME, auditErrors, Constants.AUDIT_ERRORS));
   }
 }
  @Override
  protected boolean processPreprocess(HttpServletRequest request, HttpServletResponse response) {
    final UserSession session = KRADUtils.getUserSessionFromRequest(request);

    if (session == null) {
      throw new IllegalStateException("the user session has not been established");
    }
    GlobalVariables.setUserSession(session);
    KNSGlobalVariables.clear();
    return true;
  }
  /**
   * @see org.kuali.rice.kns.lookup.KualiLookupableHelperServiceImpl#getSearchResults(java.util.Map)
   */
  @Override
  public List<? extends BusinessObject> getSearchResults(Map<String, String> fieldValues) {
    Map parameters = super.getParameters();
    String errorList;

    if (parameters.containsKey(PdpParameterConstants.ACTION_SUCCESSFUL_PARAM)) {
      String[] actionSuccessRequestParm =
          (String[]) parameters.get(PdpParameterConstants.ACTION_SUCCESSFUL_PARAM);
      Boolean actionSuccess =
          (Boolean)
              (new BooleanFormatter()).convertFromPresentationFormat(actionSuccessRequestParm[0]);

      if (actionSuccess != null) {

        if (!actionSuccess) {

          // if the action performed on batch was not successful we get the error message list and
          // add them to
          // GlobalVariables errorMap
          if (parameters.containsKey(PdpParameterConstants.ERROR_KEY_LIST_PARAM)) {
            String[] errorListParam =
                (String[]) parameters.get(PdpParameterConstants.ERROR_KEY_LIST_PARAM);
            errorList = errorListParam[0];
            if (StringUtils.isNotEmpty(errorList)) {
              String[] errorMsgs =
                  StringUtils.split(errorList, PdpParameterConstants.ERROR_KEY_LIST_SEPARATOR);
              for (String error : errorMsgs) {
                if (StringUtils.isNotEmpty(error)) {
                  GlobalVariables.getMessageMap().putError(KRADConstants.GLOBAL_ERRORS, error);
                }
              }
            }
          }
        } else {
          if (parameters.containsKey(PdpParameterConstants.MESSAGE_PARAM)) {
            String[] messageRequestParm =
                (String[]) parameters.get(PdpParameterConstants.MESSAGE_PARAM);
            String message = messageRequestParm[0];
            KNSGlobalVariables.getMessageList().add(message);
          }
        }
      }
    }

    List results = super.getSearchResults(fieldValues);
    return results;
  }
 /**
  * Tests to ensure that the proper key values are returned based upon the class type of the
  * currently-set Kuali form.
  *
  * @throws Exception
  */
 @Test
 public void testCorrectKeyValuesReturnedBasedOnKualiFormInstance() throws Exception {
   // First, check that the proper values are returned when the Kuali form is *not* a
   // KualiMaintenanceForm.
   KNSGlobalVariables.setKualiForm(new KualiForm());
   assertRuleTemplateHasExpectedKeyValues(
       createExpectedKeysSet(true, true, true, true),
       createSetOfKeyValueKeys(
           (new RuleMaintenanceActionRequestCodeValuesFinder()).getKeyValues()));
   // Next, check that the proper values are returned when the Kuali form is a KualiMaintenanceForm
   // containing a given rule template.
   loadXmlFile("RT_ValidRuleTemplatesWithVaryingDefaults.xml");
   createNewKualiMaintenanceForm("Test_Rule_Template2");
   assertRuleTemplateHasExpectedKeyValues(
       createExpectedKeysSet(false, false, false, true),
       createSetOfKeyValueKeys(
           (new RuleMaintenanceActionRequestCodeValuesFinder()).getKeyValues()));
 }
Example #9
0
 /**
  * This method is to put validation errors on UI
  *
  * @param errors List of validation errors which has to be displayed on UI.
  */
 protected void setValidationErrorMessage(List<AuditError> errors) {
   LOG.info("Error list size:" + errors.size() + errors.toString());
   List<AuditError> auditErrors = new ArrayList<AuditError>();
   for (AuditError error : errors) {
     auditErrors.add(
         new AuditError(
             error.getErrorKey(),
             Constants.GRANTS_GOV_GENERIC_ERROR_KEY,
             error.getLink(),
             new String[] {error.getMessageKey()}));
   }
   if (!auditErrors.isEmpty()) {
     KNSGlobalVariables.getAuditErrorMap()
         .put(
             "grantsGovAuditErrors",
             new AuditCluster(
                 Constants.GRANTS_GOV_OPPORTUNITY_PANEL, auditErrors, Constants.GRANTSGOV_ERRORS));
   }
 }
  /** Hooks into populate process to call form populate method if form is an instanceof PojoForm. */
  @Override
  protected void processPopulate(
      HttpServletRequest request,
      HttpServletResponse response,
      ActionForm form,
      ActionMapping mapping)
      throws ServletException {
    if (form instanceof KualiForm) {
      // Add the ActionForm to GlobalVariables
      // This will allow developers to retrieve both the Document and any
      // request parameters that are not
      // part of the Form and make them available in ValueFinder classes
      // and other places where they are needed.
      KNSGlobalVariables.setKualiForm((KualiForm) form);
    }

    // if not PojoForm, call struts populate
    if (!(form instanceof PojoForm)) {
      super.processPopulate(request, response, form, mapping);
      return;
    }

    final String previousRequestGuid =
        request.getParameter(
            KualiRequestProcessor.PREVIOUS_REQUEST_EDITABLE_PROPERTIES_GUID_PARAMETER_NAME);

    ((PojoForm) form).clearEditablePropertyInformation();
    ((PojoForm) form).registerStrutsActionMappingScope(mapping.getScope());

    String multipart = mapping.getMultipartClass();
    if (multipart != null) {
      request.setAttribute(Globals.MULTIPART_KEY, multipart);
    }

    form.setServlet(this.servlet);
    form.reset(mapping, request);

    ((PojoForm) form).setPopulateEditablePropertiesGuid(previousRequestGuid);
    // call populate on ActionForm
    ((PojoForm) form).populate(request);
    request.setAttribute("UnconvertedValues", ((PojoForm) form).getUnconvertedValues().keySet());
    request.setAttribute("UnconvertedHash", ((PojoForm) form).getUnconvertedValues());
  }
 /**
  * Creates a KualiMaintenanceForm with the given rule template inside of its RuleBaseValues
  * instance.
  *
  * @param rtName The rule template to use.
  */
 private void createNewKualiMaintenanceForm(String rtName) {
   // Initialize the required variables.
   final KualiMaintenanceForm kmForm = new KualiMaintenanceForm();
   final MaintenanceDocument maintDoc = new MaintenanceDocumentBase();
   final Maintainable oldMaint = new RoutingRuleMaintainable();
   final Maintainable newMaint = new RoutingRuleMaintainable();
   final RuleBaseValues rbValues = new RuleBaseValues();
   // Setup the rule base and the maintainables.
   rbValues.setRuleTemplate(
       KEWServiceLocator.getRuleTemplateService().findByRuleTemplateName(rtName));
   oldMaint.setBusinessObject(rbValues);
   oldMaint.setBoClass(rbValues.getClass());
   newMaint.setBusinessObject(rbValues);
   newMaint.setBoClass(rbValues.getClass());
   // Setup the maintenance document and the maintenance form.
   maintDoc.setOldMaintainableObject(oldMaint);
   maintDoc.setNewMaintainableObject(newMaint);
   maintDoc.getDocumentHeader().setDocumentDescription("This is a rule template test");
   kmForm.setDocument(maintDoc);
   KNSGlobalVariables.setKualiForm(kmForm);
 }
Example #12
0
  protected boolean processRunAuditBudgetVersionRule(BudgetParentDocument parentDocument) {
    // audit check for budgetversion with final status
    boolean finalAndCompleteBudgetVersionFound = false;
    boolean budgetVersionsExists = false;
    boolean retval = true;

    List<AuditError> auditErrors = new ArrayList<AuditError>();
    String budgetStatusCompleteCode =
        getParameterService()
            .getParameterValueAsString(BudgetDocument.class, Constants.BUDGET_STATUS_COMPLETE_CODE);
    for (BudgetDocumentVersion budgetDocumentVersion : parentDocument.getBudgetDocumentVersions()) {
      BudgetVersionOverview budgetVersion = budgetDocumentVersion.getBudgetVersionOverview();
      budgetVersionsExists = true;
      if (budgetVersion.isFinalVersionFlag()) {
        BudgetParent budgetParent = parentDocument.getBudgetParent();
        if (budgetParent.getBudgetStatus() != null
            && budgetParent.getBudgetStatus().equals(budgetStatusCompleteCode)) {
          finalAndCompleteBudgetVersionFound = true;
        }
      }
    }
    if (budgetVersionsExists && !finalAndCompleteBudgetVersionFound) {
      auditErrors.add(
          new AuditError(
              "document.parentBudget.budgetVersionOverview",
              KeyConstants.AUDIT_ERROR_NO_BUDGETVERSION_COMPLETE_AND_FINAL,
              Constants.PD_BUDGET_VERSIONS_PAGE + "." + Constants.BUDGET_VERSIONS_PANEL_ANCHOR));
      retval = false;
    }
    if (auditErrors.size() > 0) {
      KNSGlobalVariables.getAuditErrorMap()
          .put(
              "budgetVersionErrors",
              new AuditCluster(
                  Constants.BUDGET_VERSION_PANEL_NAME, auditErrors, Constants.AUDIT_ERRORS));
    }

    return retval;
  }
 /**
  * A convenience method for verifying that a rule template contains the expected default action.
  *
  * @param expectedDefActions The default actions expected by each responsibility (person, then
  *     group, then role).
  * @throws Exception
  */
 private void assertRuleTemplateHasExpectedDefaultActions(String[] expectedDefActions)
     throws Exception {
   // Acquire the Maintainable and the responsibility constants.
   final RoutingRuleMaintainable rrMaint =
       (RoutingRuleMaintainable)
           ((MaintenanceDocument)
                   ((KualiMaintenanceForm) KNSGlobalVariables.getKualiForm()).getDocument())
               .getNewMaintainableObject();
   final String[] respSectionConsts = {
     KEWPropertyConstants.PERSON_RESP_SECTION,
     KEWPropertyConstants.GROUP_RESP_SECTION,
     KEWPropertyConstants.ROLE_RESP_SECTION
   };
   // Check each responsibility's default action.
   for (int i = 0; i < respSectionConsts.length; i++) {
     final String actualDefAction =
         ((RuleResponsibilityBo) rrMaint.initNewCollectionLine(respSectionConsts[i]))
             .getActionRequestedCd();
     assertEquals(
         "The rule template does not have the expected default approve action.",
         expectedDefActions[i],
         actualDefAction);
   }
 }
Example #14
0
  /**
   * Adds an audit error to the {@link KNSGlobalVariables.getAuditErrorMap()
   * KNSGlobalVariables.getAuditErrorMap()}.
   *
   * @param error the error to add.
   * @param errorKey the error map key
   * @param clusterLabel the cluster label
   * @param clusterCategory the cluster category
   * @throws IllegalArgumentException if error, errorKey, clusterLabel, or clusterCategory are null
   *     or if errorKey, clusterLabel, or clusterCategory are whitespace
   */
  public void reportAuditError(
      AuditError error, String errorKey, String clusterLabel, String clusterCategory) {
    if (error == null
        || StringUtils.isBlank(errorKey)
        || StringUtils.isBlank(clusterLabel)
        || StringUtils.isBlank(clusterCategory)) {
      throw new IllegalArgumentException(
          new StringBuilder("null argument error: ")
              .append(error)
              .append(" errorkey: ")
              .append(errorKey)
              .append(" clusterLabel: ")
              .append(clusterLabel)
              .append(" clusterCategory: ")
              .append(clusterCategory)
              .toString());
    }

    if (LOG.isDebugEnabled()) {
      LOG.debug("rule failure at " + ErrorReporter.getMethodPath(1, 2));
    }

    @SuppressWarnings("unchecked")
    final Map<String, AuditCluster> errorMap = KNSGlobalVariables.getAuditErrorMap();

    AuditCluster cluster = errorMap.get(errorKey);

    if (cluster == null) {
      cluster = new AuditCluster(clusterLabel, new ArrayList<AuditError>(), clusterCategory);
      errorMap.put(errorKey, cluster);
    }

    @SuppressWarnings("unchecked")
    final Collection<AuditError> errors = cluster.getAuditErrorList();
    errors.add(error);
  }
 @Override
 public List<KeyValue> getKeyValues() {
   InstitutionalProposalForm form = (InstitutionalProposalForm) KNSGlobalVariables.getKualiForm();
   return getKeyValues(
       form.getInstitutionalProposalDocument().getInstitutionalProposal().getSponsorCode());
 }
 /**
  * This is a hack. This is called by Lookup's execute and it's just our way of making sure that
  * maint links are turned on, even for an otherwise erstwhile non-maintainable object
  *
  * @see
  *     org.kuali.rice.kns.lookup.AbstractLookupableHelperServiceImpl#applyConditionalLogicForFieldDisplay()
  */
 @Override
 public void applyConditionalLogicForFieldDisplay() {
   super.applyConditionalLogicForFieldDisplay();
   LookupForm lookupForm = (LookupForm) KNSGlobalVariables.getKualiForm();
   lookupForm.setShowMaintenanceLinks(true);
 }
  protected ActionForward askQuestionsAndPerformReopenPurchaseOrder(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    LOG.debug("askQuestionsAndPerformDocumentAction started.");
    KualiDocumentFormBase kualiDocumentFormBase = (KualiDocumentFormBase) form;
    AccountsPayableDocumentBase apDoc =
        (AccountsPayableDocumentBase) kualiDocumentFormBase.getDocument();
    Object question = request.getParameter(KFSConstants.QUESTION_INST_ATTRIBUTE_NAME);
    String questionType = PODocumentsStrings.REOPEN_PO_QUESTION;
    String confirmType = PODocumentsStrings.CONFIRM_REOPEN_QUESTION;
    String messageType = PurapKeyConstants.PURCHASE_ORDER_MESSAGE_REOPEN_DOCUMENT;
    String operation = "Reopen ";

    try {
      ConfigurationService kualiConfiguration = SpringContext.getBean(ConfigurationService.class);

      // Start in logic for confirming the proposed operation.
      if (ObjectUtils.isNull(question)) {
        String key =
            kualiConfiguration.getPropertyValueAsString(
                PurapKeyConstants.PURCHASE_ORDER_QUESTION_DOCUMENT);
        String message = StringUtils.replace(key, "{0}", operation);
        return this.performQuestionWithoutInput(
            mapping,
            form,
            request,
            response,
            questionType,
            message,
            KFSConstants.CONFIRMATION_QUESTION,
            questionType,
            "");
      } else {
        Object buttonClicked = request.getParameter(KFSConstants.QUESTION_CLICKED_BUTTON);
        if (question.equals(questionType) && buttonClicked.equals(ConfirmationQuestion.NO)) {
          // If 'No' is the button clicked, just reload the doc
          return mapping.findForward(KFSConstants.MAPPING_BASIC);
        } else if (question.equals(confirmType)
            && buttonClicked.equals(SingleConfirmationQuestion.OK)) {
          // This is the case when the user clicks on "OK" in the end; redirect to the preq doc
          return mapping.findForward(KFSConstants.MAPPING_BASIC);
        }
      }

      PurchaseOrderDocument po = apDoc.getPurchaseOrderDocument();
      if (!po.isPendingActionIndicator()
          && PurapConstants.PurchaseOrderStatuses.APPDOC_CLOSED.equals(
              po.getApplicationDocumentStatus())) {
        /*
         * Below if-else code block calls PurchaseOrderService methods that will throw ValidationException objects if errors
         * occur during any process in the attempt to perform its actions. Assume, if these return successfully, that the
         * PurchaseOrderDocument object returned from each is the newly created document and that all actions in the method
         * were run correctly. NOTE: IF BELOW IF-ELSE IS EDITED THE NEW METHODS CALLED MUST THROW ValidationException OBJECT
         * IF AN ERROR IS ADDED TO THE GlobalVariables
         */
        po = initiateReopenPurchaseOrder(po, kualiDocumentFormBase.getAnnotation());

        if (!GlobalVariables.getMessageMap().hasNoErrors()) {
          throw new ValidationException("errors occurred during new PO creation");
        }

        if (StringUtils.isNotEmpty(messageType)) {
          KNSGlobalVariables.getMessageList().add(messageType);
        }
        return this.performQuestionWithoutInput(
            mapping,
            form,
            request,
            response,
            confirmType,
            kualiConfiguration.getPropertyValueAsString(messageType),
            PODocumentsStrings.SINGLE_CONFIRMATION_QUESTION,
            questionType,
            "");
      } else {
        return this.performQuestionWithoutInput(
            mapping,
            form,
            request,
            response,
            confirmType,
            "Unable to reopen the PO at this time due to the incorrect PO status or a pending PO change document.",
            PODocumentsStrings.SINGLE_CONFIRMATION_QUESTION,
            questionType,
            "");
      }

    } catch (ValidationException ve) {
      throw ve;
    }
  }
  @Override
  public void process(final HttpServletRequest request, final HttpServletResponse response)
      throws IOException, ServletException {
    // indicates that we are running in legacy KNS context
    LegacyUtils.beginLegacyContext();
    try {
      if (LOG.isInfoEnabled()) {
        LOG.info(
            new StringBuffer("Started processing request: '")
                .append(request.getRequestURI())
                .append("' w/ query string: '")
                .append(request.getQueryString())
                .append("'"));
      }

      try {
        strutsProcess(request, response);
      } catch (FileUploadLimitExceededException e) {
        ActionForward actionForward =
            processException(request, response, e, e.getActionForm(), e.getActionMapping());
        processForwardConfig(request, response, actionForward);
      } finally {
        KNSGlobalVariables.setKualiForm(null);
      }

      try {
        ActionForm form = WebUtils.getKualiForm(request);

        if (form != null && form instanceof KualiDocumentFormBase) {
          String docId = ((KualiDocumentFormBase) form).getDocId();
          if (docId != null) {
            MDC.put(MDC_DOC_ID, docId);
          }
        }

        String refreshCaller = request.getParameter(KRADConstants.REFRESH_CALLER);
        if (form != null
            && KualiDocumentFormBase.class.isAssignableFrom(form.getClass())
            && !KRADConstants.QUESTION_REFRESH.equalsIgnoreCase(refreshCaller)) {
          KualiDocumentFormBase docForm = (KualiDocumentFormBase) form;
          Document document = docForm.getDocument();
          String docFormKey = docForm.getFormKey();

          UserSession userSession =
              (UserSession) request.getSession().getAttribute(KRADConstants.USER_SESSION_KEY);

          if (WebUtils.isDocumentSession(document, docForm)) {
            getSessionDocumentService()
                .setDocumentForm(docForm, userSession, request.getRemoteAddr());
          }

          Boolean exitingDocument = (Boolean) request.getAttribute(KRADConstants.EXITING_DOCUMENT);

          if (exitingDocument != null && exitingDocument.booleanValue()) {
            // remove KualiDocumentFormBase object from session and
            // table.
            getSessionDocumentService()
                .purgeDocumentForm(
                    docForm.getDocument().getDocumentNumber(),
                    docFormKey,
                    userSession,
                    request.getRemoteAddr());
          }
        }

        if (LOG.isInfoEnabled()) {
          LOG.info(
              new StringBuffer("Finished processing request: '")
                  .append(request.getRequestURI())
                  .append("' w/ query string: '")
                  .append(request.getQueryString())
                  .append("'"));
        }

      } finally {
        // MDC docId key is set above, and also during super.process() in the call to
        // processActionForm
        MDC.remove(MDC_DOC_ID);
      }
    } finally {
      LegacyUtils.endLegacyContext();
    }
  }
 /** Checks for messages in GlobalVariables and places list in request attribute. */
 private void saveMessages(HttpServletRequest request) {
   if (!KNSGlobalVariables.getMessageList().isEmpty()) {
     request.setAttribute(
         KRADConstants.GLOBAL_MESSAGES, KNSGlobalVariables.getMessageList().toActionMessages());
   }
 }