portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r378366 - in /portals/jetspeed-2/trunk/components: page-manager/src/java/JETSPEED-INF/ojb/ registry/src/java/JETSPEED-INF/ojb/ registry/src/java/org/apache/jetspeed/components/portletentity/ registry/src/java/org/apache/jetspeed/om/impl/ re...
Date Thu, 16 Feb 2006 21:02:12 GMT
Author: ate
Date: Thu Feb 16 13:02:10 2006
New Revision: 378366

URL: http://svn.apache.org/viewcvs?rev=378366&view=rev
Log:
Fixing incorrect usage and implementation of the Pluto ObjectID interface: 
- correct usage to either rely on the String based JetspeedObjectID or the Long based JetspeedLongObjectID
See http://issues.apache.org/jira/browse/JS2-501

Modified:
    portals/jetspeed-2/trunk/components/page-manager/src/java/JETSPEED-INF/ojb/page-manager-repository.xml
    portals/jetspeed-2/trunk/components/registry/src/java/JETSPEED-INF/ojb/registry_repository.xml
    portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java
    portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/impl/LocalizedFieldImpl.java
    portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java
    portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionImpl.java
    portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/servlet/impl/WebApplicationDefinitionImpl.java
    portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/util/ojb/ObjectIDtoLongFieldConversion.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=378366&r1=378365&r2=378366&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
Thu Feb 16 13:02:10 2006
@@ -273,9 +273,10 @@
       <field-descriptor
          name="id"
          column="METADATA_ID"
-         jdbc-type="INTEGER"
+         jdbc-type="BIGINT"
          primarykey="true"
          autoincrement="true"
+         conversion="org.apache.jetspeed.util.ojb.ObjectIDtoLongFieldConversion"
       />
 
       <field-descriptor
@@ -782,9 +783,10 @@
       <field-descriptor
          name="id"
          column="METADATA_ID"
-         jdbc-type="INTEGER"
+         jdbc-type="BIGINT"
          primarykey="true"
          autoincrement="true"
+         conversion="org.apache.jetspeed.util.ojb.ObjectIDtoLongFieldConversion"
       />
 
       <field-descriptor
@@ -1024,9 +1026,10 @@
       <field-descriptor
          name="id"
          column="METADATA_ID"
-         jdbc-type="INTEGER"
+         jdbc-type="BIGINT"
          primarykey="true"
          autoincrement="true"
+         conversion="org.apache.jetspeed.util.ojb.ObjectIDtoLongFieldConversion"
       />
 
       <field-descriptor
@@ -1501,9 +1504,10 @@
       <field-descriptor
          name="id"
          column="METADATA_ID"
-         jdbc-type="INTEGER"
+         jdbc-type="BIGINT"
          primarykey="true"
          autoincrement="true"
+         conversion="org.apache.jetspeed.util.ojb.ObjectIDtoLongFieldConversion"
       />
 
       <field-descriptor
@@ -2049,9 +2053,10 @@
       <field-descriptor
          name="id"
          column="METADATA_ID"
-         jdbc-type="INTEGER"
+         jdbc-type="BIGINT"
          primarykey="true"
          autoincrement="true"
+         conversion="org.apache.jetspeed.util.ojb.ObjectIDtoLongFieldConversion"
       />
 
       <field-descriptor

Modified: portals/jetspeed-2/trunk/components/registry/src/java/JETSPEED-INF/ojb/registry_repository.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/registry/src/java/JETSPEED-INF/ojb/registry_repository.xml?rev=378366&r1=378365&r2=378366&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/registry/src/java/JETSPEED-INF/ojb/registry_repository.xml
(original)
+++ portals/jetspeed-2/trunk/components/registry/src/java/JETSPEED-INF/ojb/registry_repository.xml
Thu Feb 16 13:02:10 2006
@@ -28,6 +28,7 @@
          jdbc-type="BIGINT"
          primarykey="true"
          autoincrement="true"
+         conversion="org.apache.jetspeed.util.ojb.ObjectIDtoLongFieldConversion"
       />
       <field-descriptor
          name="parentId"
