@SuppressWarnings("unchecked") public Map<String, Collection<SoftError>> getSoftErrors() { UserSession session = GlobalVariables.getUserSession(); Object o = session.retrieveObject(KeyConstants.SOFT_ERRORS_KEY); Map<String, Collection<SoftError>> softErrors = (Map<String, Collection<SoftError>>) o; if (softErrors == null) { softErrors = initializeSoftErrorMap(); } return softErrors; }
/** * Checks for return from a lookup or question, and restores the action form stored under the * request parameter docFormKey. */ @Override protected ActionForm processActionForm( HttpServletRequest request, HttpServletResponse response, ActionMapping mapping) { String documentNumber = getDocumentNumber(request); if (documentNumber != null) { MDC.put(MDC_DOC_ID, documentNumber); } UserSession userSession = (UserSession) request.getSession().getAttribute(KRADConstants.USER_SESSION_KEY); String docFormKey = request.getParameter(KRADConstants.DOC_FORM_KEY); String methodToCall = request.getParameter(KRADConstants.DISPATCH_REQUEST_PARAMETER); String refreshCaller = request.getParameter(KRADConstants.REFRESH_CALLER); // String searchListRequestKey = request.getParameter(KRADConstants.SEARCH_LIST_REQUEST_KEY); String documentWebScope = request.getParameter(KRADConstants.DOCUMENT_WEB_SCOPE); if (mapping.getPath().startsWith(KRADConstants.REFRESH_MAPPING_PREFIX) || KRADConstants.RETURN_METHOD_TO_CALL.equalsIgnoreCase(methodToCall) || KRADConstants.QUESTION_REFRESH.equalsIgnoreCase(refreshCaller) || KRADConstants.TEXT_AREA_REFRESH.equalsIgnoreCase(refreshCaller) || KRADConstants.SESSION_SCOPE.equalsIgnoreCase(documentWebScope)) { ActionForm form = null; // check for search result storage and clear GlobalVariables.getUserSession().removeObjectsByPrefix(KRADConstants.SEARCH_LIST_KEY_PREFIX); // We put different type of forms such as document form, lookup form // in session but we only store document form in // database. if (userSession.retrieveObject(docFormKey) != null) { LOG.debug("getDecomentForm KualiDocumentFormBase from session"); form = (ActionForm) userSession.retrieveObject(docFormKey); } else if (StringUtils.isNotBlank(documentNumber)) { form = getSessionDocumentService() .getDocumentForm(documentNumber, docFormKey, userSession, request.getRemoteAddr()); } request.setAttribute(mapping.getAttribute(), form); if (!KRADConstants.SESSION_SCOPE.equalsIgnoreCase(documentWebScope)) { userSession.removeObject(docFormKey); } // we should check whether this is a multipart request because we // could have had a combination of query parameters and a multipart // request String contentType = request.getContentType(); String method = request.getMethod(); if (("POST".equalsIgnoreCase(method) && contentType != null && contentType.startsWith("multipart/form-data"))) { // this method parses the multipart request and adds new // non-file parameters into the request WebUtils.getMultipartParameters(request, null, form, mapping); } // The form can be null if the document is not a session document if (form != null) { return form; } } // Rice has the ability to limit file upload sizes on a per-form basis, // so the max upload sizes may be accessed by calling methods on // PojoFormBase. // This requires that we are able know the file upload size limit (i.e. // retrieve a form instance) before we parse a mulitpart request. ActionForm form = super.processActionForm(request, response, mapping); // for sessiondocument with multipart request String contentType = request.getContentType(); String method = request.getMethod(); if ("GET".equalsIgnoreCase(method) && StringUtils.isNotBlank(methodToCall) && form instanceof PojoForm && ((PojoForm) form) .getMethodToCallsToBypassSessionRetrievalForGETRequests() .contains(methodToCall)) { return createNewActionForm(mapping, request); } // if we have a multipart request, parse it and return the stored form // from session if the doc form key is not blank. If it is blank, then // we just return the form // generated from the superclass processActionForm method. Either way, // we need to parse the mulitpart request now so that we may determine // what the value of the doc form key is. // This is generally against the contract of processActionForm, because // processPopulate should be responsible for parsing the mulitpart // request, but we need to parse it now // to determine the doc form key value. if (("POST".equalsIgnoreCase(method) && contentType != null && contentType.startsWith("multipart/form-data"))) { WebUtils.getMultipartParameters(request, null, form, mapping); docFormKey = request.getParameter(KRADConstants.DOC_FORM_KEY); documentWebScope = request.getParameter(KRADConstants.DOCUMENT_WEB_SCOPE); documentNumber = getDocumentNumber(request); if (KRADConstants.SESSION_SCOPE.equalsIgnoreCase(documentWebScope) || (form instanceof KualiDocumentFormBase && WebUtils.isDocumentSession( ((KualiDocumentFormBase) form).getDocument(), (KualiDocumentFormBase) form))) { Object userSessionObject = userSession.retrieveObject(docFormKey); if (userSessionObject != null && userSessionObject instanceof ActionForm) { LOG.debug("getDocumentForm KualiDocumentFormBase from session"); form = (ActionForm) userSessionObject; } else { ActionForm tempForm = getSessionDocumentService() .getDocumentForm( documentNumber, docFormKey, userSession, request.getRemoteAddr()); if (tempForm != null) { form = tempForm; } } request.setAttribute(mapping.getAttribute(), form); if (form != null) { return form; } } } return form; }