package com.heckmansoft.surjey.controller.action;

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

import org.apache.log4j.Logger;

/**
 * Action to enable adding a new survey.
 */
public class AddSurveyAction extends SurveyAction {

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

    public AddSurveyAction(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()");

        // Create new empty survey and store in request
        request.setAttribute("survey", surveyManager.createSurvey());

        request.setAttribute("mode","Create");

        // Forward to view
        return "EditSurvey";
    }

}