@@ -66,6 +67,7 @@
          jdbc-type="BIGINT"
          primarykey="true"
          autoincrement="true"
+         conversion="org.apache.jetspeed.util.ojb.ObjectIDtoLongFieldConversion"
       />
       <field-descriptor
          name="parentId"
@@ -117,7 +119,6 @@
          jdbc-type="BIGINT"
          primarykey="true"
          autoincrement="true"
-
       />
 
       <field-descriptor
@@ -126,8 +127,6 @@
          jdbc-type="VARCHAR"
 
       />
-      <!--conversion="org.apache.jetspeed.util.ojb.LongtoStringFieldConversion"-->
-      <!--conversion="org.apache.jetspeed.util.ojb.ObjectIDtoLongFieldConversion" -->
 
       <field-descriptor
          name="name"
@@ -242,7 +241,6 @@
          jdbc-type="BIGINT"
          primarykey="true"
          autoincrement="true"
-
       />
 
 
@@ -305,7 +303,6 @@
          jdbc-type="BIGINT"
          primarykey="true"
          autoincrement="true"
-
       />
 
       <field-descriptor
@@ -1112,14 +1109,6 @@
          column="PORTLET_NAME"
          jdbc-type="VARCHAR"
       />
-      <!--
-      <field-descriptor
-         name="portletId"
-         column="PORTLET_DEFINITION_ID"
-         jdbc-type="BIGINT"
-
-      />
-      -->
 
       <field-descriptor
          name="id"
@@ -1128,19 +1117,6 @@
          autoincrement="true"
          conversion="org.apache.jetspeed.util.ojb.ObjectIDtoStringFieldConversion"
       />
-<!--         conversion="org.apache.jetspeed.util.ojb.ObjectIDtoStringFieldConversion"
-->
-     <!--
-     <reference-descriptor
-        name="portletDefinition"
-        class-ref="org.apache.jetspeed.om.portlet.impl.PortletDefinitionImpl"
-         auto-delete="false"
-         auto-update = "true"
-         auto-retrieve = "true"
-     >
-         <foreignkey field-ref="portletId"/>
-      </reference-descriptor>
-       -->
-
 
   </class-descriptor>
 

Modified: portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java?rev=378366&r1=378365&r2=378366&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java
Thu Feb 16 13:02:10 2006
@@ -47,7 +47,6 @@
 import org.apache.pluto.om.common.ObjectID;
 import org.apache.pluto.om.common.PreferenceSet;
 import org.apache.pluto.om.entity.PortletApplicationEntity;
-import org.apache.pluto.om.entity.PortletEntity;
 import org.apache.pluto.om.portlet.PortletDefinition;
 import org.apache.pluto.om.window.PortletWindowList;
 import org.apache.pluto.util.StringUtils;
@@ -64,8 +63,6 @@
 
     private long oid;
 
-    private long portletId;
-
     private JetspeedObjectID id;
 
     protected static PortletEntityAccessComponent pac;
@@ -85,8 +82,6 @@
     private PortletApplicationEntity applicationEntity = null;
 
     private PortletWindowList portletWindows = new PortletWindowListImpl();
-
-    private PortletEntity modifiedObject = null;
 
     private PortletDefinitionComposite portletDefinition = null;
     

Modified: portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/impl/LocalizedFieldImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/impl/LocalizedFieldImpl.java?rev=378366&r1=378365&r2=378366&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/impl/LocalizedFieldImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/impl/LocalizedFieldImpl.java
Thu Feb 16 13:02:10 2006
@@ -17,7 +17,7 @@
 
 import org.apache.jetspeed.om.common.LocalizedField;
 import org.apache.jetspeed.util.HashCodeBuilder;
-import org.apache.jetspeed.util.JetspeedObjectID;
+import org.apache.jetspeed.util.JetspeedLongObjectID;
 import org.apache.pluto.om.common.ObjectID;
 
 /**
@@ -36,9 +36,8 @@
     protected Locale locale;
     
     protected long parentId;
-    protected long id;
+    protected JetspeedLongObjectID id;
     
-
     public LocalizedFieldImpl()
     {
         
@@ -87,17 +86,9 @@
      */
     public ObjectID getId()
     {
-        return new JetspeedObjectID(id);
+        return id;
     }
 
