KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > dotmarketing > portlets > templates > action > ViewTemplatesAction


1 package com.dotmarketing.portlets.templates.action;
2
3 import javax.portlet.PortletConfig;
4 import javax.portlet.RenderRequest;
5 import javax.portlet.RenderResponse;
6 import javax.portlet.WindowState;
7 import javax.servlet.jsp.PageContext JavaDoc;
8
9 import org.apache.struts.action.ActionForm;
10 import org.apache.struts.action.ActionForward;
11 import org.apache.struts.action.ActionMapping;
12
13 import com.dotmarketing.portal.struts.DotPortletAction;
14 import com.dotmarketing.portlets.templates.model.Template;
15 import com.dotmarketing.util.Logger;
16 import com.dotmarketing.util.WebKeys;
17 import com.liferay.portal.model.User;
18 import com.liferay.portal.util.Constants;
19
20 /**
21  * <a HREF="ViewQuestionsAction.java.htm"><b><i>View Source</i></b></a>
22  *
23  * @author Maria Ahues
24  * @version $Revision: 1.3 $
25  *
26  */

27 public class ViewTemplatesAction extends DotPortletAction {
28
29     public ActionForward render(
30             ActionMapping mapping, ActionForm form, PortletConfig config,
31             RenderRequest req, RenderResponse res)
32         throws Exception JavaDoc {
33
34         Logger.debug(this, "Running ViewTemplatesAction!!!!");
35
36         try {
37             //get the user
38
User user = _getUser(req);
39             
40             if (req.getWindowState().equals(WindowState.NORMAL)) {
41                 return mapping.findForward("portlet.ext.templates.view");
42             }
43             else {
44                 /** @see com.dotmarketing.portal.struts.DotPortletAction._viewWebAssets **/
45                 _viewWebAssets(req, user, Template.class, "template",WebKeys.TEMPLATES_VIEW_COUNT,WebKeys.TEMPLATES_VIEW, WebKeys.TEMPLATE_QUERY, WebKeys.TEMPLATE_SHOW_DELETED);
46                 return mapping.findForward("portlet.ext.templates.view_templates");
47             }
48         }
49         catch (Exception JavaDoc e) {
50             req.setAttribute(PageContext.EXCEPTION, e);
51             return mapping.findForward(Constants.COMMON_ERROR);
52         }
53     }
54
55 }
Popular Tags