01: package com.technoetic.xplanner.actions;
02:
03: import com.technoetic.xplanner.db.NoteHelper;
04: import com.technoetic.xplanner.db.hibernate.ThreadSession;
05: import com.technoetic.xplanner.domain.Note;
06: import com.technoetic.xplanner.domain.repository.ObjectRepository;
07: import org.apache.struts.action.ActionForm;
08: import org.apache.struts.action.ActionForward;
09: import org.apache.struts.action.ActionMapping;
10:
11: import javax.servlet.http.HttpServletRequest;
12: import javax.servlet.http.HttpServletResponse;
13:
14: /**
15: * Created by IntelliJ IDEA.
16: * User: sg897500
17: * Date: Nov 26, 2004
18: * Time: 12:27:56 PM
19: * To change this template use File | Settings | File Templates.
20: */
21: public class DeleteNoteAction extends DeleteObjectAction {
22:
23: public ActionForward doExecute(ActionMapping actionMapping,
24: ActionForm form, HttpServletRequest request,
25: HttpServletResponse reply) throws Exception {
26: Class objectClass = getObjectType(actionMapping, request);
27: ObjectRepository repository = getRepository(objectClass);
28:
29: Note note = (Note) repository.load((new Integer(request
30: .getParameter("oid")).intValue()));
31: NoteHelper.deleteNote(note, ThreadSession.get());
32:
33: String returnto = request.getParameter("returnto");
34: return returnto != null ? new ActionForward(returnto, true)
35: : actionMapping.findForward("view/projects");
36: }
37:
38: }
|