taylor 2004/08/17 18:18:38
Added: fusion/src/java/org/apache/jetspeed/fusion/util/template
FusionJetspeedLink.java
Log:
JetspeedLinks need to consider existing stateful Portlet API request parameters
(paths)
This work is still under construction
CVS: ----------------------------------------------------------------------
CVS: PR:
CVS: If this change addresses a PR in the problem report tracking
CVS: database, then enter the PR number(s) here.
CVS: Obtained from:
CVS: If this change has been taken from another system, such as NCSA,
CVS: then name the system in this line, otherwise delete it.
CVS: Submitted by:
CVS: If this code has been contributed to Apache by someone else; i.e.,
CVS: they sent us a patch or a new module, then include their name/email
CVS: address here. If this is your work then delete this line.
CVS: Reviewed by:
CVS: If we are doing pre-commit code reviews and someone else has
CVS: reviewed your changes, include their name(s) here.
CVS: If you have not had it reviewed then delete this line.
Revision Changes Path
1.1
jakarta-jetspeed/fusion/src/java/org/apache/jetspeed/fusion/util/template/FusionJetspeedLink.java
Index: FusionJetspeedLink.java
===================================================================
/*
* Copyright 2000-2001,2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.jetspeed.fusion.util.template;
import java.util.Iterator;
import java.util.Map;
import org.apache.jetspeed.container.session.NavigationalState;
import org.apache.jetspeed.container.session.impl.JetspeedNavigationalStateComponent;
import org.apache.jetspeed.container.url.PortalControlParameter;
import org.apache.jetspeed.container.url.PortalURL;
import org.apache.jetspeed.fusion.portal.portlets.JetspeedFusionPortlet;
import org.apache.jetspeed.om.profile.ProfileException;
import org.apache.jetspeed.request.RequestContext;
import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
import org.apache.jetspeed.services.logging.JetspeedLogger;
import org.apache.jetspeed.services.rundata.JetspeedRunData;
import org.apache.jetspeed.util.template.BaseJetspeedLink;
import org.apache.jetspeed.util.template.JetspeedLink;
import org.apache.turbine.services.pull.ApplicationTool;
import org.apache.turbine.util.DynamicURI;
import org.apache.turbine.util.RunData;
/**
* <p>A customized version of the TemplateLink which can handle portlet
* references.</p>
*
* <p>It is inserted into the template context by Turbine, via request tools.</p>
*
* <p>Each portlet must call setPortlet(this) on it before entering the template
* rendering code. This is done currently in VelocityPortlet.</p>
*
* @author <a href="mailto:[EMAIL PROTECTED]">David Sean Taylor</a>
* @version $Id: FusionJetspeedLink.java,v 1.1 2004/08/18 01:18:38 taylor Exp $
*/
public class FusionJetspeedLink extends BaseJetspeedLink implements
ApplicationTool, JetspeedLink
{
private static final JetspeedLogger logger =
JetspeedLogFactoryService.getLogger(BaseJetspeedLink.class.getName());
/**
* Empty constructor.for introspection
*/
public FusionJetspeedLink()
{
super();
}
/**
* Constructor required by ApplicationTool interface
*
* @param data A Jetspeed RunData object.
*/
public FusionJetspeedLink(RunData data)
{
super(data);
init((Object) data);
}
/**
* This will initialise a JetspeedLink object that was
* constructed with the default constructor
*
* @param rundata to be a RunData object
*/
public void init(RunData rundata)
{
super.init(rundata);
}
public DynamicURI getLink(int rootType, String rootValue, String pageName, int
elementType, String elementValue, String actionName, String templateName, String
mediaType, String language, String country)
{
DynamicURI uri = super.getLink(rootType, rootValue, pageName, elementType,
elementValue, actionName, templateName, mediaType, language, country);
NavigationalState state = getNavigationalState(this.rundata);
RequestContext context = (RequestContext)
this.rundata.getRequest().getAttribute(JetspeedFusionPortlet.FUSION_NAV_STATE);
if (context != null)
{
PortalURL url = context.getPortalURL();
PortalControlParameter pcp = url.getControlParameters();
Map stateful = pcp.getStateFullControlParameter();
Iterator params = stateful.entrySet().iterator();
while (params.hasNext())
{
Map.Entry entry = (Map.Entry)params.next();
uri.addPathInfo(entry.getKey().toString(), entry.getValue());
}
}
return uri;
}
public NavigationalState getNavigationalState(JetspeedRunData data)
{
return
(NavigationalState)data.getSession().getAttribute(JetspeedNavigationalStateComponent.NAVSTATE_SESSION_KEY);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]