KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nextime > ion > admin > action > publi > NewVersionAction


1 package org.nextime.ion.admin.action.publi;
2
3 import java.io.IOException JavaDoc;
4
5 import javax.servlet.ServletException JavaDoc;
6 import javax.servlet.http.HttpServletRequest JavaDoc;
7 import javax.servlet.http.HttpServletResponse JavaDoc;
8
9 import org.apache.struts.action.Action;
10 import org.apache.struts.action.ActionForm;
11 import org.apache.struts.action.ActionForward;
12 import org.apache.struts.action.ActionMapping;
13 import org.nextime.ion.framework.business.Publication;
14 import org.nextime.ion.framework.business.User;
15 import org.nextime.ion.framework.mapping.Mapping;
16
17 public class NewVersionAction extends Action {
18
19     public ActionForward perform(
20         ActionMapping mapping,
21         ActionForm form,
22         HttpServletRequest JavaDoc request,
23         HttpServletResponse JavaDoc response)
24         throws IOException JavaDoc, ServletException JavaDoc {
25
26         try {
27             String JavaDoc id = request.getParameter("id");
28             String JavaDoc user = request.getParameter("user");
29             Mapping.begin();
30             Publication.getInstance(id).newVersion(User.getInstance(user));
31             Mapping.commit();
32             request.setAttribute("id", id);
33         } catch (Exception JavaDoc e) {
34             Mapping.rollback();
35             throw new ServletException JavaDoc(e);
36         }
37
38         return mapping.findForward("success");
39     }
40
41 }
Popular Tags