View Javadoc
1   package org.itracker.web.util;
2   
3   import org.apache.log4j.Logger;
4   import org.apache.struts.action.ActionForward;
5   import org.apache.struts.action.ActionMapping;
6   import org.itracker.model.Version;
7   
8   import javax.servlet.http.HttpServletRequest;
9   
10  public class EditVersionFormActionUtil {
11      private static final Logger log = Logger
12              .getLogger(EditVersionFormActionUtil.class);
13  
14      public static ActionForward init(ActionMapping mapping, HttpServletRequest request) {
15  
16          if (log.isDebugEnabled()) {
17              log.debug("init: Getting version from session");
18          }
19          final Version version = (Version) request.getSession().getAttribute(
20                  Constants.VERSION_KEY);
21          if (log.isDebugEnabled()) {
22              log.debug("init: Checking if version is new");
23          }
24          final boolean isNew = version.isNew();
25          if (log.isDebugEnabled()) {
26              log.debug("init: Putting the isNew=" + isNew + ", version: "
27                      + version
28                      + " and isNew attribute back into the request");
29          }
30          request.setAttribute("version", version);
31          request.setAttribute("isNew", isNew);
32          return null;
33      }
34  }