1   /**
2    * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.kernel.portlet;
24  
25  import java.io.IOException;
26  
27  import javax.portlet.GenericPortlet;
28  import javax.portlet.PortletException;
29  import javax.portlet.PortletMode;
30  import javax.portlet.RenderRequest;
31  import javax.portlet.RenderResponse;
32  import javax.portlet.WindowState;
33  
34  /**
35   * <a href="LiferayPortlet.java.html"><b><i>View Source</i></b></a>
36   *
37   * @author Brian Wing Shun Chan
38   *
39   */
40  public class LiferayPortlet extends GenericPortlet {
41  
42      protected void doDispatch(RenderRequest req, RenderResponse res)
43          throws IOException, PortletException {
44  
45          WindowState state = req.getWindowState();
46  
47          if (!state.equals(WindowState.MINIMIZED)) {
48              PortletMode mode = req.getPortletMode();
49  
50              if (mode.equals(PortletMode.VIEW)) {
51                  doView(req, res);
52              }
53              else if (mode.equals(LiferayPortletMode.ABOUT)) {
54                  doAbout(req, res);
55              }
56              else if (mode.equals(LiferayPortletMode.CONFIG)) {
57                  doConfig(req, res);
58              }
59              else if (mode.equals(PortletMode.EDIT)) {
60                  doEdit(req, res);
61              }
62              else if (mode.equals(LiferayPortletMode.EDIT_DEFAULTS)) {
63                  doEditDefaults(req, res);
64              }
65              else if (mode.equals(LiferayPortletMode.EDIT_GUEST)) {
66                  doEditGuest(req, res);
67              }
68              else if (mode.equals(PortletMode.HELP)) {
69                  doHelp(req, res);
70              }
71              else if (mode.equals(LiferayPortletMode.PREVIEW)) {
72                  doPreview(req, res);
73              }
74              else if (mode.equals(LiferayPortletMode.PRINT)) {
75                  doPrint(req, res);
76              }
77              else {
78                  throw new PortletException(mode.toString());
79              }
80          }
81      }
82  
83      protected void doAbout(RenderRequest req, RenderResponse res)
84          throws IOException, PortletException {
85  
86          throw new PortletException("doAbout method not implemented");
87      }
88  
89      protected void doConfig(RenderRequest req, RenderResponse res)
90          throws IOException, PortletException {
91  
92          throw new PortletException("doConfig method not implemented");
93      }
94  
95      protected void doEditDefaults(RenderRequest req, RenderResponse res)
96          throws IOException, PortletException {
97  
98          throw new PortletException("doEditDefaults method not implemented");
99      }
100 
101     protected void doEditGuest(RenderRequest req, RenderResponse res)
102         throws IOException, PortletException {
103 
104         throw new PortletException("doEditGuest method not implemented");
105     }
106 
107     protected void doPreview(RenderRequest req, RenderResponse res)
108         throws IOException, PortletException {
109 
110         throw new PortletException("doPreview method not implemented");
111     }
112 
113     protected void doPrint(RenderRequest req, RenderResponse res)
114         throws IOException, PortletException {
115 
116         throw new PortletException("doPrint method not implemented");
117     }
118 
119 }