KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > nextime > ion > backoffice > action > content > NewVersionAction


1 package org.nextime.ion.backoffice.action.content;
2
3 import java.io.IOException JavaDoc;
4 import javax.servlet.ServletException JavaDoc;
5 import javax.servlet.http.HttpServletRequest JavaDoc;
6 import javax.servlet.http.HttpServletResponse JavaDoc;
7 import org.apache.struts.action.ActionForm;
8 import org.apache.struts.action.ActionForward;
9 import org.apache.struts.action.ActionMapping;
10 import org.nextime.ion.backoffice.action.BaseAction;
11
12 import org.nextime.ion.framework.business.Publication;
13 import org.nextime.ion.framework.business.User;
14 import org.nextime.ion.framework.mapping.Mapping;
15
16 public class NewVersionAction extends BaseAction {
17
18     public ActionForward perform(
19         ActionMapping mapping,
20         ActionForm form,
21         HttpServletRequest JavaDoc request,
22         HttpServletResponse JavaDoc response)
23         throws IOException JavaDoc, ServletException JavaDoc {
24
25         // check if user is correctly logged
26
checkUser(request);
27
28         String JavaDoc id = request.getParameter("id");
29         
30         try {
31             Mapping.begin();
32             Publication.getInstance(id).newVersion(User.getInstance(request.getSession().getAttribute("userLogin")+""));
33             Mapping.commit();
34         } catch (Exception JavaDoc e) {
35             Mapping.rollback();
36             throw new ServletException JavaDoc(e);
37         }
38         
39         // Forward to the next page
40
return (mapping.findForward("ok"));
41
42     }
43
44 }
45
Popular Tags