1
2
3
4
5
6 package de.iqser.portlets;
7
8 import java.io.IOException;
9 import java.util.List;
10
11 import javax.portlet.ActionRequest;
12 import javax.portlet.ActionResponse;
13 import javax.portlet.PortletContext;
14 import javax.portlet.PortletException;
15 import javax.portlet.PortletPreferences;
16 import javax.portlet.PortletRequestDispatcher;
17 import javax.portlet.RenderRequest;
18 import javax.portlet.RenderResponse;
19 import javax.portlet.WindowState;
20 import javax.servlet.http.HttpServletRequest;
21 import javax.servlet.http.HttpSession;
22
23 import com.liferay.portal.kernel.log.Log;
24 import com.liferay.portal.kernel.log.LogFactoryUtil;
25 import com.liferay.portal.kernel.util.ParamUtil;
26 import com.liferay.portal.kernel.util.WebKeys;
27 import com.liferay.portal.theme.ThemeDisplay;
28 import com.liferay.portal.util.PortalUtil;
29
30 import de.iqser.beans.ContentBean;
31 import de.iqser.factory.PreviewRenderingFactory;
32 import de.iqser.factory.PreviewRenderingFactoryIF;
33 import de.iqser.factory.RenderingFactoryIF;
34 import de.iqser.portlets.IqserBasePortlet;
35
36 public class PreviewPortlet extends IqserBasePortlet {
37
38 private static Log _ilog = LogFactoryUtil.getLog(PreviewPortlet.class);
39
40
41 public void init() throws PortletException {
42 editJSP = getInitParameter("edit-jsp");
43
44 }
45
46 public void doView(RenderRequest req, RenderResponse res)
47 throws IOException, PortletException {
48
49
50 PortletPreferences prefs= req.getPreferences();
51 String iqserWebserviceUrl= prefs.getValue(IqserBasePortlet.PREF_IQSER_WEBSERVICE, "");
52
53 String contentIdStr= req.getParameter(IqserBasePortlet.PUBLIC_RENDER_PARAM_CONTENT_ID);
54 String contentProviderId= req.getParameter(IqserBasePortlet.PUBLIC_RENDER_PARAM_CONTENT_PROVIDER);
55 String contentType= req.getParameter(IqserBasePortlet.PUBLIC_RENDER_PARAM_CONTENT_TYPE);
56
57 if( contentIdStr != null && contentProviderId != null && contentType != null) {
58 PreviewRenderingFactoryIF renderingFactory= new PreviewRenderingFactory();
59 RenderingFactoryIF factory= renderingFactory.createContent(contentProviderId, contentType, prefs);
60
61 viewJSP= factory.getJSP();
62
63 }
64 else {
65
66 viewJSP= "/html/portlet/previewportlet/empty.jsp";
67 }
68 if( !viewJSP.startsWith("/html/portlet/previewportlet/") ) {
69
70 viewJSP= "/html/portlet/previewportlet/" + viewJSP;
71 }
72
73 res.setContentType("text/html");
74
75 PortletContext portletContext = getPortletContext();
76 PortletRequestDispatcher reqDispatcher= portletContext.getRequestDispatcher(viewJSP);
77
78 reqDispatcher.include(req, res);
79 }
80
81
82
83
84 public void processAction(ActionRequest actionRequest,
85 ActionResponse actionResponse) throws PortletException, IOException {
86
87 super.processAction(actionRequest, actionResponse);
88 }
89 }