/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package hu.nir.nmail.spring.controllers;

import hu.nir.nmail.ejb.entity.NmailUser;
import hu.nir.nmail.services.GetSettingsService;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

/**
 *
 * @author attila
 */
public class SettingsController extends AbstractController {
    private String successView;
    private GetSettingsService getSettingsService;
    
    @Override
    protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) {
        HttpSession session = request.getSession();
        NmailUser nmailUser = (NmailUser) session.getAttribute("nmailUser");
        Map<String, Object> model = getSettingsService.processCommand(nmailUser);
        return new ModelAndView(getSuccessView(), model);
    }

    public String getSuccessView() {
        return successView;
    }

    public void setSuccessView(String successView) {
        this.successView = successView;
    }

    public GetSettingsService getGetSettingsService() {
        return getSettingsService;
    }

    public void setGetSettingsService(GetSettingsService getSettingsService) {
        this.getSettingsService = getSettingsService;
    }

}
