paulsp 2002/08/25 14:38:58
Modified: src/java/org/apache/jetspeed/portal BasePortletSet.java
Log:
o Housekeeping directed by checkStyle.
No functional changes
Revision Changes Path
1.27 +95 -71
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/BasePortletSet.java
Index: BasePortletSet.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/BasePortletSet.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- BasePortletSet.java 25 Aug 2002 19:52:07 -0000 1.26
+++ BasePortletSet.java 25 Aug 2002 21:38:58 -0000 1.27
@@ -54,18 +54,14 @@
package org.apache.jetspeed.portal;
-//standard java stuff
-import java.util.Map;
+// standard java stuff
import java.util.Vector;
import java.util.Enumeration;
-//Jetspeed stuff
+// Jetspeed stuff
import org.apache.jetspeed.om.security.JetspeedUser;
import org.apache.jetspeed.services.persistence.PersistenceManager;
import org.apache.jetspeed.services.persistence.PortalPersistenceException;
-import org.apache.jetspeed.services.portletcache.Cacheable;
-import org.apache.jetspeed.services.resources.JetspeedResources;
-import org.apache.jetspeed.services.rundata.JetspeedRunData;
import org.apache.jetspeed.services.security.PortalResource;
import org.apache.jetspeed.services.JetspeedSecurity;
import org.apache.jetspeed.util.template.JetspeedLink;
@@ -73,12 +69,12 @@
import org.apache.jetspeed.util.MetaData;
import org.apache.jetspeed.util.MimeType;
-//turbine stuff
+// turbine stuff
import org.apache.turbine.services.localization.Localization;
import org.apache.turbine.util.Log;
import org.apache.turbine.util.RunData;
-//ECS stuff
+// ECS stuff
import org.apache.ecs.ConcreteElement;
import org.apache.ecs.StringElement;
@@ -141,7 +137,8 @@
public BasePortletSet()
{
portlets = new Vector();
- try {
+ try
+ {
init();
}
catch (PortletException e)
@@ -163,7 +160,7 @@
*/
public void init() throws PortletException
{
- if (getPortletConfig()==null)
+ if (getPortletConfig() == null)
{
setPortletConfig(new BasePortletConfig());
}
@@ -197,7 +194,7 @@
public Portlet getPortletAt(int pos)
{
sortPortletSet();
- return (Portlet)portlets.elementAt(pos);
+ return (Portlet) portlets.elementAt(pos);
}
/**
@@ -206,14 +203,18 @@
public Portlet getPortletByID(String id)
{
if (portlets == null)
+ {
return null;
+ }
Portlet portlet = null;
- for (int ix=0; ix < portlets.size(); ix++)
+ for (int ix = 0; ix < portlets.size(); ix++)
{
- portlet = (Portlet)portlets.elementAt(ix);
+ portlet = (Portlet) portlets.elementAt(ix);
if (portlet.getID().equals(id))
+ {
return portlet;
+ }
}
return null;
}
@@ -224,14 +225,18 @@
public Portlet getPortletByName(String name)
{
if (portlets == null)
+ {
return null;
+ }
Portlet portlet = null;
- for (int ix=0; ix < portlets.size(); ix++)
+ for (int ix = 0; ix < portlets.size(); ix++)
{
- portlet = (Portlet)portlets.elementAt(ix);
+ portlet = (Portlet) portlets.elementAt(ix);
if (portlet.getName().equals(name))
+ {
return portlet;
+ }
}
return null;
}
@@ -253,7 +258,7 @@
*/
public void addPortlet(Portlet portlet)
{
- addPortlet(portlet,null,-1);
+ addPortlet(portlet, null, -1);
}
/**
@@ -261,7 +266,7 @@
*/
public void addPortlet(Portlet portlet, int position)
{
- addPortlet(portlet,null,position);
+ addPortlet(portlet, null, position);
}
/**
@@ -269,7 +274,7 @@
*/
public void addPortlet(Portlet portlet, PortletSet.Constraints constraints)
{
- addPortlet(portlet,constraints,-1);
+ addPortlet(portlet, constraints, -1);
}
/**
@@ -280,15 +285,21 @@
synchronized (portlets)
{
portlets.addElement(portlet);
- PortletConfig pc=portlet.getPortletConfig();
- if (pc!=null)
+ PortletConfig pc = portlet.getPortletConfig();
+ if (pc != null)
{
pc.setPortletSet(this);
- if (constraints!=null) pc.setConstraints(constraints);
- if (position >=0)
+ if (constraints != null)
+ {
+ pc.setConstraints(constraints);
+ }
+ if (position >= 0)
{
pc.setPosition(position);
- if (position < portlets.size()-1) this.dirty = true;
+ if (position < (portlets.size() - 1))
+ {
+ this.dirty = true;
+ }
}
}
}
@@ -309,7 +320,7 @@
*/
public synchronized void setController(PortletController controller)
{
- this.controller=controller;
+ this.controller = controller;
controller.setPortlets(this);
}
@@ -336,12 +347,12 @@
portalResource.setOwner(null);
}
- if(!JetspeedSecurity.checkPermission((JetspeedUser) rundata.getUser(),
+ if (!JetspeedSecurity.checkPermission((JetspeedUser) rundata.getUser(),
portalResource, JetspeedSecurity.PERMISSION_VIEW))
{
Log.debug("Unauthorized access by user \"" +
rundata.getUser().getUserName() + "\"");
// Clear any portlets that exist in this set
- if(this.portlets != null)
+ if (this.portlets != null)
{
this.portlets.clear();
}
@@ -352,18 +363,18 @@
Log.debug("User \"" + rundata.getUser().getUserName() + "\" is
authorized to portlet set " + getID());
}
- if ( controller == null )
+ if (controller == null)
{
Portlet p = getPortletAt(0);
- if (p!=null)
+ if (p != null)
{
- content = p.getContent( rundata );
+ content = p.getContent(rundata);
}
}
else
{
- content = controller.getContent( rundata );
+ content = controller.getContent(rundata);
}
if (content == null)
@@ -378,14 +389,17 @@
*/
public String getName()
{
- if (name==null) return this.getClass().getName();
+ if (name == null)
+ {
+ return this.getClass().getName();
+ }
return name;
}
/**
*/
- public void setName( String name )
+ public void setName(String name)
{
this.name = name;
}
@@ -399,7 +413,7 @@
/**
*/
- public void setPortletConfig( PortletConfig pc )
+ public void setPortletConfig(PortletConfig pc)
{
this.pc = pc;
}
@@ -408,9 +422,9 @@
*/
public String getDescription()
{
- if (getPortletConfig()!=null)
+ if (getPortletConfig() != null)
{
- if (getPortletConfig().getMetainfo()!=null)
+ if (getPortletConfig().getMetainfo() != null)
{
return getPortletConfig().getMetainfo().getDescription();
}
@@ -426,23 +440,25 @@
public String getDescription(String instanceDescription)
{
if (instanceDescription != null)
+ {
return instanceDescription;
+ }
return getDescription();
}
/**
*/
- public void setDescription( String description )
+ public void setDescription(String description)
{
PortletConfig pc = getPortletConfig();
- if (pc==null)
+ if (pc == null)
{
pc = new BasePortletConfig();
setPortletConfig(pc);
}
MetaData meta = pc.getMetainfo();
- if (meta==null)
+ if (meta == null)
{
meta = new MetaData();
pc.setMetainfo(meta);
@@ -462,9 +478,9 @@
*/
public String getImage()
{
- if (getPortletConfig()!=null)
+ if (getPortletConfig() != null)
{
- if (getPortletConfig().getMetainfo()!=null)
+ if (getPortletConfig().getMetainfo() != null)
{
return getPortletConfig().getMetainfo().getImage();
}
@@ -480,7 +496,9 @@
public String getImage(String instanceImage)
{
if (instanceImage != null)
+ {
return instanceImage;
+ }
return getImage();
}
@@ -488,9 +506,9 @@
*/
public String getTitle()
{
- if (getPortletConfig()!=null)
+ if (getPortletConfig() != null)
{
- if (getPortletConfig().getMetainfo()!=null)
+ if (getPortletConfig().getMetainfo() != null)
{
return getPortletConfig().getMetainfo().getTitle();
}
@@ -514,24 +532,26 @@
public String getTitle(String instanceTitle)
{
if (instanceTitle != null)
+ {
return instanceTitle;
+ }
return getTitle();
}
/**
*/
- public void setTitle( String title )
+ public void setTitle(String title)
{
PortletConfig pc = getPortletConfig();
- if (pc==null)
+ if (pc == null)
{
pc = new BasePortletConfig();
setPortletConfig(pc);
}
MetaData meta = pc.getMetainfo();
- if (meta==null)
+ if (meta == null)
{
meta = new MetaData();
pc.setMetainfo(meta);
@@ -542,14 +562,14 @@
/**
*/
- public boolean getAllowEdit( RunData rundata )
+ public boolean getAllowEdit(RunData rundata)
{
return true;
}
/**
*/
- public boolean getAllowMaximize( RunData rundata )
+ public boolean getAllowMaximize(RunData rundata)
{
return false;
}
@@ -559,21 +579,24 @@
/**
* Sort the portlets according to Layout position
*/
- final public void sortPortletSet()
+ public final void sortPortletSet()
{
- if (!this.dirty) return;
+ if (!this.dirty)
+ {
+ return;
+ }
- synchronized(portlets)
+ synchronized (portlets)
{
- for (int i=0; i < portlets.size(); i++)
+ for (int i = 0; i < portlets.size(); i++)
{
- Portlet p = (Portlet)portlets.elementAt(i);
+ Portlet p = (Portlet) portlets.elementAt(i);
int pos = p.getPortletConfig().getPosition();
- if ( (pos>=0) && (pos!=i) )
+ if ((pos >= 0) && (pos != i))
{
portlets.removeElementAt(i);
- portlets.insertElementAt(p,pos);
+ portlets.insertElementAt(p, pos);
}
}
@@ -592,7 +615,7 @@
/**
@see Portlet#setCreationTime
*/
- public void setCreationTime( long creationTime )
+ public void setCreationTime(long creationTime)
{
this.creationTime = creationTime;
}
@@ -601,13 +624,13 @@
Method retruns true if at least one of the portlets of the portletset
fits the requested MimeTyp. Otherwise it retruns false.
*/
- public boolean supportsType( MimeType mimeType )
+ public boolean supportsType(MimeType mimeType)
{
Enumeration portlets = this.getPortlets();
while (portlets.hasMoreElements())
{
Portlet p = (Portlet) portlets.nextElement();
- if (p.supportsType( mimeType ))
+ if (p.supportsType(mimeType))
{
return true;
}
@@ -624,7 +647,7 @@
*
* @param rundata the RunData object for the current request
*/
- public boolean allowClose( RunData rundata )
+ public boolean allowClose(RunData rundata)
{
return false;
}
@@ -654,7 +677,7 @@
*
* @param rundata the RunData object for the current request
*/
- public boolean allowInfo( RunData rundata )
+ public boolean allowInfo(RunData rundata)
{
return false;
}
@@ -665,9 +688,9 @@
*
* @param rundata the RunData object for the current request
*/
- public boolean allowCustomize( RunData rundata )
+ public boolean allowCustomize(RunData rundata)
{
- return (JetspeedSecurity.checkPermission((JetspeedUser)rundata.getUser(),
+ return (JetspeedSecurity.checkPermission((JetspeedUser) rundata.getUser(),
this,
JetspeedSecurity.PERMISSION_CUSTOMIZE));
}
@@ -678,7 +701,7 @@
*
* @param rundata the RunData object for the current request
*/
- public boolean allowMaximize( RunData rundata )
+ public boolean allowMaximize(RunData rundata)
{
return false;
}
@@ -689,7 +712,7 @@
*
* @param rundata the RunData object for the current request
*/
- public boolean allowMinimize( RunData rundata )
+ public boolean allowMinimize(RunData rundata)
{
return false;
}
@@ -708,7 +731,7 @@
@param minimize True if the portlet change to minimized
@param rundata A RunData object
*/
- public void setMinimized( boolean minimize, RunData rundata )
+ public void setMinimized(boolean minimize, RunData rundata)
{
// empty
}
@@ -723,7 +746,7 @@
* @param rundata The RunData object for the current request
* @return The attribute value
*/
- public String getAttribute( String attrName, String attrDefValue, RunData
rundata )
+ public String getAttribute(String attrName, String attrDefValue, RunData
rundata)
{
// return attrDefValue;
@@ -743,7 +766,7 @@
* @paarm attrValue The value to store
* @param rundata The RunData object for the current request
*/
- public void setAttribute( String attrName, String attrValue, RunData rundata )
+ public void setAttribute(String attrName, String attrValue, RunData rundata)
{
try
{
@@ -753,7 +776,7 @@
}
catch (PortalPersistenceException e)
{
- Log.error("Exception while setting attribute "+attrName+" for portlet
"+getName(),e);
+ Log.error("Exception while setting attribute " + attrName + " for
portlet " + getName(), e);
}
}
@@ -781,7 +804,10 @@
/**
* @return true if the portlet does its own customization
*/
- public boolean providesCustomization() { return false; }
+ public boolean providesCustomization()
+ {
+ return false;
+ }
/** Returns TRUE if the title bar in should be displayed. The title bar includes
* the portlet title and action buttons. This
@@ -792,6 +818,4 @@
{
return true;
}
-
-
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>