incubator-graffito-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apope...@apache.org
Subject svn commit: r375383 - in /incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence: atomictypeconverter/ atomictypeconverter/impl/ collectionconverter/impl/ objectconverter/impl/
Date Mon, 06 Feb 2006 21:35:48 GMT
Author: apopescu
Date: Mon Feb  6 13:35:46 2006
New Revision: 375383

URL: http://svn.apache.org/viewcvs?rev=375383&view=rev
Log:
AtomicTypeConverter works in a visitor mode

Modified:
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/AtomicTypeConverter.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/BinaryTypeConverterImpl.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/BooleanTypeConverterImpl.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/ByteArrayTypeConverterImpl.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/CalendarTypeConverterImpl.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/DoubleTypeConverterImpl.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/IntTypeConverterImpl.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/LongTypeConverterImpl.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/StringTypeConverterImpl.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/TimestampTypeConverterImpl.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/UtilDateTypeConverterImpl.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/MultiValueCollectionConverterImpl.java
    incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/AtomicTypeConverter.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/AtomicTypeConverter.java?rev=375383&r1=375382&r2=375383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/AtomicTypeConverter.java
(original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/AtomicTypeConverter.java
Mon Feb  6 13:35:46 2006
@@ -29,11 +29,10 @@
  * 
  * 
  * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
- *
+ * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
  */
 public interface AtomicTypeConverter
 {
-
 	/**
 	 * Convert an object into a JCR value.
 	 * 
@@ -41,7 +40,7 @@
 	 * @return the corresponding JCR value
 	 *  
 	 */
-	public Value getValue(Object object);
+	public Value getValue(ValueFactory valueFactory, Object object);
 
 	/**
 	 * Convert a jcr property value into an object
@@ -57,12 +56,4 @@
 	 * @return The string converted value	 
 	 */
 	public String getStringValue(Object object);
-
-    /**
-     * Set the underlying <code>ValueFactory</code> to be used
-     * when creating the <code>Value</code>.
-     * 
-     * @param valueFactory <code>javax.jcr.ValueFactory</code>
-     */
-    public void setValueFactory(ValueFactory valueFactory);
 }

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/BinaryTypeConverterImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/BinaryTypeConverterImpl.java?rev=375383&r1=375382&r2=375383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/BinaryTypeConverterImpl.java
(original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/BinaryTypeConverterImpl.java
Mon Feb  6 13:35:46 2006
@@ -24,47 +24,28 @@
 import javax.jcr.ValueFactory;
 
 import org.apache.portals.graffito.jcr.exception.IncorrectAtomicTypeException;
+import org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter;
 
 /**
  * 
  * Binary Type Converter
  * 
  * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
- *
+ * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
  */
-public class BinaryTypeConverterImpl extends AbstractAtomicTypeConverterImpl
+public class BinaryTypeConverterImpl implements AtomicTypeConverter
 {
-    /**
-     * No-arg constructor.
-     * When using it you should provide later the <code>javax.jcr.ValueFactory</code>.
-     * 
-     * @see #setValueFactory(ValueFactory)
-     */
-    public BinaryTypeConverterImpl()
-    {
-        super();
-    }
-    
-	/**
-	 * Constructor
-	 * @param factory The JCR Value factory to used
-	 */
-	public BinaryTypeConverterImpl(ValueFactory factory)
-	{
-		super(factory);
-	}
-
 	/**
 	 * 
 	 * @see org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter#getValue(java.lang.Object)
 	 */
-    public Value getValue(Object propValue)
+    public Value getValue(ValueFactory valueFactory, Object propValue)
     {
         if (propValue == null)
         {
             return null;
         }
-        return this.getValueFactory().createValue((InputStream) propValue);
+        return valueFactory.createValue((InputStream) propValue);
     }
 
     /**
@@ -92,8 +73,4 @@
 	{		
 		throw new IncorrectAtomicTypeException("Binary cannot be convert into string");
 	}
-
-    
-
-
 }

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/BooleanTypeConverterImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/BooleanTypeConverterImpl.java?rev=375383&r1=375382&r2=375383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/BooleanTypeConverterImpl.java
(original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/BooleanTypeConverterImpl.java
Mon Feb  6 13:35:46 2006
@@ -21,48 +21,28 @@
 import javax.jcr.ValueFactory;
 
 import org.apache.portals.graffito.jcr.exception.IncorrectAtomicTypeException;
+import org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter;
 
 /**
  * Boolean Type Converter
  * 
  * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
- *
+ * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
  */
-public class BooleanTypeConverterImpl extends AbstractAtomicTypeConverterImpl
+public class BooleanTypeConverterImpl implements AtomicTypeConverter
 {
-    /**
-     * No-arg constructor.
-     * When using it you should provide later the <code>javax.jcr.ValueFactory</code>.
-     * 
-     * @see #setValueFactory(ValueFactory)
-     */
-    public BooleanTypeConverterImpl()
-    {
-        super();
-    }
-    
-	/**
-	 * Constructor
-	 * @param factory The JCR Value factory to used
-	 */
-	public BooleanTypeConverterImpl(ValueFactory factory)
-	{
-		super(factory);
-
-	}
-
 	/**
 	 * 
 	 * @see org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter#getValue(java.lang.Object)
 	 */
-	public Value getValue(Object propValue)
+	public Value getValue(ValueFactory valueFactory, Object propValue)
 	{
 		if (propValue == null)
 		{
 			return null;
 		}
 		boolean value = ((Boolean) propValue).booleanValue();
-		return this.getValueFactory().createValue(value);
+		return valueFactory.createValue(value);
 	}
 	
 
@@ -88,7 +68,6 @@
 	 */
 	public String getStringValue(Object object)
 	{
-		
 		return ((Boolean) object).booleanValue() ? "true()" : "false()"; 
 	}
 

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/ByteArrayTypeConverterImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/ByteArrayTypeConverterImpl.java?rev=375383&r1=375382&r2=375383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/ByteArrayTypeConverterImpl.java
(original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/ByteArrayTypeConverterImpl.java
Mon Feb  6 13:35:46 2006
@@ -22,49 +22,29 @@
 import javax.jcr.ValueFactory;
 
 import org.apache.portals.graffito.jcr.exception.IncorrectAtomicTypeException;
+import org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter;
 
 /**
  * 
  * Byte Array Type Converter
  * 
  * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
- *
+ * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
  */
-public class ByteArrayTypeConverterImpl extends AbstractAtomicTypeConverterImpl
+public class ByteArrayTypeConverterImpl implements AtomicTypeConverter
 {
-    /**
-     * No-arg constructor.
-     * When using it you should provide later the <code>javax.jcr.ValueFactory</code>.
-     * 
-     * @see #setValueFactory(ValueFactory)
-     */
-    public ByteArrayTypeConverterImpl()
-    {
-        super();
-    }
-    
-	/**
-	 * Constructor
-	 * @param factory The JCR Value factory to used
-	 */
-	public ByteArrayTypeConverterImpl(ValueFactory factory)
-	{
-		super(factory);
-
-	}
-
 	/**
 	 * 
 	 * @see org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter#getValue(java.lang.Object)
 	 */
-	public Value getValue(Object propValue)
+	public Value getValue(ValueFactory valueFactory, Object propValue)
 	{
 		if (propValue == null)
 		{
 			return null;
 		}
 		String value = new String((byte[]) propValue);
-		return getValueFactory().createValue(value);
+		return valueFactory.createValue(value);
 	}
 
 
@@ -90,8 +70,6 @@
 	 */
 	public String getStringValue(Object object)
 	{
-		
 		return  "'" + object.toString() + "'";
 	}
-
 }

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/CalendarTypeConverterImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/CalendarTypeConverterImpl.java?rev=375383&r1=375382&r2=375383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/CalendarTypeConverterImpl.java
(original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/CalendarTypeConverterImpl.java
Mon Feb  6 13:35:46 2006
@@ -24,48 +24,28 @@
 import javax.jcr.ValueFactory;
 
 import org.apache.portals.graffito.jcr.exception.IncorrectAtomicTypeException;
+import org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter;
 
 /**
  * Calendar Type Converter
  * 
  * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
- *
+ * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
  */
-public class CalendarTypeConverterImpl extends AbstractAtomicTypeConverterImpl
+public class CalendarTypeConverterImpl implements AtomicTypeConverter
 {
-    /**
-     * No-arg constructor.
-     * When using it you should provide later the <code>javax.jcr.ValueFactory</code>.
-     * 
-     * @see #setValueFactory(ValueFactory)
-     */
-    public CalendarTypeConverterImpl()
-    {
-        super();
-    }
-    
-	/**
-	 * Constructor
-	 * @param factory The JCR Value factory to used
-	 */
-	public CalendarTypeConverterImpl(ValueFactory factory)
-	{
-		super(factory);
-
-	}
-
 	/**
 	 * 
 	 * @see org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter#getValue(java.lang.Object)
 	 */
-	public Value getValue(Object propValue)
+	public Value getValue(ValueFactory valueFactory, Object propValue)
 	{
 		if (propValue == null)
 		{
 			return null;
 		}
-		return this.getValueFactory().createValue(((Calendar) propValue).getTimeInMillis());
-
+        
+		return valueFactory.createValue(((Calendar) propValue).getTimeInMillis());
 	}
 
     /**
@@ -76,7 +56,6 @@
 	{
 		try
 		{
-			
 			Calendar calendar = Calendar.getInstance();
 			calendar.setTimeInMillis(value.getLong());
 			return calendar;
@@ -93,7 +72,6 @@
 	 */
 	public String getStringValue(Object object)
 	{
-		
 		Calendar calendar = (Calendar) object;
     	return new Long(calendar.getTimeInMillis()).toString();		
 	}

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/DoubleTypeConverterImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/DoubleTypeConverterImpl.java?rev=375383&r1=375382&r2=375383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/DoubleTypeConverterImpl.java
(original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/DoubleTypeConverterImpl.java
Mon Feb  6 13:35:46 2006
@@ -22,49 +22,29 @@
 import javax.jcr.ValueFactory;
 
 import org.apache.portals.graffito.jcr.exception.IncorrectAtomicTypeException;
+import org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter;
 
 /**
  * Double Type Converter 
  * 
  * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
- *
+ * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
  */
-public class DoubleTypeConverterImpl extends AbstractAtomicTypeConverterImpl
+public class DoubleTypeConverterImpl implements AtomicTypeConverter
 {
-    /**
-     * No-arg constructor.
-     * When using it you should provide later the <code>javax.jcr.ValueFactory</code>.
-     * 
-     * @see #setValueFactory(ValueFactory)
-     */
-    public DoubleTypeConverterImpl()
-    {
-        super();
-    }
-    
-	/**
-	 * Constructor
-	 * @param factory The JCR Value factory to used
-	 */
-
-	public DoubleTypeConverterImpl(ValueFactory factory)
-	{
-		super(factory);
-
-	}
-
 	/**
 	 * 
 	 * @see org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter#getValue(java.lang.Object)
 	 */
-	public Value getValue(Object propValue)
+	public Value getValue(ValueFactory valueFactory, Object propValue)
 	{
 		if (propValue == null)
 		{
 			return null;
 		}
+        
 		double value = ((Double) propValue).doubleValue();
-		return this.getValueFactory().createValue(value);
+		return valueFactory.createValue(value);
 	}
 
     /**
@@ -90,9 +70,6 @@
 	 */
 	public String getStringValue(Object object)
 	{
-		
 		return object.toString();
-	}	
-
-
+	}
 }

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/IntTypeConverterImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/IntTypeConverterImpl.java?rev=375383&r1=375382&r2=375383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/IntTypeConverterImpl.java
(original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/IntTypeConverterImpl.java
Mon Feb  6 13:35:46 2006
@@ -22,48 +22,28 @@
 import javax.jcr.ValueFactory;
 
 import org.apache.portals.graffito.jcr.exception.IncorrectAtomicTypeException;
+import org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter;
 
 /**
  * Int Type Converter
  * 
  * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
- *
+ * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
  */
-public class IntTypeConverterImpl extends AbstractAtomicTypeConverterImpl
+public class IntTypeConverterImpl implements AtomicTypeConverter
 {
-    /**
-     * No-arg constructor.
-     * When using it you should provide later the <code>javax.jcr.ValueFactory</code>.
-     * 
-     * @see #setValueFactory(ValueFactory)
-     */
-    public IntTypeConverterImpl()
-    {
-        super();
-    }
-    
-	/**
-	 * Constructor
-	 * @param factory The JCR Value factory to used
-	 */
-	public IntTypeConverterImpl(ValueFactory factory)
-	{
-		super(factory);
-
-	}
-
 	/**
 	 * 
 	 * @see org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter#getValue(java.lang.Object)
 	 */
-	public Value getValue(Object propValue)
+	public Value getValue(ValueFactory valueFactory, Object propValue)
 	{
 		if (propValue == null)
 		{
 			return null;
 		}
 		long value = ((Integer) propValue).intValue();
-		return this.getValueFactory().createValue(value);
+		return valueFactory.createValue(value);
 	}
 
     /**
@@ -89,8 +69,6 @@
 	 */
 	public String getStringValue(Object object)
 	{
-		
 		return object.toString();
 	}
-
 }

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/LongTypeConverterImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/LongTypeConverterImpl.java?rev=375383&r1=375382&r2=375383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/LongTypeConverterImpl.java
(original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/LongTypeConverterImpl.java
Mon Feb  6 13:35:46 2006
@@ -22,42 +22,22 @@
 import javax.jcr.ValueFactory;
 
 import org.apache.portals.graffito.jcr.exception.IncorrectAtomicTypeException;
+import org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter;
 
 /**
  * 
  * Long Type Converter
  * 
  * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
- *
+ * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
  */
-public class LongTypeConverterImpl extends AbstractAtomicTypeConverterImpl
+public class LongTypeConverterImpl implements AtomicTypeConverter
 {
-    /**
-     * No-arg constructor.
-     * When using it you should provide later the <code>javax.jcr.ValueFactory</code>.
-     * 
-     * @see #setValueFactory(ValueFactory)
-     */
-    public LongTypeConverterImpl()
-    {
-        super();
-    }
-    
-	/**
-	 * Constructor
-	 * @param factory The JCR Value factory to used
-	 */
-	public LongTypeConverterImpl(ValueFactory factory)
-	{
-		super(factory);
-
-	}
-
 	/**
 	 * 
 	 * @see org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter#getValue(java.lang.Object)
 	 */
-	public Value getValue(Object propValue)
+	public Value getValue(ValueFactory valueFactory, Object propValue)
 	{
 		if (propValue == null)
 		{
@@ -65,7 +45,7 @@
 		}
 
 		long value = ((Long) propValue).longValue();
-		return this.getValueFactory().createValue(value);
+		return valueFactory.createValue(value);
 	}
 
     /**
@@ -91,8 +71,6 @@
 	 */
 	public String getStringValue(Object object)
 	{
-		
 		return object.toString();
 	}
-
 }

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/StringTypeConverterImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/StringTypeConverterImpl.java?rev=375383&r1=375382&r2=375383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/StringTypeConverterImpl.java
(original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/StringTypeConverterImpl.java
Mon Feb  6 13:35:46 2006
@@ -22,48 +22,28 @@
 import javax.jcr.ValueFactory;
 
 import org.apache.portals.graffito.jcr.exception.IncorrectAtomicTypeException;
+import org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter;
 
 /**
  * 
  * String Type Converter 
  * 
  * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
- *
+ * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
  */
-public class StringTypeConverterImpl extends AbstractAtomicTypeConverterImpl
+public class StringTypeConverterImpl implements AtomicTypeConverter
 {
-    /**
-     * No-arg constructor.
-     * When using it you should provide later the <code>javax.jcr.ValueFactory</code>.
-     * 
-     * @see #setValueFactory(ValueFactory)
-     */
-    public StringTypeConverterImpl()
-    {
-        super();
-    }
-    
-	/**
-	 * Constructor
-	 * @param factory The JCR Value factory to used
-	 */
-	public StringTypeConverterImpl(ValueFactory factory)
-	{
-		super(factory);
-
-	}
-
 	/**
 	 * 
 	 * @see org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter#getValue(java.lang.Object)
 	 */
-	public Value getValue(Object propValue)
+	public Value getValue(ValueFactory valueFactory, Object propValue)
 	{
 		if (propValue == null)
 		{
 			return null;
 		}
-		return this.getValueFactory().createValue((String) propValue);
+		return valueFactory.createValue((String) propValue);
 	}
 
     /**
@@ -89,8 +69,6 @@
 	 */
 	public String getStringValue(Object object)
 	{
-		
 		return "'" + object.toString() + "'";
-	}	
-
+	}
 }

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/TimestampTypeConverterImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/TimestampTypeConverterImpl.java?rev=375383&r1=375382&r2=375383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/TimestampTypeConverterImpl.java
(original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/TimestampTypeConverterImpl.java
Mon Feb  6 13:35:46 2006
@@ -24,47 +24,27 @@
 import javax.jcr.ValueFactory;
 
 import org.apache.portals.graffito.jcr.exception.IncorrectAtomicTypeException;
+import org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter;
 
 /**
  * 
  * Timestamp Type Converter
  * 
  * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
- *
+ * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
  */
-public class TimestampTypeConverterImpl extends AbstractAtomicTypeConverterImpl
+public class TimestampTypeConverterImpl implements AtomicTypeConverter
 {
-    /**
-     * No-arg constructor.
-     * When using it you should provide later the <code>javax.jcr.ValueFactory</code>.
-     * 
-     * @see #setValueFactory(ValueFactory)
-     */
-    public TimestampTypeConverterImpl()
-    {
-        super();
-    }
-    
-	/**
-	 * Constructor
-	 * @param factory The JCR Value factory to used
-	 */
-	public TimestampTypeConverterImpl(ValueFactory factory)
-	{
-		super(factory);
-
-	}
-
 	/**
 	 * 
 	 * @see org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter#getValue(java.lang.Object)
 	 */
-	public Value getValue(Object propValue)
+	public Value getValue(ValueFactory valueFactory, Object propValue)
 	{
 		if (propValue == null)
 			return null;
 		long value = ((Timestamp) propValue).getTime();
-		return this.getValueFactory().createValue(value);
+		return valueFactory.createValue(value);
 	}
 
     /**
@@ -90,8 +70,6 @@
 	 */
 	public String getStringValue(Object object)
 	{
-		
 		return new Long(((Timestamp) object).getTime()).toString();
 	}	
-
 }

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/UtilDateTypeConverterImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/UtilDateTypeConverterImpl.java?rev=375383&r1=375382&r2=375383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/UtilDateTypeConverterImpl.java
(original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/UtilDateTypeConverterImpl.java
Mon Feb  6 13:35:46 2006
@@ -24,47 +24,27 @@
 import javax.jcr.ValueFactory;
 
 import org.apache.portals.graffito.jcr.exception.IncorrectAtomicTypeException;
+import org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter;
 
 /**
  * Util Date Converter
  * 
  * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
- * 
+ * @author <a href='mailto:the_mindstorm[at]evolva[dot]ro'>Alexandru Popescu</a>
  */
-public class UtilDateTypeConverterImpl extends AbstractAtomicTypeConverterImpl
+public class UtilDateTypeConverterImpl implements AtomicTypeConverter
 {
-    /**
-     * No-arg constructor.
-     * When using it you should provide later the <code>javax.jcr.ValueFactory</code>.
-     * 
-     * @see #setValueFactory(ValueFactory)
-     */
-    public UtilDateTypeConverterImpl()
-    {
-        super();
-    }
-    
-	/**
-	 * Constructor
-	 * @param factory The JCR Value factory to used
-	 */
-	public UtilDateTypeConverterImpl(ValueFactory factory)
-	{
-		super(factory);
-
-	}
-
 	/**
 	 * 
 	 * @see org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter#getValue(java.lang.Object)
 	 */
-	public Value getValue(Object propValue)
+	public Value getValue(ValueFactory valueFactory, Object propValue)
 	{
 		if (propValue == null)
 		{
 			return null;
 		}
-		return this.getValueFactory().createValue(((java.util.Date) propValue).getTime());		
+		return valueFactory.createValue(((java.util.Date) propValue).getTime());		
 	}
 
 
@@ -78,7 +58,6 @@
 		{
 			long time = value.getLong();
 			return new Date(time);
-
 		}
 		catch (RepositoryException e)
 		{
@@ -93,8 +72,6 @@
 	 */
 	public String getStringValue(Object object)
 	{
-		
 		return new Long(((java.util.Date) object).getTime()).toString();
-	}	
-
+	}
 }

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/MultiValueCollectionConverterImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/MultiValueCollectionConverterImpl.java?rev=375383&r1=375382&r2=375383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/MultiValueCollectionConverterImpl.java
(original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/collectionconverter/impl/MultiValueCollectionConverterImpl.java
Mon Feb  6 13:35:46 2006
@@ -60,10 +60,8 @@
      */
     public void insertCollection(Session session, Node parentNode, CollectionDescriptor collectionDescriptor,
ManageableCollection collection) 
     {
-
         try
         {
-
             if (collection == null)
             {
                 return;
@@ -83,7 +81,7 @@
             {
                 Object fieldValue  = collectionIterator.next();
                 AtomicTypeConverter atomicTypeConverter = (AtomicTypeConverter) atomicTypeConverters.get(fieldValue.getClass());
-                values[i] = atomicTypeConverter.getValue(fieldValue);     
+                values[i] = atomicTypeConverter.getValue(session.getValueFactory(), fieldValue);
    
             }
             
             parentNode.setProperty(jcrName, values);
@@ -131,7 +129,7 @@
             {
                 Object fieldValue  = collectionIterator.next();
                 AtomicTypeConverter atomicTypeConverter = (AtomicTypeConverter) atomicTypeConverters.get(fieldValue.getClass());
-                values[i] = atomicTypeConverter.getValue(fieldValue);     
+                values[i] = atomicTypeConverter.getValue(session.getValueFactory(), fieldValue);
    
             }
             
             parentNode.setProperty(jcrName, values);

Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java?rev=375383&r1=375382&r2=375383&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java
(original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java
Mon Feb  6 13:35:46 2006
@@ -24,6 +24,7 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.Value;
+import javax.jcr.ValueFactory;
 import javax.jcr.ValueFormatException;
 import javax.jcr.lock.LockException;
 import javax.jcr.nodetype.ConstraintViolationException;
@@ -116,7 +117,7 @@
 			Node objectNode = null;
 			objectNode = parentNode.addNode(nodeName, jcrNodeType);
 
-			storeSimpleFields(object, classDescriptor, objectNode);
+			storeSimpleFields(session, object, classDescriptor, objectNode);
 			insertBeanFields(session, object, classDescriptor, objectNode);
 			insertCollectionFields(session, object, classDescriptor, objectNode);
 
@@ -171,7 +172,7 @@
 			Node objectNode = null;
 			objectNode = parentNode.getNode(nodeName);
 
-			storeSimpleFields(object, classDescriptor, objectNode);
+			storeSimpleFields(session, object, classDescriptor, objectNode);
 			updateBeanFields(session, object, classDescriptor, objectNode);
 			updateCollectionFields(session, object, classDescriptor, objectNode);
 
@@ -420,53 +421,54 @@
 
 	}
 
-	private void storeSimpleFields(Object object, ClassDescriptor classDescriptor, Node objectNode)

-	               throws PathNotFoundException, ValueFormatException, VersionException, LockException,
ConstraintViolationException, 
-	                      RepositoryException, IllegalAccessException, InvocationTargetException,
NoSuchMethodException
+	private void storeSimpleFields(Session session, 
+                                   Object object, 
+                                   ClassDescriptor classDescriptor, 
+                                   Node objectNode) 
+	throws PathNotFoundException, ValueFormatException, VersionException, LockException, ConstraintViolationException,

+	RepositoryException, IllegalAccessException, InvocationTargetException, NoSuchMethodException
 	{
+        ValueFactory valueFactory = session.getValueFactory();
+        
+		Iterator fieldDescriptorIterator = classDescriptor.getFieldDescriptors().iterator();
+		while (fieldDescriptorIterator.hasNext())
+		{				 
+			FieldDescriptor fieldDescriptor = (FieldDescriptor) fieldDescriptorIterator.next();
+			
+			//Of course, Path field is not updated as property				
+			if (fieldDescriptor.isPath())
+			{
+			   continue;	
+			}
+			
+			String fieldName = fieldDescriptor.getFieldName();
+			String jcrName = fieldDescriptor.getJcrName();
 
+			// Check the node properties
+			boolean autoCreated = false;
 
-			Iterator fieldDescriptorIterator = classDescriptor.getFieldDescriptors().iterator();
-			while (fieldDescriptorIterator.hasNext())
-			{				 
-				
-				FieldDescriptor fieldDescriptor = (FieldDescriptor) fieldDescriptorIterator.next();
-				
-				//Of course, Path field is not updated as property				
-				if (fieldDescriptor.isPath())
-				{
-				   continue;	
-				}
-				
-				String fieldName = fieldDescriptor.getFieldName();
-				String jcrName = fieldDescriptor.getJcrName();
-
-				// Check the node properties
-				boolean autoCreated = false;
-
-				if (objectNode.hasProperty(jcrName))
-				{
-					autoCreated = objectNode.getProperty(jcrName).getDefinition().isAutoCreated();
-				}
-
-				// All auto created JCR properties are ignored
-				if (!autoCreated)
-				{
-					
-					Object fieldValue = PropertyUtils.getNestedProperty(object, fieldName);
-					Class fieldTypeClass = fieldDescriptor.getFieldTypeClass() != null
-                        ? fieldDescriptor.getFieldTypeClass()
-                        : PropertyUtils.getPropertyType(object, fieldName);
-					AtomicTypeConverter converter = (AtomicTypeConverter) atomicTypeConverters.get(fieldTypeClass);
-					Value value = converter.getValue(fieldValue);
-					// Check if mandatory property are not null
-					this.checkMandatoryProperty(objectNode, fieldDescriptor, value);
+			if (objectNode.hasProperty(jcrName))
+			{
+				autoCreated = objectNode.getProperty(jcrName).getDefinition().isAutoCreated();
+			}
 
-					objectNode.setProperty(jcrName, value);
-				}
+			// All auto created JCR properties are ignored
+			if (!autoCreated)
+			{
+				
+				Object fieldValue = PropertyUtils.getNestedProperty(object, fieldName);
+				Class fieldTypeClass = fieldDescriptor.getFieldTypeClass() != null
+                    ? fieldDescriptor.getFieldTypeClass()
+                    : PropertyUtils.getPropertyType(object, fieldName);
+				AtomicTypeConverter converter = (AtomicTypeConverter) atomicTypeConverters.get(fieldTypeClass);
+				Value value = converter.getValue(valueFactory, fieldValue);
+				// Check if mandatory property are not null
+				this.checkMandatoryProperty(objectNode, fieldDescriptor, value);
 
+				objectNode.setProperty(jcrName, value);
 			}
 
+		}
 	}
 
 	private CollectionConverter getCollectionConverter(CollectionDescriptor collectionDescriptor)




Mime
View raw message