paulsp 2002/11/23 03:46:42
Modified: src/java/org/apache/jetspeed/util/template
BaseJetspeedLink.java
Log:
Formatting changes directed by checkstyle.
No functional changes.
Revision Changes Path
1.20 +154 -94
jakarta-jetspeed/src/java/org/apache/jetspeed/util/template/BaseJetspeedLink.java
Index: BaseJetspeedLink.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/util/template/BaseJetspeedLink.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- BaseJetspeedLink.java 23 Nov 2002 09:48:09 -0000 1.19
+++ BaseJetspeedLink.java 23 Nov 2002 11:46:42 -0000 1.20
@@ -65,17 +65,17 @@
import org.apache.jetspeed.services.resources.JetspeedResources;
import org.apache.jetspeed.services.rundata.JetspeedRunData;
import org.apache.jetspeed.util.template.JetspeedLink;
-import org.apache.jetspeed.om.profile.Entry;
+//import org.apache.jetspeed.om.profile.Entry;
// Turbine
import org.apache.turbine.util.RunData;
import org.apache.turbine.util.Log;
import org.apache.turbine.util.DynamicURI;
-import org.apache.turbine.util.template.TemplateLink;
+//import org.apache.turbine.util.template.TemplateLink;
import org.apache.turbine.services.pull.ApplicationTool;
-import org.apache.turbine.services.pool.TurbinePool;
-import org.apache.turbine.services.pool.PoolService;
-import org.apache.turbine.services.TurbineServices;
+//import org.apache.turbine.services.pool.TurbinePool;
+//import org.apache.turbine.services.pool.PoolService;
+//import org.apache.turbine.services.TurbineServices;
/**
* <p>A customized version of the TemplateLink which can handle portlet
@@ -145,7 +145,7 @@
*/
public void init(RunData rundata)
{
- init( (Object) rundata);
+ init((Object) rundata);
}
/**
@@ -160,7 +160,8 @@
try
{
return getRoot().addQueryData(name, value);
- } catch (ProfileException e)
+ }
+ catch (ProfileException e)
{
Log.error(e);
return null;
@@ -179,7 +180,8 @@
try
{
return getRoot().addPathInfo(name, value);
- } catch (ProfileException e)
+ }
+ catch (ProfileException e)
{
Log.error(e);
return null;
@@ -197,11 +199,17 @@
public DynamicURI setPortalElement(String peid)
{
if (initDone == false)
+ {
initLink();
- if (profile.getDocument().getEntryById( peid) != null)
- return getPortletById( peid);
+ }
+ if (profile.getDocument().getEntryById(peid) != null)
+ {
+ return getPortletById(peid);
+ }
else
+ {
return setPaneById(peid);
+ }
}
/**
@@ -214,7 +222,7 @@
*/
public DynamicURI setPortletById(String peid)
{
- return getPortletById( peid);
+ return getPortletById(peid);
}
/**
@@ -226,7 +234,7 @@
*/
public DynamicURI getHomePage()
{
- return getLink(
JetspeedLink.DEFAULT,null,"",JetspeedLink.DEFAULT,null,"","","","","");
+ return getLink(JetspeedLink.DEFAULT, null, "", JetspeedLink.DEFAULT, null,
"", "", "", "", "");
}
/**
@@ -238,7 +246,7 @@
public DynamicURI getTemplate()
{
String template = rundata.getRequestedTemplate();
- return getLink( JetspeedLink.CURRENT, null, null, JetspeedLink.DEFAULT,
null, null, template, null, null, null);
+ return getLink(JetspeedLink.CURRENT, null, null, JetspeedLink.DEFAULT,
null, null, template, null, null, null);
}
/**
@@ -279,7 +287,7 @@
*/
public DynamicURI setAction(String action, Portlets portlets)
{
- return getAction( action, (Portlets) portlets);
+ return getAction(action, (Portlets) portlets);
}
/**
@@ -293,7 +301,7 @@
*/
public DynamicURI setAction(String action, Portlet portlet)
{
- return getAction( action, (Portlet) portlet);
+ return getAction(action, (Portlet) portlet);
}
/**
@@ -308,7 +316,7 @@
*/
public DynamicURI setAction(String action, Entry entry)
{
- return getAction( action, (Entry) entry);
+ return getAction(action, (Entry) entry);
}
/**
@@ -322,7 +330,7 @@
*/
public DynamicURI setAction(String action, String peid)
{
- return getAction( action, (String) peid);
+ return getAction(action, (String) peid);
}
/**
@@ -335,7 +343,7 @@
*/
public DynamicURI setGroup(String group)
{
- return getGroup( group);
+ return getGroup(group);
}
/**
@@ -349,7 +357,7 @@
*/
public DynamicURI setGroup(String group, String page)
{
- return getGroup( group, page);
+ return getGroup(group, page);
}
/**
@@ -390,7 +398,7 @@
*/
public DynamicURI setPage(String page, String paneName)
{
- return getPage( page, paneName);
+ return getPage(page, paneName);
}
@@ -418,7 +426,7 @@
*/
public DynamicURI setRole(String role, String page)
{
- return getRole( role, page);
+ return getRole(role, page);
}
/**
@@ -445,7 +453,7 @@
*/
public DynamicURI setUser(String user, String page)
{
- return getUser( user, page);
+ return getUser(user, page);
}
/**
@@ -458,7 +466,7 @@
*/
public DynamicURI setPaneById(String paneId)
{
- return getPaneById( paneId);
+ return getPaneById(paneId);
}
/**
@@ -470,7 +478,7 @@
*/
public DynamicURI setPaneByName(String paneName)
{
- return getPaneByName( paneName);
+ return getPaneByName(paneName);
}
/**
@@ -532,24 +540,26 @@
break;
}
- if (rootType != JetspeedLink.CURRENT )
+ if (rootType != JetspeedLink.CURRENT)
{
// Cleanup URI
- uri.removePathInfo( Profiler.PARAM_GROUP);
- uri.removePathInfo( Profiler.PARAM_ROLE);
- uri.removePathInfo( Profiler.PARAM_USER);
+ uri.removePathInfo(Profiler.PARAM_GROUP);
+ uri.removePathInfo(Profiler.PARAM_ROLE);
+ uri.removePathInfo(Profiler.PARAM_USER);
- if ((rootType != JetspeedLink.DEFAULT ) && (rootValue != null) &&
(rootValue.trim().length() > 0))
- uri.addPathInfo( uriPathType, rootValue);
+ if ((rootType != JetspeedLink.DEFAULT) && (rootValue != null) &&
(rootValue.trim().length() > 0))
+ {
+ uri.addPathInfo(uriPathType, rootValue);
+ }
}
// Set Page in path
if (pageName != null)
{
- uri.removePathInfo( Profiler.PARAM_PAGE);
+ uri.removePathInfo(Profiler.PARAM_PAGE);
if (pageName.trim().length() > 0)
{
- uri.addPathInfo( Profiler.PARAM_PAGE, pageName);
+ uri.addPathInfo(Profiler.PARAM_PAGE, pageName);
}
}
@@ -603,7 +613,7 @@
break;
}
- if (rootType != JetspeedLink.CURRENT && rootType !=
JetspeedLink.DEFAULT)
+ if ((rootType != JetspeedLink.CURRENT) && (rootType !=
JetspeedLink.DEFAULT))
{
if (mediaType != null && mediaType.length() > 0)
{
@@ -625,7 +635,7 @@
}
Log.debug("BaseJetspeedLink: baseLocator = " +
baseLocator.getPath());
- if (baseProfile != null && elementValue != null)
+ if ((baseProfile != null) && (elementValue != null))
{
Log.debug("BaseJetspeedLink: baseProfile = " +
baseProfile.toString());
if (baseProfile.getDocument() != null)
@@ -647,60 +657,73 @@
break;
}
- if (elementType != JetspeedLink.CURRENT )
+ if (elementType != JetspeedLink.CURRENT)
{
// Remove Group/Role/User in URI
- uri.removePathInfo( JetspeedResources.PATH_PANEID_KEY);
- uri.removePathInfo( JetspeedResources.PATH_PANENAME_KEY);
- uri.removePathInfo( JetspeedResources.PATH_PORTLETID_KEY);
- uri.removePathInfo( JetspeedResources.PATH_PORTLET_KEY);
+ uri.removePathInfo(JetspeedResources.PATH_PANEID_KEY);
+ uri.removePathInfo(JetspeedResources.PATH_PANENAME_KEY);
+ uri.removePathInfo(JetspeedResources.PATH_PORTLETID_KEY);
+ uri.removePathInfo(JetspeedResources.PATH_PORTLET_KEY);
- if ((elementType != JetspeedLink.DEFAULT ) && (elementValue !=
null) && (elementValue.length() > 0))
- uri.addPathInfo( uriPathElement, elementValue);
+ if ((elementType != JetspeedLink.DEFAULT) && (elementValue != null)
&& (elementValue.length() > 0))
+ {
+ uri.addPathInfo(uriPathElement, elementValue);
+ }
}
// Set Template in path
if (templateName != null)
{
- uri.removePathInfo( JetspeedResources.PATH_TEMPLATE_KEY);
+ uri.removePathInfo(JetspeedResources.PATH_TEMPLATE_KEY);
if (templateName.length() > 0)
- uri.addPathInfo( JetspeedResources.PATH_TEMPLATE_KEY,
templateName);
+ {
+ uri.addPathInfo(JetspeedResources.PATH_TEMPLATE_KEY,
templateName);
+ }
}
// Set Action in path
if (actionName != null)
{
- uri.removeQueryData( JetspeedResources.PATH_ACTION_KEY);
+ uri.removeQueryData(JetspeedResources.PATH_ACTION_KEY);
if (actionName.length() > 0)
- uri.addQueryData( JetspeedResources.PATH_ACTION_KEY,
actionName);
+ {
+ uri.addQueryData(JetspeedResources.PATH_ACTION_KEY, actionName);
+ }
}
// Set MediaType in path
if (mediaType != null)
{
- uri.removePathInfo( Profiler.PARAM_MEDIA_TYPE);
+ uri.removePathInfo(Profiler.PARAM_MEDIA_TYPE);
if (mediaType.length() > 0)
- uri.addPathInfo( Profiler.PARAM_MEDIA_TYPE, mediaType);
+ {
+ uri.addPathInfo(Profiler.PARAM_MEDIA_TYPE, mediaType);
+ }
}
// Set Language in path
if (language != null)
{
- uri.removePathInfo( Profiler.PARAM_LANGUAGE);
+ uri.removePathInfo(Profiler.PARAM_LANGUAGE);
if (language.length() > 0)
- uri.addPathInfo( Profiler.PARAM_LANGUAGE, language);
+ {
+ uri.addPathInfo(Profiler.PARAM_LANGUAGE, language);
+ }
}
// Set Country in path
if (country != null)
{
- uri.removePathInfo( Profiler.PARAM_COUNTRY);
+ uri.removePathInfo(Profiler.PARAM_COUNTRY);
if (country.length() > 0)
- uri.addPathInfo( Profiler.PARAM_COUNTRY, country);
+ {
+ uri.addPathInfo(Profiler.PARAM_COUNTRY, country);
+ }
}
return uri;
- } catch (ProfileException e)
+ }
+ catch (ProfileException e)
{
Log.error(e);
return null;
@@ -741,7 +764,7 @@
*/
public DynamicURI getAction(String action)
{
- return getLink( JetspeedLink.CURRENT, null, null, JetspeedLink.CURRENT,
null, action, null, null, null, null);
+ return getLink(JetspeedLink.CURRENT, null, null, JetspeedLink.CURRENT,
null, action, null, null, null, null);
}
/**
@@ -754,10 +777,14 @@
*/
public DynamicURI getAction(String action, Entry entry)
{
- if ( entry != null)
- return getLink( JetspeedLink.CURRENT, null, null,
JetspeedLink.PORTLET_ID, entry.getId(), null, action, null, null, null);
+ if (entry != null)
+ {
+ return getLink(JetspeedLink.CURRENT, null, null,
JetspeedLink.PORTLET_ID, entry.getId(), null, action, null, null, null);
+ }
else
- return getLink( JetspeedLink.CURRENT, null, null,
JetspeedLink.PORTLET_ID, null, null, action, null, null, null);
+ {
+ return getLink(JetspeedLink.CURRENT, null, null,
JetspeedLink.PORTLET_ID, null, null, action, null, null, null);
+ }
}
/**
@@ -769,10 +796,14 @@
*/
public DynamicURI getAction(String action, Portlet portlet)
{
- if ( portlet != null)
- return getLink( JetspeedLink.CURRENT, null, null,
JetspeedLink.PORTLET_ID, portlet.getID(), action, null, null, null, null);
+ if (portlet != null)
+ {
+ return getLink(JetspeedLink.CURRENT, null, null,
JetspeedLink.PORTLET_ID, portlet.getID(), action, null, null, null, null);
+ }
else
- return getLink( JetspeedLink.CURRENT, null, null,
JetspeedLink.PORTLET_ID, null, action, null, null, null, null);
+ {
+ return getLink(JetspeedLink.CURRENT, null, null,
JetspeedLink.PORTLET_ID, null, action, null, null, null, null);
+ }
}
/**
@@ -785,10 +816,14 @@
*/
public DynamicURI getAction(String action, Portlets portlets)
{
- if ( portlets != null)
- return getLink( JetspeedLink.CURRENT, null, null,
JetspeedLink.PORTLET_ID, portlets.getId(), action, null, null, null, null);
+ if (portlets != null)
+ {
+ return getLink(JetspeedLink.CURRENT, null, null,
JetspeedLink.PORTLET_ID, portlets.getId(), action, null, null, null, null);
+ }
else
- return getLink( JetspeedLink.CURRENT, null, null,
JetspeedLink.PORTLET_ID, null, action, null, null, null, null);
+ {
+ return getLink(JetspeedLink.CURRENT, null, null,
JetspeedLink.PORTLET_ID, null, action, null, null, null, null);
+ }
}
/**
@@ -801,7 +836,7 @@
*/
public DynamicURI getAction(String action, String peid)
{
- return getLink( JetspeedLink.CURRENT, null, null, JetspeedLink.PORTLET_ID,
peid, action, null, null, null, null);
+ return getLink(JetspeedLink.CURRENT, null, null, JetspeedLink.PORTLET_ID,
peid, action, null, null, null, null);
}
/**
@@ -812,7 +847,7 @@
*/
public DynamicURI getGroup(String group)
{
- return getLink( JetspeedLink.GROUP, group, "", JetspeedLink.DEFAULT, null,
null,null,null,null,null);
+ return getLink(JetspeedLink.GROUP, group, "", JetspeedLink.DEFAULT, null,
null, null, null, null, null);
}
/**
@@ -824,7 +859,7 @@
*/
public DynamicURI getGroup(String group, String page)
{
- return getLink( JetspeedLink.GROUP, group, page, JetspeedLink.DEFAULT,
null, null,null,null,null,null);
+ return getLink(JetspeedLink.GROUP, group, page, JetspeedLink.DEFAULT, null,
null, null, null, null, null);
}
/**
* Return a link to a default page for the
@@ -834,7 +869,7 @@
*/
public DynamicURI getPage()
{
- return getLink( JetspeedLink.CURRENT, null, "", JetspeedLink.DEFAULT, null,
null,null,null,null,null);
+ return getLink(JetspeedLink.CURRENT, null, "", JetspeedLink.DEFAULT, null,
null, null, null, null, null);
}
/**
@@ -846,7 +881,7 @@
*/
public DynamicURI getPage(String page)
{
- return getLink( JetspeedLink.CURRENT, null, page, JetspeedLink.DEFAULT,
null, null,null,null,null,null);
+ return getLink(JetspeedLink.CURRENT, null, page, JetspeedLink.DEFAULT,
null, null, null, null, null, null);
}
/**
@@ -859,7 +894,7 @@
*/
public DynamicURI getPage(String page, String paneName)
{
- return getLink( JetspeedLink.CURRENT, null, page, JetspeedLink.PANE_NAME,
paneName, null,null,null,null,null);
+ return getLink(JetspeedLink.CURRENT, null, page, JetspeedLink.PANE_NAME,
paneName, null, null, null, null, null);
}
/**
* Return a link to a specific pane using the pane's id
@@ -869,7 +904,7 @@
*/
public DynamicURI getPaneById(String paneId)
{
- return getLink( JetspeedLink.CURRENT, null, this.getPageName(),
JetspeedLink.PANE_ID, paneId, null,null,null,null,null);
+ return getLink(JetspeedLink.CURRENT, null, this.getPageName(),
JetspeedLink.PANE_ID, paneId, null, null, null, null, null);
}
/**
@@ -880,7 +915,7 @@
*/
public DynamicURI getPaneByName(String paneName)
{
- return getLink( JetspeedLink.CURRENT, null, this.getPageName(),
JetspeedLink.PANE_NAME, paneName, null,null,null,null,null);
+ return getLink(JetspeedLink.CURRENT, null, this.getPageName(),
JetspeedLink.PANE_NAME, paneName, null, null, null, null, null);
}
/**
@@ -891,7 +926,7 @@
*/
public DynamicURI getPortletById(String peid)
{
- return getLink( JetspeedLink.CURRENT, null, this.getPageName(),
JetspeedLink.PORTLET_ID, peid, null,null,null,null,null);
+ return getLink(JetspeedLink.CURRENT, null, this.getPageName(),
JetspeedLink.PORTLET_ID, peid, null, null, null, null, null);
}
/**
* Add a portlet reference in the link.
@@ -904,7 +939,7 @@
*/
public DynamicURI getPortletByName(String portletName)
{
- return getLink( JetspeedLink.CURRENT, null, this.getPageName(),
JetspeedLink.PORTLET_NAME, portletName, null,null,null,null,null);
+ return getLink(JetspeedLink.CURRENT, null, this.getPageName(),
JetspeedLink.PORTLET_NAME, portletName, null, null, null, null, null);
}
/**
* Return a link to a default page for the role
@@ -914,7 +949,7 @@
*/
public DynamicURI getRole(String role)
{
- return getLink( JetspeedLink.ROLE, role, "", JetspeedLink.DEFAULT, null,
null,null,null,null,null);
+ return getLink(JetspeedLink.ROLE, role, "", JetspeedLink.DEFAULT, null,
null, null, null, null, null);
}
/**
@@ -926,7 +961,7 @@
*/
public DynamicURI getRole(String role, String page)
{
- return getLink( JetspeedLink.ROLE, role, page, JetspeedLink.DEFAULT, null,
null, null, null, null, null);
+ return getLink(JetspeedLink.ROLE, role, page, JetspeedLink.DEFAULT, null,
null, null, null, null, null);
}
/**
@@ -937,7 +972,7 @@
*/
public DynamicURI getTemplate(String template)
{
- return getLink( JetspeedLink.CURRENT, null, null, JetspeedLink.DEFAULT,
null, null, template, null, null, null);
+ return getLink(JetspeedLink.CURRENT, null, null, JetspeedLink.DEFAULT,
null, null, template, null, null, null);
}
/**
@@ -948,7 +983,7 @@
*/
public DynamicURI getUser(String user)
{
- return getLink( JetspeedLink.USER, user, "", JetspeedLink.DEFAULT, null,
null,null,null,null,null);
+ return getLink(JetspeedLink.USER, user, "", JetspeedLink.DEFAULT, null,
null, null, null, null, null);
}
/**
@@ -960,13 +995,15 @@
*/
public DynamicURI getUser(String user, String page)
{
- return getLink( JetspeedLink.USER, user, page, JetspeedLink.DEFAULT, null,
null,null,null,null,null);
+ return getLink(JetspeedLink.USER, user, page, JetspeedLink.DEFAULT, null,
null, null, null, null, null);
}
private void initLink()
{
if (initDone == true)
+ {
return;
+ }
try
{
@@ -982,7 +1019,8 @@
rundata.setProfile(profile);
Log.warn("BaseJetspeedLink: profile in rundata was null");
}
- } catch (ProfileException e)
+ }
+ catch (ProfileException e)
{
Log.error(e);
}
@@ -990,7 +1028,9 @@
{
// Get ProfileLocator for path info.
if ((profile instanceof ProfileLocator) == true)
+ {
locator = (ProfileLocator) profile;
+ }
}
initDone = true;
}
@@ -1006,10 +1046,14 @@
DynamicURI uri = null;
initLink();
if (locator != null)
+ {
uri = Profiler.makeDynamicURI(rundata, locator);
+ }
if (uri == null)
- uri = new DynamicURI( rundata);
+ {
+ uri = new DynamicURI(rundata);
+ }
// check if we need to force to a secure (https) link
if (JetspeedResources.getBoolean("force.ssl", false))
@@ -1030,7 +1074,8 @@
try
{
return getRoot().toString();
- } catch (ProfileException e)
+ }
+ catch (ProfileException e)
{
Log.error(e);
return null;
@@ -1058,7 +1103,8 @@
try
{
return locator.getAnonymous();
- } catch (Exception e)
+ }
+ catch (Exception e)
{
Log.error(e);
return true;
@@ -1076,7 +1122,8 @@
try
{
return locator.getCountry();
- } catch (Exception e)
+ }
+ catch (Exception e)
{
Log.error(e);
return null;
@@ -1094,7 +1141,8 @@
try
{
return locator.getGroupName();
- } catch (Exception e)
+ }
+ catch (Exception e)
{
Log.error(e);
return null;
@@ -1112,7 +1160,8 @@
try
{
return locator.getLanguage();
- } catch (Exception e)
+ }
+ catch (Exception e)
{
Log.error(e);
return null;
@@ -1130,7 +1179,8 @@
try
{
return locator.getMediaType();
- } catch (Exception e)
+ }
+ catch (Exception e)
{
Log.error(e);
return null;
@@ -1148,7 +1198,8 @@
try
{
return locator.getName();
- } catch (Exception e)
+ }
+ catch (Exception e)
{
Log.error(e);
return null;
@@ -1166,7 +1217,8 @@
try
{
return locator.getRoleName();
- } catch (Exception e)
+ }
+ catch (Exception e)
{
Log.error(e);
return null;
@@ -1184,7 +1236,8 @@
try
{
return locator.getUserName();
- } catch (Exception e)
+ }
+ catch (Exception e)
{
Log.error(e);
return null;
@@ -1252,7 +1305,7 @@
*/
public void setPortlet(Portlet portlet)
{
- this.activePortlet=portlet;
+ this.activePortlet = portlet;
}
@@ -1267,17 +1320,20 @@
*/
public DynamicURI setPortletByName(String portletName)
{
- DynamicURI uri=null;
+ DynamicURI uri = null;
try
{
uri = getRoot();
- } catch (Exception e)
+ }
+ catch (Exception e)
{
Log.error(e);
return null;
}
if ((portletName != null) && (portletName.length() > 0))
+ {
uri.addPathInfo(JetspeedResources.PATH_PORTLET_KEY, portletName);
+ }
return uri;
}
@@ -1298,9 +1354,13 @@
{
// Keeping init small and fast
if (data instanceof JetspeedRunData)
- this.rundata = (JetspeedRunData)data;
+ {
+ this.rundata = (JetspeedRunData) data;
+ }
else
+ {
this.rundata = null;
+ }
profile = null;
locator = null;
initDone = false;
@@ -1316,7 +1376,7 @@
public DynamicURI setMediaType(String mediaType)
{
- return getLink( JetspeedLink.CURRENT, null, null, JetspeedLink.DEFAULT,
null, null,null,mediaType);
+ return getLink(JetspeedLink.CURRENT, null, null, JetspeedLink.DEFAULT,
null, null, null, mediaType);
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>