01: package org.claros.mini.actions;
02:
03: import javax.servlet.http.HttpServletRequest;
04: import javax.servlet.http.HttpServletResponse;
05: import org.apache.struts.action.ActionForm;
06: import org.apache.struts.action.ActionForward;
07: import org.apache.struts.action.ActionMapping;
08:
09: import org.claros.commons.mail.models.ConnectionMetaHandler;
10: import org.claros.commons.mail.models.ConnectionProfile;
11: import org.claros.commons.models.AuthProfile;
12: import org.claros.mini.common.BaseLoggedAction;
13: import org.claros.mini.controllers.MailController;
14: import org.claros.mini.factory.MailControllerFactory;
15: import org.claros.mini.models.MailboxFormBean;
16:
17: /**
18: * @version 1.0
19: * @author Umut Gökbayrak
20: */
21: public class DeleteMailAction extends BaseLoggedAction {
22:
23: public ActionForward myExecute(ActionMapping mapping,
24: ActionForm form, HttpServletRequest request,
25: HttpServletResponse response) throws Exception {
26: MailboxFormBean bean = (MailboxFormBean) form;
27: AuthProfile auth = getAuthProfile(request);
28:
29: int msgs[] = bean.getMsg();
30: if (msgs != null) {
31: ConnectionMetaHandler handler = getConnectionHandler(request);
32: ConnectionProfile profile = getConnectionProfile(request);
33: String folder = bean.getFid();
34:
35: // if delete is clicked from read message screen.
36: if (folder == null) {
37: folder = (String) getVariable(request, "fid");
38: }
39: MailControllerFactory factory = new MailControllerFactory(
40: auth, profile, handler, folder);
41: MailController mailCont = factory.getMailController();
42:
43: mailCont.deleteEmails(msgs);
44: }
45:
46: ActionForward forward = mapping.findForward("success");
47: return forward;
48: }
49: }
|