package net.yher2.workstyle.action.tagType.rest;

import java.sql.Connection;

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

import net.yher2.workstyle.action.BasicDataBaseAction;
import net.yher2.workstyle.action.Session;
import net.yher2.workstyle.action.tagType.SelectForm;
import net.yher2.workstyle.exception.NotFoundException;
import net.yher2.workstyle.manager.TagTypeManager;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.torque.TorqueException;

public class DeleteAction extends BasicDataBaseAction {
	@Override
	public ActionForward execute(
			Connection con,
			Session session,
			ActionMapping mapping, 
			ActionForm actionForm, 
			HttpServletRequest request, 
			HttpServletResponse response) throws TorqueException, NotFoundException {

		SelectForm form = (SelectForm)actionForm;
		new TagTypeManager(con).delete(form.getTagTypeId());
		return mapping.findForward("success");
	}
}
