portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r750252 - in /portals/jetspeed-2/portal/trunk: components/jetspeed-registry/src/main/java/JETSPEED-INF/ojb/ components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/ components/jetspeed-registry/src/test/java/org/apach...
Date Thu, 05 Mar 2009 00:21:26 GMT
Author: taylor
Date: Thu Mar  5 00:21:25 2009
New Revision: 750252

URL: http://svn.apache.org/viewvc?rev=750252&view=rev
Log:
https://issues.apache.org/jira/browse/JS2-927
Portlet 2.0 object model persistence for OJB. Modified to be more inline with JPA persistence
This commit completes 2.0 model persistence with filters, filter mappings, and listeners

Added:
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilterLifecycleImpl.java
  (with props)
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilteredPortletImpl.java
  (with props)
    portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/FilterLifecycle.java
  (with props)
    portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/FilteredPortlet.java
  (with props)
Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/JETSPEED-INF/ojb/registry_repository.xml
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilterImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilterMappingImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/TestPortletRegistryDAO.java
    portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/ddl-schema/registry-schema.xml

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/JETSPEED-INF/ojb/registry_repository.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/JETSPEED-INF/ojb/registry_repository.xml?rev=750252&r1=750251&r2=750252&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/JETSPEED-INF/ojb/registry_repository.xml
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/JETSPEED-INF/ojb/registry_repository.xml
Thu Mar  5 00:21:25 2009
@@ -309,6 +309,36 @@
       >
          <inverse-foreignkey field-ref="ownerId"/>
       </collection-descriptor>
+
+   <collection-descriptor
+         name="filters"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.FilterImpl"
+          auto-delete="true"
+          auto-update = "true"
+          auto-retrieve = "true"
+      >
+         <inverse-foreignkey field-ref="applicationId"/>
+      </collection-descriptor>
+
+   <collection-descriptor
+         name="filterMappings"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.FilterMappingImpl"
+          auto-delete="true"
+          auto-update = "true"
+          auto-retrieve = "true"
+      >
+         <inverse-foreignkey field-ref="applicationId"/>
+      </collection-descriptor>
+
+   <collection-descriptor
+         name="listeners"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.ListenerImpl"
+          auto-delete="true"
+          auto-update = "true"
+          auto-retrieve = "true"
+      >
+         <inverse-foreignkey field-ref="applicationId"/>
+      </collection-descriptor>
       
    </class-descriptor>
 
@@ -1766,5 +1796,276 @@
       </collection-descriptor>
    
 	</class-descriptor>
