1/*2 * Copyright 2000-2001,2004 The Apache Software Foundation.3 * 4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * distributed under the License is distributed on an "AS IS" BASIS,12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13 * See the License for the specific language governing permissions and14 * limitations under the License.15 */1617packageorg.apache.jetspeed.modules.actions.portlets;
1819// Jetspeed stuff20import org.apache.jetspeed.portal.Portlet;
2122// Turbine stuff2324import org.apache.turbine.util.RunData;
2526import org.apache.velocity.context.Context;
2728/***29 * An abstract action class to build JspPortlet actions.30 * 31 * <p>Don't call it from the URL, the Portlet and the Action are automatically32 * associated through the registry PortletName33 * <p>34 * <strong>NOTE:</strong>This supports the pre-MVC style of template based 35 * portlet development and is supplied for backward compatibility. It is36 * suggested you use a combination of 37 * @see org.apache.jetspeed.portal.portlets.GenericMVCPortlet along with38 * subclassing @see org.apache.jetspeed.portal.portlets.GenericMVCAction39 * for future portlet development.40 * </p>41 * 42 * @author <a href="mailto:morciuch@apache.org">Mark Orciuch</a>43 * @author <a href="mailto:sweaver@rippe.com">Scott Weaver</a>44 *45 * @version $Id: JspPortletAction.java,v 1.7 2004/02/23 02:56:58 jford Exp $46 */47publicabstractclassJspPortletActionextendsGenericMVCAction48 {
4950/***51 * @see org.apache.jetspeed.portal.portlets.mvc.PortletAction#buildConfigureContext(Portlet, Context, RunData) 52 */53protectedvoid buildConfigureContext(Portlet portlet, Context context, RunData rundata)
54 throws Exception
55 {
5657 buildConfigureContext(portlet, rundata);
58if (rundata.getRequest().getAttribute("_" + portlet.getID() + "_noConfigureContext")
59 != null)
60 {
61super.buildConfigureContext(portlet, context, rundata);
62 }
63 }
6465/*** 66 * Kept for backward compatibility. New classes should use 67 * the method signatures build*(Portlet, Context, RunData)68 * If you override this method <b>DO NOT</b> call super.buildConfigureContext().69 * <br>70 * Subclasses should override this method if they wish to71 * provide their own customization behavior.72 * Default is to use Portal base customizer action73 */74protectedvoid buildConfigureContext(Portlet portlet, RunData rundata) throws Exception
75 {
7677// STW: backward compatibility bootstrap flag78 rundata.getRequest().setAttribute("_" + portlet.getID() + "_noConfigureContext", " ");
79 }
8081/***82 * @see org.apache.jetspeed.portal.portlets.mvc.PortletAction#buildMaximizedContext(Portlet, Context, RunData)83 */84protectedvoid buildMaximizedContext(Portlet portlet, Context context, RunData rundata)
85 throws Exception
86 {
87 buildMaximizedContext(portlet, rundata);
88if (rundata.getRequest().getAttribute("_" + portlet.getID() + "_noMaximizedContext")
89 != null)
90 {
91super.buildMaximizedContext(portlet, context, rundata);
92 }
93 }
9495/*** 96 * Kept for backward compatibility. New classes should use 97 * the method signatures build*(Portlet, Context, RunData)98 * If you override this method <b>DO NOT</b> call super.buildMaximizedContext().99 * <br>100 * Subclasses should override this method if they wish to101 * build specific content when maximized. Default behavior is102 * to do the same as normal content.<br> 103 */104protectedvoid buildMaximizedContext(Portlet portlet, RunData rundata) throws Exception
105 {
106// STW: backward compatibility bootstrap flag107 rundata.getRequest().setAttribute("_" + portlet.getID() + "_noMaximizedContext", " ");
108 }
109110/***111 * @see org.apache.jetspeed.portal.portlets.mvc.PortletAction#buildNormalContext(Portlet, Context, RunData)112 */113protectedvoid buildNormalContext(Portlet portlet, Context context, RunData data)
114 throws Exception
115 {
116 buildNormalContext(portlet, data);
117 }
118119/*** 120 * Subclasses must override this method to provide default behavior 121 * for the portlet action122 */123protectedabstractvoid buildNormalContext(Portlet portlet, RunData rundata) throws Exception;
124125/***126 * You should use one of PortletAction.setTemplate() methods127 * @deprecated128 */129publicvoid setTemplate(RunData data, Portlet portlet, String template)
130131 {
132if(template != null)
133 {
134super.setTemplate(data, template, true);
135 }
136else137 {
138super.resetTemplate(data);
139 }
140 }
141142 }