-    /**
-     * 
-     */
-    public void setId(String oid)
-    {
-        id = JetspeedObjectID.createFromString(oid).longValue();
-    }
-    
     public void setLanguage(String language)
     {
 		if (language != null)

Modified: portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java?rev=378366&r1=378365&r2=378366&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/portlet/impl/PortletApplicationDefinitionImpl.java
Thu Feb 16 13:02:10 2006
@@ -29,7 +29,7 @@
 import org.apache.jetspeed.om.common.portlet.MutablePortletApplication;
 import org.apache.jetspeed.om.common.portlet.PortletDefinitionComposite;
 import org.apache.jetspeed.om.impl.UserAttributeImpl;
-import org.apache.jetspeed.util.JetspeedObjectID;
+import org.apache.jetspeed.util.JetspeedLongObjectID;
 import org.apache.pluto.om.common.ObjectID;
 import org.apache.pluto.om.portlet.PortletDefinition;
 import org.apache.pluto.om.portlet.PortletDefinitionList;
@@ -48,9 +48,10 @@
      * Unique id of the application.  This serves as the primary key in database
      * and in any caching of this object.
      */
-    // private ObjectID id;
-    private long id;
-
+    private Long id;
+    
+    private JetspeedLongObjectID oid;
+    
     /** Holds value of property name. */
     private String name;
 
@@ -98,15 +99,15 @@
     }
 
     /**
-     * Getter for the applicationId
-     *
-     * @return applicationId
-     * @see #applicationId
+     * @see org.apache.pluto.om.portlet.PortletApplicationDefinition#getId()
      */
     public ObjectID getId()
     {
-        
-        return new JetspeedObjectID(id);
+        if ( oid == null && id != null )
+        {
+            oid = new JetspeedLongObjectID(id);
+        }
+        return oid;
     }
 
     /**
@@ -171,14 +172,6 @@
     public void setDescription(String string)
     {
         description = string;
-    }
-
-    /**
-     * @param objectID
-     */
-    public void setId(String objectID)
-    {
-        id = JetspeedObjectID.createFromString(objectID).longValue();
     }
 
     /**

Modified: portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionImpl.java?rev=378366&r1=378365&r2=378366&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/portlet/impl/PortletDefinitionImpl.java
Thu Feb 16 13:02:10 2006
@@ -58,7 +58,7 @@
 import org.apache.jetspeed.om.preference.impl.PrefsPreference;
 import org.apache.jetspeed.om.preference.impl.PrefsPreferenceSetImpl;
 import org.apache.jetspeed.util.HashCodeBuilder;
-import org.apache.jetspeed.util.JetspeedObjectID;
+import org.apache.jetspeed.util.JetspeedLongObjectID;
 import org.apache.pluto.om.common.Description;
 import org.apache.pluto.om.common.DescriptionSet;
 import org.apache.pluto.om.common.DisplayName;
@@ -99,7 +99,8 @@
     protected static PortletRegistry registry;
     protected static PortletFactory  portletFactory;
     
-    private long id;
+    private Long id;
+    private JetspeedLongObjectID oid;
     private String className;
     private String name;
     private String portletIdentifier;
@@ -159,12 +160,11 @@
      */
     public ObjectID getId()
     {
-        return new JetspeedObjectID(id);
-    }
-
-    public long getOID()
-    {
-        return id;
+        if ( oid == null && id != null )
+        {
+            oid = new JetspeedLongObjectID(id);
+        }
+        return oid;
     }
 
     /**
@@ -304,7 +304,7 @@
      */
     public void setId( String oid )
     {
-        id = JetspeedObjectID.createFromString(oid).longValue();
+        throw new UnsupportedOperationException();
     }
 
     /**
@@ -534,7 +534,7 @@
         if (obj != null && obj.getClass().equals(getClass()))
         {
             PortletDefinitionImpl pd = (PortletDefinitionImpl) obj;
-            boolean sameId = (id != 0 && id == pd.id);
+            boolean sameId = (id != null && pd.id != null && id.equals(pd.id));
             if (sameId)
             {
                 return true;

Modified: portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/servlet/impl/WebApplicationDefinitionImpl.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/servlet/impl/WebApplicationDefinitionImpl.java?rev=378366&r1=378365&r2=378366&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/servlet/impl/WebApplicationDefinitionImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/om/servlet/impl/WebApplicationDefinitionImpl.java
Thu Feb 16 13:02:10 2006
@@ -33,7 +33,7 @@
 import org.apache.jetspeed.om.impl.WebAppDescriptionImpl;
 import org.apache.jetspeed.om.impl.WebAppDisplayNameImpl;
 import org.apache.jetspeed.util.JetspeedLocale;
-import org.apache.jetspeed.util.JetspeedObjectID;
+import org.apache.jetspeed.util.JetspeedLongObjectID;
 import org.apache.pluto.om.common.Description;
 import org.apache.pluto.om.common.DescriptionSet;
 import org.apache.pluto.om.common.DisplayName;
@@ -54,8 +54,8 @@
  */
 public class WebApplicationDefinitionImpl implements MutableWebApplication, Serializable
 {
-
-    private long id;
+    private Long id;
+    private JetspeedLongObjectID oid;
     private Collection displayNames = new ArrayList();
     private DisplayNameSetImpl DNCollWrapper = new DisplayNameSetImpl();
 
@@ -74,7 +74,11 @@
      */
     public ObjectID getId()
     {
-        return new JetspeedObjectID((int)id);
+        if ( oid == null && id != null )
+        {
+            oid = new JetspeedLongObjectID(id);
+        }
+        return oid;
     }
 
     /**
@@ -138,14 +142,6 @@
     public String getContextRoot()
     {
         return contextRoot;
-    }
-
-    /**
-     * @see org.apache.pluto.om.servlet.WebApplicationDefinitionCtrl#setId(java.lang.String)
-     */
-    public void setId(String oid)
-    {
-        id = JetspeedObjectID.createFromString(oid).longValue();
     }
 
     /**

Modified: portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/util/ojb/ObjectIDtoLongFieldConversion.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/util/ojb/ObjectIDtoLongFieldConversion.java?rev=378366&r1=378365&r2=378366&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/util/ojb/ObjectIDtoLongFieldConversion.java
(original)
+++ portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/util/ojb/ObjectIDtoLongFieldConversion.java
Thu Feb 16 13:02:10 2006
@@ -15,7 +15,7 @@
  */
 package org.apache.jetspeed.util.ojb;
 
-import org.apache.jetspeed.util.JetspeedObjectID;
+import org.apache.jetspeed.util.JetspeedLongObjectID;
 import org.apache.ojb.broker.accesslayer.conversions.ConversionException;
 import org.apache.ojb.broker.accesslayer.conversions.FieldConversion;
 
@@ -24,7 +24,7 @@
  * ObjectRelationalBridge field conversion.
  * </p>
  * 
- * Converts between <code>long</code> and <code>ObjectID</code>
+ * Converts between <code>long</code> and <code>JetspeedLongObjectID</code>
  * 
  * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
  */
@@ -36,17 +36,11 @@
      */
     public Object javaToSql(Object arg0) throws ConversionException
     {
-        if (arg0 instanceof JetspeedObjectID)
+        if (arg0 instanceof JetspeedLongObjectID)
         {
-            JetspeedObjectID oid = (JetspeedObjectID) arg0;
-
-            return new Long(oid.longValue());
-        }
-        else
-        {
-            return arg0;
+            return ((JetspeedLongObjectID)arg0).getLong();
         }
-
+        return arg0;
     }
 
     /**
@@ -56,14 +50,8 @@
     {
         if (arg0 instanceof Number)
         {
-            
-            return new JetspeedObjectID(((Number)arg0).longValue());
+            return new JetspeedLongObjectID(((Number)arg0).longValue());
         }
-        else
-        {
-            return arg0;
-        }
-
+        return arg0;
     }
-
 }



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