1 package org.nextime.ion.backoffice.action.content; 2 3 4 import java.io.IOException ; 5 import java.util.Collections ; 6 import java.util.Vector ; 7 8 import javax.servlet.ServletException ; 9 import javax.servlet.http.HttpServletRequest ; 10 import javax.servlet.http.HttpServletResponse ; 11 12 import org.apache.struts.action.ActionForm; 13 import org.apache.struts.action.ActionForward; 14 import org.apache.struts.action.ActionMapping; 15 import org.nextime.ion.backoffice.action.BaseAction; 16 import org.nextime.ion.framework.business.Publication; 17 import org.nextime.ion.framework.mapping.Mapping; 18 19 public class HistoryPublicationAction extends BaseAction { 20 21 public ActionForward perform(ActionMapping mapping, 22 ActionForm form, 23 HttpServletRequest request, 24 HttpServletResponse response) 25 throws IOException , ServletException { 26 27 checkUser(request); 29 30 String id = request.getParameter("id"); 31 int version = Integer.parseInt(request.getParameter("version")); 32 33 try { 34 Mapping.begin(); 35 36 Publication publication = Publication.getInstance(id); 37 Vector history = publication.getVersion(version).getWorkflow().getHistorySteps(); 38 Vector current = publication.getVersion(version).getWorkflow().getCurrentSteps(); 39 Collections.reverse(history); 40 Collections.reverse(current); 41 request.setAttribute("history", history); 42 request.setAttribute("current", current); 43 44 Mapping.rollback(); 45 } catch( Exception e ) { 46 Mapping.rollback(); 47 throw new ServletException (e); 48 } 49 50 return (mapping.findForward("view")); 52 53 } 54 55 } 56 | Popular Tags |