01: package com.technoetic.xplanner.actions;
02:
03: import com.technoetic.xplanner.domain.repository.ObjectRepository;
04: import org.apache.struts.action.ActionForm;
05: import org.apache.struts.action.ActionForward;
06: import org.apache.struts.action.ActionMapping;
07:
08: import javax.servlet.http.HttpServletRequest;
09: import javax.servlet.http.HttpServletResponse;
10:
11: public class DeleteObjectAction extends AbstractAction {
12: public ActionForward doExecute(ActionMapping actionMapping,
13: ActionForm form, HttpServletRequest request,
14: HttpServletResponse reply) throws Exception {
15: Class objectClass = getObjectType(actionMapping, request);
16: ObjectRepository repository = getRepository(objectClass);
17: repository
18: .delete(Integer.parseInt(request.getParameter("oid")));
19: String returnto = request.getParameter("returnto");
20: return returnto != null ? new ActionForward(returnto, true)
21: : actionMapping.findForward("view/projects");
22: }
23: }
|