Example usage for org.springframework.web.bind.support SessionStatus setComplete

List of usage examples for org.springframework.web.bind.support SessionStatus setComplete

Introduction

In this page you can find the example usage for org.springframework.web.bind.support SessionStatus setComplete.

Prototype

void setComplete();

Source Link

Document

Mark the current handler's session processing as complete, allowing for cleanup of session attributes.

Usage

From source file:egovframework.oe1.cms.srm.web.EgovOe1OperImprovReqController.java

/**
 * ?? ?./* w  w w .ja v a  2s.co m*/
 * 
 * @param EgovOe1OperImprovReqVO
 * @param model
 * @return "forward:/cms/srm/gnrl/selectOperImprovReqList.do"
 * @exception Exception
 */
@RequestMapping(value = "/cms/srm/gnrl/insertOperImprovReq.do")
public String insertOperImprovReq(final MultipartHttpServletRequest multiRequest,
        @ModelAttribute("vo") EgovOe1OperImprovReqVO vo, SessionStatus status) throws Exception {
    //?
    Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
    if (!isAuthenticated) {
        return "forward:/cms/com/EgovOe1LoginUsr.do"; //? ??
    }

    /** ?  */
    List<EgovOe1FileVO> _result = null;
    String _atchFileId = "";
    final Map<String, MultipartFile> files = multiRequest.getFileMap();
    if (!files.isEmpty()) {
        _result = fileUtil.parseFileInf(files, "", 0, "", "");
        _atchFileId = fileMngService.insertFileInfs(_result); //?? ?? ?? ? ID .
    }
    vo.setRequstAtchFileId(_atchFileId);

    operImprovReqService.insertOperImprovReq(vo);
    status.setComplete();
    return "forward:/cms/srm/gnrl/selectOperImprovReqList.do";
}

From source file:egovframework.oe1.cms.sys.web.EgovOe1ConsentManageController.java

/**
 * ? ./*from w  w w .  j a v a  2 s  .c  o m*/
 * @param submitVO
 *        ?
 * @param status
 * @return
 * @throws Exception
 */
@RequestMapping("/cms/cmm/cancelSanctionSubmit.do")
public String cancelSanctionSubmit(@ModelAttribute EgovOe1SanctionSubmitVO submitVO, SessionStatus status)
        throws Exception {

    // Spring Security
    Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
    if (!isAuthenticated) {
        return "/cms/com/EgovLoginUsr"; // ?
        // ??
    }

    log.debug(this.getClass() + " ? cancelSanctionSubmit() submitVO : " + submitVO.toString());

    consentService.cancelSanctionSubmit(submitVO);

    status.setComplete();
    return "forward:/cms/cmm/viewSanctnSmtDetail.do?selectedId=" + submitVO.getDrftSn();
}

From source file:egovframework.oe1.cms.sys.web.EgovOe1ConsentManageController.java

/**
 *  ./*from  w  w  w.  ja va  2s. co m*/
 * @param submitVO
 *        
 * @param status
 * @return  
 * @throws Exception
 */
@RequestMapping("/cms/cmm/returnSanctionSubmit.do")
public String returnSanctionSubmit(@ModelAttribute EgovOe1SanctionSubmitVO submitVO, SessionStatus status)
        throws Exception {

    // Spring Security
    Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
    if (!isAuthenticated) {
        return "/cms/com/EgovLoginUsr"; // ?
        // ??
    }

    log.debug(this.getClass() + "  returnSanctionSubmit() submitVO : " + submitVO.toString());

    consentService.returnSanctionSubmit(submitVO);

    status.setComplete();
    return "forward:/cms/cmm/viewSanctionConfirmDetail.do?selectedId=" + submitVO.getDrftSn();
}

From source file:egovframework.oe1.cms.sys.web.EgovOe1ConsentManageController.java

/**
 * ? ./* www.  j  a v a2  s.  c om*/
 * @param submitVO
 *        ?
 * @param status
 * @return  
 * @throws Exception
 */
@RequestMapping("/cms/cmm/confirmSanctionSubmit.do")
public String confirmSanctionSubmit(@ModelAttribute EgovOe1SanctionConsentVO consentVO, SessionStatus status)
        throws Exception {

    // Spring Security
    Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated();
    if (!isAuthenticated) {
        return "/cms/com/EgovLoginUsr"; // ?
        // ??
    }

    log.debug(this.getClass() + " ? confirmSanctionSubmit() submitVO : " + consentVO.toString());

    consentService.confirmSanctionSubmit(consentVO);

    status.setComplete();
    return "forward:/cms/cmm/viewSanctionConfirmDetail.do?selectedId=" + consentVO.getDrftSn();
}