+
+
+  <!--
+   - F I L T E R
+  -->
+     <class-descriptor
+      class="org.apache.jetspeed.om.portlet.impl.FilterImpl"
+      table="PORTLET_FILTER"
+   >
+
+        <field-descriptor
+         name="id"
+         column="ID"
+         jdbc-type="BIGINT"
+         primarykey="true"
+         autoincrement="true"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="applicationId"
+         column="APPLICATION_ID"
+         jdbc-type="BIGINT"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="filterName"
+         column="FILTER_NAME"
+         jdbc-type="VARCHAR"
+      />
+
+      <field-descriptor
+         name="filterClass"
+         column="FILTER_CLASS"
+         jdbc-type="VARCHAR"
+      />
+
+      <collection-descriptor
+         name="descriptions"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.DescriptionImpl"
+          auto-delete="true"
+          auto-update = "true"
+          auto-retrieve = "true"
+      >
+         <inverse-foreignkey field-ref="ownerId"/>
+         <query-customizer class="org.apache.jetspeed.util.ojb.CollectionOwnerClassDiscriminatorQueryCustomizer">
+            <attribute
+              attribute-name="discriminatorField"
+              attribute-value="owner"
+            />
+         </query-customizer>
+      </collection-descriptor>
+
+      <collection-descriptor
+         name="displayNames"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.DisplayNameImpl"
+          auto-delete="true"
+          auto-update = "true"
+          auto-retrieve = "true"
+      >
+         <inverse-foreignkey field-ref="ownerId"/>
+         <query-customizer class="org.apache.jetspeed.util.ojb.CollectionOwnerClassDiscriminatorQueryCustomizer">
+            <attribute
+              attribute-name="discriminatorField"
+              attribute-value="owner"
+            />
+         </query-customizer>
+      </collection-descriptor>
+
+        <collection-descriptor
+         name="initParams"
+         proxy="false"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.InitParamImpl"
+         auto-delete="true"
+         auto-update = "true"
+         auto-retrieve = "true"         
+      >
+
+         <inverse-foreignkey field-ref="ownerId"/>
+         <query-customizer class="org.apache.jetspeed.util.ojb.CollectionOwnerClassDiscriminatorQueryCustomizer">
+            <attribute
+              attribute-name="discriminatorField"
+              attribute-value="owner"
+            />
+         </query-customizer>
+      </collection-descriptor>
+
+     <collection-descriptor
+         name="lifecycles"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.FilterLifecycleImpl"
+         auto-delete="true"
+         auto-update = "true"
+         auto-retrieve = "true"
+
+      >
+         <inverse-foreignkey field-ref="ownerId"/>
+      </collection-descriptor>
+
+   </class-descriptor>
+
+<!--
+   - P O R T L E T  F I L T E R  L I F E C Y C L E
+ -->
+   <class-descriptor
+      class="org.apache.jetspeed.om.portlet.impl.FilterLifecycleImpl"
+      table="FILTER_LIFECYCLE"
+   >
+
+      <field-descriptor
+         name="id"
+         column="ID"
+         jdbc-type="BIGINT"
+         primarykey="true"
+         autoincrement="true"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="ownerId"
+         column="OWNER_ID"
+         jdbc-type="BIGINT"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="name"
+         column="NAME"
+         jdbc-type="VARCHAR"
+      />
+
+    </class-descriptor>
+
+<!--
+   - P O R T L E T  F I L T E R  M A P P I N G
+ -->
+   <class-descriptor
+      class="org.apache.jetspeed.om.portlet.impl.FilterMappingImpl"
+      table="FILTER_MAPPING"
+   >
+
+      <field-descriptor
+         name="id"
+         column="ID"
+         jdbc-type="BIGINT"
+         primarykey="true"
+         autoincrement="true"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="applicationId"
+         column="APPLICATION_ID"
+         jdbc-type="BIGINT"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="filterName"
+         column="FILTER_NAME"
+         jdbc-type="VARCHAR"
+      />
+
+	 <collection-descriptor
+         name="portletNames"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.FilteredPortletImpl"
+         auto-delete="true"
+         auto-update = "true"
+         auto-retrieve = "true"
+
+      >
+         <inverse-foreignkey field-ref="ownerId"/>
+      </collection-descriptor>
+
+    </class-descriptor>
+
+<!--
+   - F I L T E R E D  P O R T L E T
+ -->
+   <class-descriptor
+      class="org.apache.jetspeed.om.portlet.impl.FilteredPortletImpl"
+      table="FILTERED_PORTLET"
+   >
+
+      <field-descriptor
+         name="id"
+         column="ID"
+         jdbc-type="BIGINT"
+         primarykey="true"
+         autoincrement="true"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="ownerId"
+         column="OWNER_ID"
+         jdbc-type="BIGINT"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="name"
+         column="NAME"
+         jdbc-type="VARCHAR"
+      />
+
+    </class-descriptor>
+
+  <!--
+   - L I S T E N E R
+  -->
+     <class-descriptor
+      class="org.apache.jetspeed.om.portlet.impl.ListenerImpl"
+      table="PORTLET_LISTENER"
+   >
+
+        <field-descriptor
+         name="id"
+         column="ID"
+         jdbc-type="BIGINT"
+         primarykey="true"
+         autoincrement="true"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="applicationId"
+         column="APPLICATION_ID"
+         jdbc-type="BIGINT"
+         access="anonymous"
+      />
+
+      <field-descriptor
+         name="listenerClass"
+         column="LISTENER_CLASS"
+         jdbc-type="VARCHAR"
+      />
+
+      <collection-descriptor
+         name="descriptions"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.DescriptionImpl"
+          auto-delete="true"
+          auto-update = "true"
+          auto-retrieve = "true"
+      >
+         <inverse-foreignkey field-ref="ownerId"/>
+         <query-customizer class="org.apache.jetspeed.util.ojb.CollectionOwnerClassDiscriminatorQueryCustomizer">
+            <attribute
+              attribute-name="discriminatorField"
+              attribute-value="owner"
+            />
+         </query-customizer>
+      </collection-descriptor>
+
+      <collection-descriptor
+         name="displayNames"
+         element-class-ref="org.apache.jetspeed.om.portlet.impl.DisplayNameImpl"
+          auto-delete="true"
+          auto-update = "true"
+          auto-retrieve = "true"
+      >
+         <inverse-foreignkey field-ref="ownerId"/>
+         <query-customizer class="org.apache.jetspeed.util.ojb.CollectionOwnerClassDiscriminatorQueryCustomizer">
+            <attribute
+              attribute-name="discriminatorField"
+              attribute-value="owner"
+            />
+         </query-customizer>
+      </collection-descriptor>
+
+   </class-descriptor>
 	
 </descriptor-repository>

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilterImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilterImpl.java?rev=750252&r1=750251&r2=750252&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilterImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilterImpl.java
Thu Mar  5 00:21:25 2009
@@ -25,7 +25,9 @@
 import org.apache.jetspeed.om.portlet.Description;
 import org.apache.jetspeed.om.portlet.DisplayName;
 import org.apache.jetspeed.om.portlet.Filter;
