package com.heckmansoft.surjey.controller.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;

import com.heckmansoft.surjey.model.vo.Response;

/**
 * Action to enable submitting a survey.
 * Stores survey response and forwards to thank you page.
 */
public class SubmitResponseAction extends ResponseAction {

    Logger log = Logger.getLogger(SubmitResponseAction.class);

    public SubmitResponseAction(Object source) {
        super(source);
    }

    /**
     * @see com.heckmansoft.surjey.controller.action.Action#execute(HttpServletRequest, HttpServletResponse)
     */
    public String execute(
        HttpServletRequest request,
        HttpServletResponse response)
    throws Exception {
        log.debug("execute()");

        // Get the response from the request and store it.
        responseManager.insert(parseRequest(request));

        // Forward to view
        return "ResponseThankYou";
    }

}
