/* (non-Javadoc) * @see org.theospi.utils.mvc.intf.Controller#handleRequest(java.lang.Object, java.util.Map, java.util.Map, java.util.Map, org.springframework.validation.Errors) */ public ModelAndView handleRequest( Object requestModel, Map request, Map session, Map application, Errors errors) { WizardPage page = (WizardPage) session.get(WizardPageHelper.WIZARD_PAGE); Id cellId = idManager.getId((String) request.get("page_id")); Id formId = idManager.getId((String) request.get("current_form_id")); Cell cell = getMatrixManager().getCellFromPage(cellId); boolean sessionPage = true; if (page == null) { sessionPage = false; page = cell.getWizardPage(); } String submitAction = (String) request.get("submit"); session.remove(WizardPageHelper.WIZARD_PAGE); getMatrixManager().removeFromSession(page); if (submitAction.equals(DELETE_FORM)) { getMatrixManager().detachForm(page.getId(), formId); } else // (submitAction.equals(DELETE_FEEDBACK)) { Id reviewId = idManager.getId((String) request.get("review_id")); Review review = getReviewManager().getReview(reviewId); if (review != null) getReviewManager().deleteReview(review); else logger.warn("Null feedback form (perhaps multiple submits):" + reviewId); } if (sessionPage) session.put(WizardPageHelper.WIZARD_PAGE, getMatrixManager().getWizardPage(page.getId())); try { // unlock and delete content String reviewContentId = contentHosting.getUuid(formId.getValue()); if (getLockManager().isLocked(reviewContentId)) getLockManager().removeLock(reviewContentId, cellId.getValue()); getContentHosting().removeResource(formId.getValue()); } catch (Exception e) { logger.warn("Error removing form: " + e.toString()); } // if not submit, then cancel, but both submit and cancel have the some view, so return new ModelAndView("continue", "page_id", page.getId().getValue()); }
public static String getUuid(String id) { org.sakaiproject.content.api.ContentHostingService service = getInstance(); if (service == null) return null; return service.getUuid(id); }