+import org.apache.jetspeed.om.portlet.FilterLifecycle;
 import org.apache.jetspeed.om.portlet.InitParam;
+import org.apache.jetspeed.om.portlet.SupportedPublicRenderParameter;
 import org.apache.jetspeed.util.JetspeedLocale;
 
 /**
@@ -36,7 +38,7 @@
 {
     protected String filterName;
     protected String filterClass;
-    protected List<String> lifecycle;
+    protected List<FilterLifecycle> lifecycles;
     protected List<InitParam> initParams;
     protected List<Description> descriptions;
     protected List<DisplayName> displayNames;
@@ -119,17 +121,32 @@
 
     public List<String> getLifecycles()
     {
-        if (lifecycle == null)
+        if (lifecycles == null)
         {
-            lifecycle = new ArrayList<String>();
+            lifecycles = new ArrayList<FilterLifecycle>();
         }
-        return lifecycle;
+        List<String> result = new ArrayList<String>();
+        for (FilterLifecycle flc : lifecycles)
+        {
+            result.add(flc.toString());
+        }
+        return result;
     }
     
     public void addLifecycle(String name)
     {
-        // TODO: check valid name and duplicates
-        getLifecycles().add(name);
+        if (lifecycles == null)
+        {
+            lifecycles = new ArrayList<FilterLifecycle>();
+        }
+        for (FilterLifecycle flc : this.lifecycles)
+        {
+            if (flc.equals(name))
+            {
+                throw new IllegalArgumentException("Support for filter lifecycle parameter
with identifier: "+name+" already defined");
+            }
+        }
+        lifecycles.add(new FilterLifecycleImpl(name));        
     }
     
     public InitParam getInitParam(String name)

Added: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilterLifecycleImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilterLifecycleImpl.java?rev=750252&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilterLifecycleImpl.java
(added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilterLifecycleImpl.java
Thu Mar  5 00:21:25 2009
@@ -0,0 +1,34 @@
+package org.apache.jetspeed.om.portlet.impl;
+
+import org.apache.jetspeed.om.portlet.FilterLifecycle;
+
+
+
+public class FilterLifecycleImpl implements FilterLifecycle
+{
+    private String name;
+
+    public FilterLifecycleImpl()
+    {}
+    
+    public FilterLifecycleImpl(String name)
+    {
+        this.name = name;
+    }
+    
+    public String getName()
+    {
+        return name;
+    }
+
+    public boolean equals(Object qname)
+    {
+        return (this.toString().equals(qname.toString()));
+    }
+    
+    public String toString()
+    {
+        return name;
+    }
+    
+}

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilterLifecycleImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilterLifecycleImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilterMappingImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilterMappingImpl.java?rev=750252&r1=750251&r2=750252&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilterMappingImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilterMappingImpl.java
Thu Mar  5 00:21:25 2009
@@ -22,6 +22,7 @@
 import java.util.List;
 
 import org.apache.jetspeed.om.portlet.FilterMapping;
+import org.apache.jetspeed.om.portlet.FilteredPortlet;
 
 /**
  * @version $Id$
@@ -30,7 +31,7 @@
 public class FilterMappingImpl implements FilterMapping, Serializable
 {
     protected String filterName;
-    protected List<String> portletName;
+    protected List<FilteredPortlet> portletNames;
     
     public String getFilterName()
     {
@@ -44,16 +45,31 @@
 
     public List<String> getPortletNames()
     {
-        if (portletName == null)
+        if (portletNames == null)
         {
-            portletName = new ArrayList<String>();
+            portletNames = new ArrayList<FilteredPortlet>();
         }
-        return portletName;
+        List<String> result = new ArrayList<String>();
+        for (FilteredPortlet fp : portletNames)
+        {
+            result.add(fp.toString());
+        }
+        return result;        
     }
     
     public void addPortletName(String name)
     {
-        // TODO: check for duplicates
-        getPortletNames().add(name);
+        if (portletNames == null)
+        {
+            portletNames = new ArrayList<FilteredPortlet>();
+        }
+        for (FilteredPortlet fp : this.portletNames)
+        {
+            if (fp.equals(name))
+            {
+                throw new IllegalArgumentException("Support for filter-mapping portlet name
parameter with identifier: "+name+" already defined");
+            }
+        }
+        portletNames.add(new FilteredPortletImpl(name));        
     }
 }

Added: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilteredPortletImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilteredPortletImpl.java?rev=750252&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilteredPortletImpl.java
(added)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilteredPortletImpl.java
Thu Mar  5 00:21:25 2009
@@ -0,0 +1,34 @@
+package org.apache.jetspeed.om.portlet.impl;
+
+import org.apache.jetspeed.om.portlet.FilteredPortlet;
+
+
+
+public class FilteredPortletImpl implements FilteredPortlet
+{
+    private String name;
+
+    public FilteredPortletImpl()
+    {}
+    
+    public FilteredPortletImpl(String name)
+    {
+        this.name = name;
+    }
+    
+    public String getName()
+    {
+        return name;
+    }
+
+    public boolean equals(Object qname)
+    {
+        return (this.toString().equals(qname.toString()));
+    }
+    
+    public String toString()
+    {
+        return name;
+    }
+    
+}

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilteredPortletImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/FilteredPortletImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java?rev=750252&r1=750251&r2=750252&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java
Thu Mar  5 00:21:25 2009
@@ -38,7 +38,6 @@
 import org.apache.jetspeed.om.portlet.Description;
 import org.apache.jetspeed.om.portlet.DisplayName;
 import org.apache.jetspeed.om.portlet.EventDefinition;
-import org.apache.jetspeed.om.portlet.EventDefinitionReference;
 import org.apache.jetspeed.om.portlet.Filter;
 import org.apache.jetspeed.om.portlet.FilterMapping;
 import org.apache.jetspeed.om.portlet.GenericMetadata;
@@ -719,7 +718,7 @@
     {
         for (Filter f : getFilters())
         {
-            if (f.getFilterName().equals(name))
+            if (f.getFilterName().equals(filterName))
             {
                 return f;
             }
@@ -738,12 +737,12 @@
 
     public Filter addFilter(String filterName)
     {
-        if (getFilter(name) != null)
+        if (getFilter(filterName) != null)
         {
             throw new IllegalArgumentException("Filter with name: "+name+" already defined");
         }
         FilterImpl f = new FilterImpl();
-        f.setFilterName(name);
+        f.setFilterName(filterName);
         getFilters().add(f);
         return f;        
     }
@@ -752,7 +751,7 @@
     {
         for (FilterMapping f : getFilterMappings())
         {
-            if (f.getFilterName().equals(name))
+            if (f.getFilterName().equals(filterName))
             {
                 return f;
             }
@@ -771,12 +770,12 @@
 
     public FilterMapping addFilterMapping(String filterName)
     {
-        if (getFilterMapping(name) != null)
+        if (getFilterMapping(filterName) != null)
         {
             throw new IllegalArgumentException("Filtermapping for filter: "+name+" already
defined");
         }
         FilterMappingImpl fm = new FilterMappingImpl();
-        fm.setFilterName(name);
+        fm.setFilterName(filterName);
         getFilterMappings().add(fm);
         return fm;        
     }

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/TestPortletRegistryDAO.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/TestPortletRegistryDAO.java?rev=750252&r1=750251&r2=750252&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/TestPortletRegistryDAO.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/test/java/org/apache/jetspeed/components/portletregistry/TestPortletRegistryDAO.java
Thu Mar  5 00:21:25 2009
@@ -29,12 +29,16 @@
 import org.apache.jetspeed.engine.MockJetspeedEngine;
 import org.apache.jetspeed.om.portlet.ContainerRuntimeOption;
 import org.apache.jetspeed.om.portlet.Description;
+import org.apache.jetspeed.om.portlet.DisplayName;
 import org.apache.jetspeed.om.portlet.DublinCore;
 import org.apache.jetspeed.om.portlet.EventDefinition;
 import org.apache.jetspeed.om.portlet.EventDefinitionReference;
+import org.apache.jetspeed.om.portlet.Filter;
+import org.apache.jetspeed.om.portlet.FilterMapping;
 import org.apache.jetspeed.om.portlet.GenericMetadata;
 import org.apache.jetspeed.om.portlet.InitParam;
 import org.apache.jetspeed.om.portlet.Language;
+import org.apache.jetspeed.om.portlet.Listener;
 import org.apache.jetspeed.om.portlet.PortletApplication;
 import org.apache.jetspeed.om.portlet.PortletDefinition;
 import org.apache.jetspeed.om.portlet.Preference;
@@ -380,7 +384,53 @@
         d1.setDescription("dog");
         Description d2 = prp1.addDescription("fr");
         d2.setDescription("chien");
-        prp1.addAlias(new QName("alias-1"));        
+        prp1.addAlias(new QName("alias-1"));
+        
+        Filter filter = app.addFilter("filter-1");
+        filter.setFilterClass("org.apache.filter.FilterOne");
+        Description d3 = filter.addDescription("en");
+        d3.setDescription("My Filter 1");
+        Description d4 = filter.addDescription("fr");
+        d4.setDescription("Mon Filtre 1");
+        DisplayName dn3 = filter.addDisplayName("en");
+        dn3.setDisplayName("This is my filter 1");
+        DisplayName dn4 = filter.addDisplayName("fr");
+        dn4.setDisplayName("Ceci est mon filtre 1");
+        InitParam ip3 = filter.addInitParam("filter init param 1");
+        ip3.setParamValue("value for filter init param 1");
+        InitParam ip4 = filter.addInitParam("filter init param 2");
+        ip4.setParamValue("value for filter init param 2");
+        filter.addLifecycle("lifecycle-1");
+        filter.addLifecycle("lifecycle-2");
+        filter.addLifecycle("lifecycle-3");
+        
+        FilterMapping mapping1 = app.addFilterMapping("filter-1");
+        mapping1.addPortletName("Portlet 1");
+        mapping1.addPortletName("Portlet 2");
+        mapping1.addPortletName("Portlet 3");
+        FilterMapping mapping2 = app.addFilterMapping("filter-2");
+        mapping2.addPortletName("Portlet 1");
+        mapping2.addPortletName("Portlet 2");
+        mapping2.addPortletName("Portlet 3");
+        
+        Listener listener1 = app.addListener("org.apache.listener.ListenerOne");
+        Description d5 = listener1.addDescription("en");
+        d5.setDescription("Listen to me once");
+        Description d6 = listener1.addDescription("fr");
+        d6.setDescription("ƒcoutez moi une fois");
+        DisplayName dn5 = listener1.addDisplayName("en");
+        dn5.setDisplayName("Listen to me twice");
+        DisplayName dn6 = listener1.addDisplayName("fr");
+        dn6.setDisplayName("ƒcoutez moi deux fois");
+        Listener listener2 = app.addListener("org.apache.listener.ListenerTwo");
+        Description d7 = listener2.addDescription("en");
+        d7.setDescription("Don't listen to me");
+        Description d8 = listener2.addDescription("fr");
+        d8.setDescription("N'Žcoutez pas moi");
+        DisplayName dn7 = listener2.addDisplayName("en");
+        dn7.setDisplayName("Listen!");
+        DisplayName dn8 = listener2.addDisplayName("fr");
+        dn8.setDisplayName("ƒcoutez!");
     }
 
     public static void verifyPortlet20Data(PortletApplication app, PortletDefinition portlet)
@@ -494,6 +544,81 @@
         List<QName> aliases = x.getAliases();
         assertEquals(aliases.size(), 1);
         assertEquals(aliases.get(0).getLocalPart(), "alias-1");
+
+        List<Filter> filters = app.getFilters();
+        assertEquals(filters.size(), 1);        
+        Filter filter = filters.get(0);
+        assertEquals(filter.getFilterName(), "filter-1");
+        assertEquals(filter.getFilterClass(), "org.apache.filter.FilterOne");
+        List<Description> descs = filter.getDescriptions();
+        assertEquals(descs.size(), 2);        
+        Description d3 = descs.get(0);
+        assertEquals(d3.getLang(), "en");
+        assertEquals(d3.getDescription(), "My Filter 1");
+        Description d4 = descs.get(1);
+        assertEquals(d4.getLang(), "fr");
+        assertEquals(d4.getDescription(), "Mon Filtre 1");
+        List<DisplayName> dnames = filter.getDisplayNames();        
+        assertEquals(dnames.size(), 2);        
+        DisplayName dn3 = dnames.get(0);
+        assertEquals(dn3.getLang(), "en");
+        assertEquals(dn3.getDisplayName(), "This is my filter 1");
+        DisplayName dn4 = dnames.get(1);        
+        assertEquals(dn4.getLang(), "fr");
+        assertEquals(dn4.getDisplayName(), "Ceci est mon filtre 1");
+        List<InitParam> iparams = filter.getInitParams();        
+        assertEquals(iparams.size(), 2);        
+        InitParam ip3 = iparams.get(0);
+        assertEquals(ip3.getParamName(),"filter init param 1");
+        assertEquals(ip3.getParamValue(), "value for filter init param 1");
+        InitParam ip4 = iparams.get(1);
+        assertEquals(ip4.getParamName(), "filter init param 2");
+        assertEquals(ip4.getParamValue(), "value for filter init param 2");
+        List<String> lcycles = filter.getLifecycles();        
+        assertEquals(lcycles.size(), 3);        
+        assertEquals(lcycles.get(0), "lifecycle-1");
+        assertEquals(lcycles.get(1), "lifecycle-2");
+        assertEquals(lcycles.get(2), "lifecycle-3");        
+        
+        List<Listener> listeners = app.getListeners();
+        assertEquals(listeners.size(), 2);
+        Listener listener1 = listeners.get(0);
+        assertEquals(listener1.getListenerClass(), "org.apache.listener.ListenerOne");
+        descs = listener1.getDescriptions();
+        assertEquals(descs.size(), 2);
+        Description d5 = descs.get(0);
+        assertEquals(d5.getLang(), "en");
+        assertEquals(d5.getDescription(), "Listen to me once");
+        Description d6 = descs.get(1);
+        assertEquals(d6.getLang(), "fr");
+        assertEquals(d6.getDescription(), "ƒcoutez moi une fois");
+        dnames = listener1.getDisplayNames();
+        assertEquals(dnames.size(), 2);
+        DisplayName dn5 = dnames.get(0);
+        assertEquals(dn5.getLang(), "en");
+        assertEquals(dn5.getDisplayName(), "Listen to me twice");
+        DisplayName dn6 = dnames.get(1);
+        assertEquals(dn6.getLang(), "fr");
+        assertEquals(dn6.getDisplayName(), "ƒcoutez moi deux fois");
+
+        Listener listener2 = listeners.get(1);
+        assertEquals(listener2.getListenerClass(), "org.apache.listener.ListenerTwo");
+        descs = listener2.getDescriptions();
+        assertEquals(descs.size(), 2);
+        d5 = descs.get(0);
+        assertEquals(d5.getLang(), "en");
+        assertEquals(d5.getDescription(), "Don't listen to me");
+        d6 = descs.get(1);
+        assertEquals(d6.getLang(), "fr");
+        assertEquals(d6.getDescription(), "N'Žcoutez pas moi");
+        dnames = listener2.getDisplayNames();
+        assertEquals(dnames.size(), 2);
+        dn5 = dnames.get(0);
+        assertEquals(dn5.getLang(), "en");
+        assertEquals(dn5.getDisplayName(), "Listen!");
+        dn6 = dnames.get(1);
+        assertEquals(dn6.getLang(), "fr");
+        assertEquals(dn6.getDisplayName(), "ƒcoutez!");
     }
 
 }

Added: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/FilterLifecycle.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/FilterLifecycle.java?rev=750252&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/FilterLifecycle.java
(added)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/FilterLifecycle.java
Thu Mar  5 00:21:25 2009
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2008 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.om.portlet;
+
+
+public interface FilterLifecycle
+{
+    String getName();
+}
\ No newline at end of file

Propchange: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/FilterLifecycle.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/FilterLifecycle.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/FilteredPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/FilteredPortlet.java?rev=750252&view=auto
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/FilteredPortlet.java
(added)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/FilteredPortlet.java
Thu Mar  5 00:21:25 2009
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2008 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.om.portlet;
+
+
+public interface FilteredPortlet
+{
+    String getName();
+}
\ No newline at end of file

Propchange: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/FilteredPortlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/om/portlet/FilteredPortlet.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/ddl-schema/registry-schema.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/ddl-schema/registry-schema.xml?rev=750252&r1=750251&r2=750252&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/ddl-schema/registry-schema.xml
(original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-portal-resources/src/main/ddl-schema/registry-schema.xml
Thu Mar  5 00:21:25 2009
@@ -370,5 +370,51 @@
         <column name="PREFIX" required="false" size="20" type="VARCHAR"/>        
         <column name="IDENTIFIER" required="true" size="150" type="VARCHAR"/>
     </table> 
-                   
+
+	<!--
+		PORTLET FILTER 
+	 -->      
+    <table name="PORTLET_FILTER">                                            
+        <column name="ID" primaryKey="true" required="true" type="INTEGER"/>
+        <column name="APPLICATION_ID" required="true" type="INTEGER"/>  
+        <column name="FILTER_NAME" required="true" size="80" type="VARCHAR"/>
+        <column name="FILTER_CLASS" required="false" size="255" type="VARCHAR"/>
+    </table> 
+
+   <!--                                                                   
+	   FILTER LIFECYCLE                                                        
+    -->                                                                     
+    <table name="FILTER_LIFECYCLE">                                            
+        <column name="ID" primaryKey="true" required="true" type="INTEGER"/>
+        <column name="OWNER_ID" required="true" type="INTEGER"/>
+        <column name="NAME" required="true" size="150" type="VARCHAR"/>
+    </table> 
+
+   <!--                                                                   
+	   FILTER MAPPING
+    -->                                                                     
+    <table name="FILTER_MAPPING">                                            
+        <column name="ID" primaryKey="true" required="true" type="INTEGER"/>
+        <column name="APPLICATION_ID" required="true" type="INTEGER"/>  
+        <column name="FILTER_NAME" required="true" size="150" type="VARCHAR"/>
+    </table> 
+
+   <!--                                                                   
+	   FILTERED PORTLET                                                        
+    -->                                                                     
+    <table name="FILTERED_PORTLET">                                            
+        <column name="ID" primaryKey="true" required="true" type="INTEGER"/>
+        <column name="OWNER_ID" required="true" type="INTEGER"/>
+        <column name="NAME" required="true" size="150" type="VARCHAR"/>
+    </table> 
+
+   <!--                                                                   
+	   PORTLET LISTENER
+    -->                                                                     
+    <table name="PORTLET_LISTENER">                                            
+        <column name="ID" primaryKey="true" required="true" type="INTEGER"/>
+        <column name="APPLICATION_ID" required="true" type="INTEGER"/>  
+        <column name="LISTENER_CLASS" required="false" size="255" type="VARCHAR"/>
+    </table> 
+	              
 </database>



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message