incubator-graffito-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r151230 - incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/impl/CmsObjectImpl.java
Date Thu, 03 Feb 2005 21:12:38 GMT
Author: taylor
Date: Thu Feb  3 13:12:37 2005
New Revision: 151230

URL: http://svn.apache.org/viewcvs?view=rev&rev=151230
Log:
implement setObject, getObject and getObjects 
require object to be serializable on setObject
note this does not do the persistence


Modified:
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/impl/CmsObjectImpl.java

Modified: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/impl/CmsObjectImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/impl/CmsObjectImpl.java?view=diff&r1=151229&r2=151230
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/impl/CmsObjectImpl.java
(original)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/model/impl/CmsObjectImpl.java
Thu Feb  3 13:12:37 2005
@@ -15,6 +15,7 @@
  */
 package org.apache.portals.graffito.model.impl;
 
+import java.io.NotSerializableException;
 import java.io.Serializable;
 import java.util.Date;
 import java.util.HashMap;
@@ -33,6 +34,8 @@
  */
 public class CmsObjectImpl implements CmsObject, Serializable
 {
+    public static final long serialVersionUID = 1;
+    
     protected Long objectId;
     
     protected boolean isLastVersion = true;
@@ -50,6 +53,7 @@
     protected Date lastModified;
     
     protected Map properties = new HashMap();
+    protected Map objects = new HashMap();
     
     /** 
      * Special attribute telling OJB the object's concrete type.
@@ -148,8 +152,6 @@
     {
         this.objectId = objectId;
     }
-
-   // private Map properties = new HashMap();
     
 
     /* 
@@ -318,6 +320,45 @@
     public void setProperty(String name, String property)
     {
         properties.put(name, property);
+    }
+
+    /**
+     * Get a map of all objects for this documen t
+     * Objects should be serializable
+     * 
+     * @return a map of objects
+     */
+    public Map getObjects()
+    {
+        return objects;
+    }
+
+    /**
+     * Get a named object for this document
+     * Objects should be serializable
+     * 
+     * @param name of the object
+     * @return the object 
+     */
+    public Object getObject(String name)
+    {
+        return objects.get(name);        
+    }
+
+    /**
+     * Sets a named object for this string
+     * Objects should be serializable
+     * 
+     * @param name
+     * @param object
+     */
+    public void setObject(String name, Object object)
+    throws NotSerializableException
+    {
+        if (object instanceof Serializable)
+            objects.put(name, object);
+        else
+            throw new NotSerializableException("Object must be serializable: " + name);
     }
     
 }



Mime
View raw message