From source file:csns.web.controller.SyllabusControllerS.java

private String edit(Section section, Resource syllabus, MultipartFile uploadedFile, BindingResult bindingResult,
        SessionStatus sessionStatus, ModelMap models, String redirectUrl) {
    resourceValidator.validate(syllabus, uploadedFile, bindingResult);
    if (bindingResult.hasErrors()) {
        models.put("section", section);
        return "syllabus/edit";
    }//from  ww  w.ja  v a 2 s .  co m

    if (syllabus.getType() == ResourceType.NONE)
        section.setSyllabus(null);
    else
        section.setSyllabus(syllabus);

    // This is a workaround for a rather weird behavior in Hibernate: when
    // FileDao.saveFile() is called, the syllabus Resource object is
    // automatically flushed with a persist(), which will cause a
    // "persisting a detached object" exception. So here we re-attach
    // syllabus first, and then save the uploaded file if there is one.
    section = sectionDao.saveSection(section);
    syllabus = section.getSyllabus();
    User user = SecurityUtils.getUser();
    if (syllabus.getType() == ResourceType.FILE && uploadedFile != null && !uploadedFile.isEmpty()) {
        File file = fileIO.save(uploadedFile, user, true);
        syllabus.setFile(file);
        sectionDao.saveSection(section);
    }
    sessionStatus.setComplete();

    logger.info(user.getUsername() + " edited the syllabus of section " + section.getId());

    return "redirect:" + redirectUrl;
}

From source file:it.jugpadova.controllers.ParticipantRegistrationController.java

@RequestMapping(method = RequestMethod.POST)
@Validation(view = FORM_VIEW, continueOnErrors = true)
protected ModelAndView onSubmit(HttpServletRequest req,
        @ModelAttribute(REGISTRATION_ATTRIBUTE) Registration registration, BindingResult result,
        SessionStatus status) throws Exception {
    final String SENT_MAIL_URL = "redirect:/home/message.html?messageCode=participant.registration.sentMail";
    if (result.hasErrors()) {
        registration.setCaptchaResponse("");
        req.setAttribute("event", registration.getEvent());
        req.getSession().setAttribute(REGISTRATION_ATTRIBUTE, registration);
        return new ModelAndView(FORM_VIEW);
    }//from  w w  w.j a va2  s  . c o  m
    ModelAndView mv = null;
    String baseUrl = Utilities.getBaseUrl(req);
    List<Participant> prevParticipant = eventBo.searchParticipantByEmailAndEventId(
            registration.getParticipant().getEmail(), registration.getEvent().getId());
    if (prevParticipant.size() == 0) {
        eventBo.register(registration.getEvent(), registration.getParticipant(), baseUrl);
        mv = new ModelAndView(SENT_MAIL_URL);
        Utilities.addMessageArguments(mv, registration.getEvent().getTitle(),
                registration.getParticipant().getEmail());
    } else {
        Participant p = prevParticipant.get(0);
        //partcipant already confirmed but not cancelled
        if (p.hasValidRegistration()) {
            status.setComplete();
            mv = Utilities.getMessageView("participant.registration.yetRegistered");
        } else {
            p.setFirstName(registration.getParticipant().getFirstName());
            p.setLastName(registration.getParticipant().getLastName());
            p.setNote(registration.getParticipant().getNote());
            p.setReminderEnabled(registration.getParticipant().getReminderEnabled());
            eventBo.refreshRegistration(registration.getEvent(), p, baseUrl);
            mv = new ModelAndView(SENT_MAIL_URL);
            Utilities.addMessageArguments(mv, registration.getEvent().getTitle(),
                    registration.getParticipant().getEmail());
        }
    }
    status.setComplete();
    return mv;
}

From source file:csns.web.controller.SurveyResponseControllerS.java

