raphael 01/05/28 08:09:39
Modified: src/java/org/apache/jetspeed/portal/factory
PortletSetFactory.java
Log:
Enhance PortletSetFactory to allow searching for entries within a PSML
resource
Revision Changes Path
1.22 +88 -1
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/factory/PortletSetFactory.java
Index: PortletSetFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/factory/PortletSetFactory.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- PortletSetFactory.java 2001/05/07 20:49:11 1.21
+++ PortletSetFactory.java 2001/05/28 15:09:38 1.22
@@ -87,7 +87,7 @@
@author <a href="mailto:[EMAIL PROTECTED]">Kevin A. Burton</a>
@author <a href="mailto:[EMAIL PROTECTED]">Rapha�l Luta</a>
-@version $Id: PortletSetFactory.java,v 1.21 2001/05/07 20:49:11 raphael Exp $
+@version $Id: PortletSetFactory.java,v 1.22 2001/05/28 15:09:38 raphael Exp $
*/
public class PortletSetFactory extends BasePortletFactory {
@@ -398,6 +398,93 @@
// Or return the set
return set;
+ }
+
+ /** Returns the first entry in the current PSML resource corresponding
+ * to the given portlet name
+ *
+ * @param name the portlet name to seek
+ * @return the found entry description or null
+ */
+ public Entry getEntry(String name)
+ {
+ Log.note("Searching for "+name+" :");
+ return getEntry(this.portlets, name);
+ }
+
+ /** Returns the first entry in the specified PSML resource corresponding
+ * to the given portlet name
+ *
+ * @param portlets the PSML description to look into
+ * @param name the portlet name to seek
+ * @return the found entry description or null
+ */
+ public Entry getEntry(Portlets portlets, String name)
+ {
+ Entry entry = null;
+
+ for (Enumeration e1 = portlets.enumerateEntry (); e1.hasMoreElements (); )
+ {
+ entry = (Entry) e1.nextElement ();
+ Log.note("Looking entry "+entry.getParent()+"...");
+ if (entry.getParent().equals (name))
+ return (entry);
+ }
+
+ entry = null;
+
+ for (Enumeration e2 = portlets.enumeratePortlets (); e2.hasMoreElements ();
)
+ {
+ Portlets p = (Portlets) e2.nextElement ();
+
+ entry = getEntry(p, name);
+
+ if (entry != null)
+ break;
+ }
+
+ return (entry);
+ }
+
+ /** Returns the first portlets element in the current PSML resource
corresponding
+ * to the given name
+ *
+ * @param name the portlets name to seek
+ * @return the found portlets description or null
+ */
+ public Portlets getPortlets(String name)
+ {
+ return getPortlets(this.portlets, name);
+ }
+
+ /** Returns the first portlets element in the specified PSML resource
corresponding
+ * to the given name
+ *
+ * @param portlets the PSML description to look into
+ * @param name the portlets name to seek
+ * @return the found portlets description or null
+ */
+ public Portlets getPortlets(Portlets portlets, String name)
+ {
+ Portlets entry = portlets;
+
+ if (entry.getName().equals(name))
+ {
+ return entry;
+ }
+
+ entry = null;
+
+ for (Enumeration e2 = portlets.enumeratePortlets (); e2.hasMoreElements ();
)
+ {
+ Portlets p = (Portlets) e2.nextElement ();
+
+ entry = getPortlets(p, name);
+
+ if (entry != null) break;
+ }
+
+ return (entry);
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]