portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r353944 - in /portals/jetspeed-2/trunk/components/page-manager/src/java: JETSPEED-INF/ojb/ org/apache/jetspeed/page/ org/apache/jetspeed/page/impl/ org/apache/jetspeed/util/ org/apache/jetspeed/util/ojb/
Date Mon, 05 Dec 2005 00:32:46 GMT
Author: rwatler
Date: Sun Dec  4 16:32:38 2005
New Revision: 353944

URL: http://svn.apache.org/viewcvs?rev=353944&view=rev
Log:
Employ unquoted CSV OJB field conversions for ACL fields in the DB PageManager schema

Added:
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/util/
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/util/ojb/
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/util/ojb/ACLFieldConversion.java
  (with props)
Modified:
    portals/jetspeed-2/trunk/components/page-manager/src/java/JETSPEED-INF/ojb/page-manager-repository.xml
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/JETSPEED-INF/ojb/page-manager-repository.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/JETSPEED-INF/ojb/page-manager-repository.xml?rev=353944&r1=353943&r2=353944&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/JETSPEED-INF/ojb/page-manager-repository.xml
(original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/JETSPEED-INF/ojb/page-manager-repository.xml
Sun Dec  4 16:32:38 2005
@@ -316,28 +316,28 @@
          name="usersList"
          column="USER_PRINCIPALS_ACL"
          jdbc-type="VARCHAR"
-         conversion="org.apache.jetspeed.util.ojb.CSVtoCollectionFieldConversion"
+         conversion="org.apache.jetspeed.util.ojb.ACLFieldConversion"
       />
 
       <field-descriptor
          name="rolesList"
          column="ROLE_PRINCIPALS_ACL"
          jdbc-type="VARCHAR"
-         conversion="org.apache.jetspeed.util.ojb.CSVtoCollectionFieldConversion"
+         conversion="org.apache.jetspeed.util.ojb.ACLFieldConversion"
       />
 
       <field-descriptor
          name="groupsList"
          column="GROUP_PRINCIPALS_ACL"
          jdbc-type="VARCHAR"
-         conversion="org.apache.jetspeed.util.ojb.CSVtoCollectionFieldConversion"
+         conversion="org.apache.jetspeed.util.ojb.ACLFieldConversion"
       />
 
       <field-descriptor
          name="permissionsList"
          column="PERMISSIONS_ACL"
          jdbc-type="VARCHAR"
-         conversion="org.apache.jetspeed.util.ojb.CSVtoCollectionFieldConversion"
+         conversion="org.apache.jetspeed.util.ojb.ACLFieldConversion"
       />
    </class-descriptor>
 
@@ -1067,28 +1067,28 @@
          name="usersList"
          column="USER_PRINCIPALS_ACL"
          jdbc-type="VARCHAR"
-         conversion="org.apache.jetspeed.util.ojb.CSVtoCollectionFieldConversion"
+         conversion="org.apache.jetspeed.util.ojb.ACLFieldConversion"
       />
 
       <field-descriptor
          name="rolesList"
          column="ROLE_PRINCIPALS_ACL"
          jdbc-type="VARCHAR"
-         conversion="org.apache.jetspeed.util.ojb.CSVtoCollectionFieldConversion"
+         conversion="org.apache.jetspeed.util.ojb.ACLFieldConversion"
       />
 
       <field-descriptor
          name="groupsList"
          column="GROUP_PRINCIPALS_ACL"
          jdbc-type="VARCHAR"
-         conversion="org.apache.jetspeed.util.ojb.CSVtoCollectionFieldConversion"
+         conversion="org.apache.jetspeed.util.ojb.ACLFieldConversion"
       />
 
       <field-descriptor
          name="permissionsList"
          column="PERMISSIONS_ACL"
          jdbc-type="VARCHAR"
-         conversion="org.apache.jetspeed.util.ojb.CSVtoCollectionFieldConversion"
+         conversion="org.apache.jetspeed.util.ojb.ACLFieldConversion"
       />
    </class-descriptor>
 
@@ -1711,28 +1711,28 @@
          name="usersList"
          column="USER_PRINCIPALS_ACL"
          jdbc-type="VARCHAR"
-         conversion="org.apache.jetspeed.util.ojb.CSVtoCollectionFieldConversion"
+         conversion="org.apache.jetspeed.util.ojb.ACLFieldConversion"
       />
 
       <field-descriptor
          name="rolesList"
          column="ROLE_PRINCIPALS_ACL"
          jdbc-type="VARCHAR"
-         conversion="org.apache.jetspeed.util.ojb.CSVtoCollectionFieldConversion"
+         conversion="org.apache.jetspeed.util.ojb.ACLFieldConversion"
       />
 
       <field-descriptor
          name="groupsList"
          column="GROUP_PRINCIPALS_ACL"
          jdbc-type="VARCHAR"
-         conversion="org.apache.jetspeed.util.ojb.CSVtoCollectionFieldConversion"
+         conversion="org.apache.jetspeed.util.ojb.ACLFieldConversion"
       />
 
       <field-descriptor
          name="permissionsList"
          column="PERMISSIONS_ACL"
          jdbc-type="VARCHAR"
-         conversion="org.apache.jetspeed.util.ojb.CSVtoCollectionFieldConversion"
+         conversion="org.apache.jetspeed.util.ojb.ACLFieldConversion"
       />
    </class-descriptor>
 
@@ -2086,28 +2086,28 @@
          name="usersList"
          column="USER_PRINCIPALS_ACL"
          jdbc-type="VARCHAR"
-         conversion="org.apache.jetspeed.util.ojb.CSVtoCollectionFieldConversion"
+         conversion="org.apache.jetspeed.util.ojb.ACLFieldConversion"
       />
 
       <field-descriptor
          name="rolesList"
          column="ROLE_PRINCIPALS_ACL"
          jdbc-type="VARCHAR"
-         conversion="org.apache.jetspeed.util.ojb.CSVtoCollectionFieldConversion"
+         conversion="org.apache.jetspeed.util.ojb.ACLFieldConversion"
       />
 
       <field-descriptor
          name="groupsList"
          column="GROUP_PRINCIPALS_ACL"
          jdbc-type="VARCHAR"
-         conversion="org.apache.jetspeed.util.ojb.CSVtoCollectionFieldConversion"
+         conversion="org.apache.jetspeed.util.ojb.ACLFieldConversion"
       />
 
       <field-descriptor
          name="permissionsList"
          column="PERMISSIONS_ACL"
          jdbc-type="VARCHAR"
-         conversion="org.apache.jetspeed.util.ojb.CSVtoCollectionFieldConversion"
+         conversion="org.apache.jetspeed.util.ojb.ACLFieldConversion"
       />
    </class-descriptor>
 
@@ -2336,28 +2336,28 @@
          name="usersList"
          column="USER_PRINCIPALS_ACL"
          jdbc-type="VARCHAR"
-         conversion="org.apache.jetspeed.util.ojb.CSVtoCollectionFieldConversion"
+         conversion="org.apache.jetspeed.util.ojb.ACLFieldConversion"
       />
 
       <field-descriptor
          name="rolesList"
          column="ROLE_PRINCIPALS_ACL"
          jdbc-type="VARCHAR"
-         conversion="org.apache.jetspeed.util.ojb.CSVtoCollectionFieldConversion"
+         conversion="org.apache.jetspeed.util.ojb.ACLFieldConversion"
       />
 
       <field-descriptor
          name="groupsList"
          column="GROUP_PRINCIPALS_ACL"
          jdbc-type="VARCHAR"
-         conversion="org.apache.jetspeed.util.ojb.CSVtoCollectionFieldConversion"
+         conversion="org.apache.jetspeed.util.ojb.ACLFieldConversion"
       />
 
       <field-descriptor
          name="permissionsList"
          column="PERMISSIONS_ACL"
          jdbc-type="VARCHAR"
-         conversion="org.apache.jetspeed.util.ojb.CSVtoCollectionFieldConversion"
+         conversion="org.apache.jetspeed.util.ojb.ACLFieldConversion"
       />
    </class-descriptor>
 

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java?rev=353944&r1=353943&r2=353944&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java
(original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java
Sun Dec  4 16:32:38 2005
@@ -268,6 +268,9 @@
         return fragment;        
     }
 
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#newPortletFragment()
+     */
     public Fragment newPortletFragment()
     {
         Fragment fragment = null;

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java?rev=353944&r1=353943&r2=353944&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java
(original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java
Sun Dec  4 16:32:38 2005
@@ -228,15 +228,13 @@
         return delegator.newFragment();    
     }
 
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.page.PageManager#newPortletFragment()
+     */
     public Fragment newPortletFragment()
     {
         return delegator.newPortletFragment();
     }
-    
-
-
-
-
 
     /* (non-Javadoc)
      * @see org.apache.jetspeed.page.PageManager#newFolderMenuDefinition()

Added: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/util/ojb/ACLFieldConversion.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/util/ojb/ACLFieldConversion.java?rev=353944&view=auto
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/util/ojb/ACLFieldConversion.java
(added)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/util/ojb/ACLFieldConversion.java
Sun Dec  4 16:32:38 2005
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2000-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.util.ojb;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.ojb.broker.accesslayer.conversions.ConversionException;
+import org.apache.ojb.broker.accesslayer.conversions.FieldConversion;
+
+/**
+ * ACLFieldConversion 
+ *
+ * OJB field conversion: Helps transparently map ACL List members
+ * to/from database table column that that contains an ordered
+ * CSV list of strings.
+ */
+public class ACLFieldConversion implements FieldConversion
+{
+    private static final String DELIM = ",";
+
+    /**
+     * @see org.apache.ojb.broker.accesslayer.conversions.FieldConversion#javaToSql(java.lang.Object)
+     */
+    public Object javaToSql(Object arg0) throws ConversionException
+    {
+        if (arg0 instanceof List)
+        {
+            List csvList = (List) arg0;
+            if (csvList.size() > 1)
+            {
+                StringBuffer buffer = null;
+                Iterator values = csvList.iterator();
+                while (values.hasNext())
+                {
+                    String value = (String)values.next();
+                    if (value.length() > 0)
+                    {
+                        if (buffer == null)
+                        {
+                            buffer = new StringBuffer(255);
+                        }
+                        else
+                        {
+                            buffer.append(DELIM);
+                        }
+                        buffer.append(value);
+                    }
+                }
+                if (buffer != null)
+                {
+                    return buffer.toString();
+                }
+            }
+            else if (!csvList.isEmpty())
+            {
+                String value = (String)csvList.get(0);
+                if (value.length() > 0)
+                {
+                    return value;
+                }
+            }
+            return "";
+        }
+        return arg0;
+    }
+
+    /**
+     * @see org.apache.ojb.broker.accesslayer.conversions.FieldConversion#sqlToJava(java.lang.Object)
+     */
+    public Object sqlToJava(Object arg0) throws ConversionException
+    {
+        if (arg0 instanceof String)
+        {
+            List aclList = new ArrayList(4);
+            StringTokenizer tokens = new StringTokenizer((String) arg0, DELIM);
+            while (tokens.hasMoreTokens())
+            {
+                String value = tokens.nextToken().trim();
+                if (value.length() > 0)
+                {
+                    aclList.add(value);
+                }
+            }
+            return aclList;
+        }
+        return arg0;
+    }
+}

Propchange: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/util/ojb/ACLFieldConversion.java
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
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