@RequestMapping(value = "/department/{dept}/survey/response/edit", method = RequestMethod.POST)
public String edit(@ModelAttribute("response") SurveyResponse response, @RequestParam int sectionIndex,
        HttpServletRequest request, ModelMap models, BindingResult result, SessionStatus sessionStatus) {
    surveyResponseValidator.validate(response, sectionIndex, result);
    if (!result.hasErrors()) {
        if (request.getParameter("prev") != null)
            --sectionIndex;//from  ww w. j a  va 2 s  . co  m
        if (request.getParameter("next") != null)
            ++sectionIndex;
    }

    if (!result.hasErrors() && request.getParameter("finish") != null) {
        Survey survey = response.getSurvey();
        if (survey.getType().equals(SurveyType.NAMED))
            response.getAnswerSheet().setAuthor(SecurityUtils.getUser());
        if (survey.getType().equals(SurveyType.RECORDED)) {
            User user = userDao.getUser(SecurityUtils.getUser().getId());
            user.getSurveysTaken().add(survey);
            userDao.saveUser(user);
        }
        response.getAnswerSheet().setDate(new Date());
        response = surveyResponseDao.saveSurveyResponse(response);

        if (survey.getType() == SurveyType.NAMED)
            logger.info(SecurityUtils.getUser().getUsername() + " completed survey " + survey.getId());
        else
            logger.info("A user completed survey " + survey.getId());

        sessionStatus.setComplete();
        models.put("message", "status.survey.completed");
        models.put("backUrl", "../current");
        return "status";
    } else {
        models.put("response", response);
        models.put("sectionIndex", sectionIndex);
        return "survey/response/edit";
    }
}

From source file:csns.web.controller.ForumTopicControllerS.java

@RequestMapping(value = "/department/{dept}/forum/topic/reply", method = RequestMethod.POST)
public String reply(@ModelAttribute Post post, @PathVariable String dept,
        @RequestParam(value = "file", required = false) MultipartFile[] uploadedFiles, BindingResult result,
        SessionStatus sessionStatus) {
    messageValidator.validate(post, result);
    if (result.hasErrors())
        return "forum/topic/reply";

    User user = userDao.getUser(SecurityUtils.getUser().getId());
    if (uploadedFiles != null)
        post.getAttachments().addAll(fileIO.save(uploadedFiles, user, true));

    user.incrementNumOfForumPosts();//from w  ww.  j  a va  2s . com
    post.setAuthor(user);
    post.setDate(new Date());
    Topic topic = post.getTopic();
    topic.addPost(post);
    Forum forum = topic.getForum();
    forum.incrementNumOfPosts();
    forum.setLastPost(post);
    topic = topicDao.saveTopic(topic);

    subscriptionDao.subscribe(topic, user);

    String subject = "New Reply in CSNS Forum - " + forum.getShortName();
    String vTemplate = "notification.new.forum.reply.vm";
    Map<String, Object> vModels = new HashMap<String, Object>();
    vModels.put("topic", topic);
    vModels.put("dept", dept);
    notificationService.notifiy(topic, subject, vTemplate, vModels, true);

    logger.info(user.getUsername() + " replied to topic " + topic.getId());

    sessionStatus.setComplete();
    return "redirect:/department/" + dept + "/forum/topic/view?id=" + post.getTopic().getId();
}

From source file:org.examproject.tweet.controller.TweetController.java

@RequestMapping(value = "/logout", method = RequestMethod.GET)
public String doLogout(HttpServletResponse response, SessionStatus sessionStatus, Model model) {
    Cookie cookie = new Cookie(TweetCookie.REQUEST_TOKEN.getName(), "");
    response.addCookie(cookie);/*from  w  w w . ja  v a  2  s .  c o m*/
    cookie = new Cookie(TweetCookie.ACCESS_TOKEN.getName(), "");
    response.addCookie(cookie);
    cookie = new Cookie(TweetCookie.TOKEN_SECRET.getName(), "");
    response.addCookie(cookie);
    cookie = new Cookie(TweetCookie.USER_ID.getName(), "");
    response.addCookie(cookie);
    cookie = new Cookie(TweetCookie.SCREEN_NAME.getName(), "");
    response.addCookie(cookie);
    cookie = new Cookie(TweetCookie.USER_LIST_NAME.getName(), "");
    response.addCookie(cookie);
    cookie = new Cookie(TweetCookie.RESPONSE_LIST_MODE.getName(), "");
    response.addCookie(cookie);

    sessionStatus.setComplete();
    return "redirect:/";
}