incubator-graffito-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clomb...@apache.org
Subject svn commit: r293437 - in /incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr: mapper/impl/ persistence/atomictypeconverter/ persistence/impl/ persistence/objectconverter/ query/ query/impl/
Date Mon, 03 Oct 2005 19:18:38 GMT
Author: clombart
Date: Mon Oct  3 12:18:20 2005
New Revision: 293437

URL: http://svn.apache.org/viewcvs?rev=293437&view=rev
Log:
* Apply patch provided by Costing
* Replace the AtomicTypeConverter by injection 
* Continue to work on search/querymanager

Added:
    incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/impl/DigesterDescriptorReader.java
      - copied, changed from r293153, incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/impl/DisgesterDescriptorReader.java
    incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/AbstarctAtomicTypeConverter.java
      - copied, changed from r290797, incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/AtomicTypeConverter.java
    incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/BinaryTypeConverter.java
    incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/BooleanTypeConverter.java
    incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/ByteArrayTypeConverter.java
    incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/CalendarTypeConverter.java
    incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/DoubleTypeConverter.java
    incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/IntTypeConverter.java
    incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/LongTypeConverter.java
    incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/StringTypeConverter.java
    incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/TimestampTypeConverter.java
    incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/UtilDateTypeConverter.java
Removed:
    incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/impl/DisgesterDescriptorReader.java
    incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/AtomicTypeConverter.java
    incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/AtomicTypeConverterFactory.java
Modified:
    incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/impl/DigesterMapperImpl.java
    incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerImpl.java
    incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/ObjectConverter.java
    incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/Filter.java
    incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/impl/FilterImpl.java
    incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/impl/QueryManagerImpl.java

Copied: incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/impl/DigesterDescriptorReader.java
(from r293153, incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/impl/DisgesterDescriptorReader.java)
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/impl/DigesterDescriptorReader.java?p2=incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/impl/DigesterDescriptorReader.java&p1=incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/impl/DisgesterDescriptorReader.java&r1=293153&r2=293437&rev=293437&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/impl/DisgesterDescriptorReader.java
(original)
+++ incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/impl/DigesterDescriptorReader.java
Mon Oct  3 12:18:20 2005
@@ -33,7 +33,7 @@
  * @author <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe
</a>
  * @version $Id: Exp $
  */
-public class DisgesterDescriptorReader {
+public class DigesterDescriptorReader {
     /**
      * Load all class descriptors found in the xml mapping file.
      * 

Modified: incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/impl/DigesterMapperImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/impl/DigesterMapperImpl.java?rev=293437&r1=293436&r2=293437&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/impl/DigesterMapperImpl.java
(original)
+++ incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/impl/DigesterMapperImpl.java
Mon Oct  3 12:18:20 2005
@@ -45,13 +45,13 @@
     public DigesterMapperImpl(String xmlFile) throws JcrMappingException
     {
         log.info("Read the xml mapping file : " +  xmlFile);
-        mappingDescriptor = DisgesterDescriptorReader.loadClassDescriptors(xmlFile);
+        mappingDescriptor = DigesterDescriptorReader.loadClassDescriptors(xmlFile);
     }
     
     public DigesterMapperImpl(InputStream stream) throws JcrMappingException
     {
         log.info("Read the input stream : " +  stream);
-        mappingDescriptor = DisgesterDescriptorReader.loadClassDescriptors(stream);
+        mappingDescriptor = DigesterDescriptorReader.loadClassDescriptors(stream);
     }
 
     /**

Copied: incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/AbstarctAtomicTypeConverter.java
(from r290797, incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/AtomicTypeConverter.java)
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/AbstarctAtomicTypeConverter.java?p2=incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/AbstarctAtomicTypeConverter.java&p1=incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/AtomicTypeConverter.java&r1=290797&r2=293437&rev=293437&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/AtomicTypeConverter.java
(original)
+++ incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/AbstarctAtomicTypeConverter.java
Mon Oct  3 12:18:20 2005
@@ -42,10 +42,18 @@
  * ObjectToItemConverter)?
  * @ToDo: Integrate "null" value handling.
  */
-public abstract class AtomicTypeConverter {
+public abstract class AbstarctAtomicTypeConverter {
 
 
 	private ValueFactory valueFactory;
+
+	
+	public AbstarctAtomicTypeConverter(ValueFactory factory)
+	{
+		super();
+		
+		valueFactory = factory;
+	}
 
 	public abstract String getPropertyType();
 	

Added: incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/BinaryTypeConverter.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/BinaryTypeConverter.java?rev=293437&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/BinaryTypeConverter.java
(added)
+++ incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/BinaryTypeConverter.java
Mon Oct  3 12:18:20 2005
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * 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.portals.graffito.jcr.persistence.atomictypeconverter;
+
+import java.io.InputStream;
+
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.ValueFactory;
+import javax.jcr.ValueFormatException;
+
+/**
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ *
+ */
+public class BinaryTypeConverter extends AbstarctAtomicTypeConverter
+{
+	
+	public BinaryTypeConverter(ValueFactory factory)
+	{
+		super(factory);
+		
+	}
+
+	public String getPropertyType()
+    {
+        return PropertyType.TYPENAME_BINARY;
+    }
+
+    public Value getJcrValueFromJavaObject(Object propValue)
+    {
+        if (propValue == null)
+            return null;
+        return this.getValueFactory().createValue((InputStream) propValue);
+    }
+
+    public Object getJavaObjectFromJcr(Node node, String jcrPropName) throws ValueFormatException,
PathNotFoundException,
+            RepositoryException
+    {
+        if (node.hasProperty(jcrPropName) == true)
+        {
+            return node.getProperty(jcrPropName).getStream();
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    public Class[] getJavaTypes()
+    {
+        Class[] javaTypes =
+        { InputStream.class };
+        return javaTypes;
+    }
+
+}

Added: incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/BooleanTypeConverter.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/BooleanTypeConverter.java?rev=293437&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/BooleanTypeConverter.java
(added)
+++ incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/BooleanTypeConverter.java
Mon Oct  3 12:18:20 2005
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * 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.portals.graffito.jcr.persistence.atomictypeconverter;
+
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.ValueFactory;
+import javax.jcr.ValueFormatException;
+
+/**
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ *
+ */
+public class BooleanTypeConverter extends AbstarctAtomicTypeConverter
+{
+	
+    public BooleanTypeConverter(ValueFactory factory)
+	{
+		super(factory);
+		
+	}
+
+	public String getPropertyType()
+    {
+        return PropertyType.TYPENAME_BOOLEAN;
+    }
+
+    public Value getJcrValueFromJavaObject(Object propValue)
+    {
+        if (propValue == null)
+            return null;
+        boolean value = ((Boolean) propValue).booleanValue();
+        return this.getValueFactory().createValue(value);
+    }
+
+    public Object getJavaObjectFromJcr(Node node, String jcrPropName) throws ValueFormatException,
PathNotFoundException,
+            RepositoryException
+    {
+        if (node.hasProperty(jcrPropName) == true)
+        {
+            boolean aBoolean = node.getProperty(jcrPropName).getBoolean();
+            return new Boolean(aBoolean);
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    public Class[] getJavaTypes()
+    {
+        Class[] javaTypes =
+        { Boolean.class, boolean.class };
+        return javaTypes;
+    }
+
+
+}

Added: incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/ByteArrayTypeConverter.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/ByteArrayTypeConverter.java?rev=293437&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/ByteArrayTypeConverter.java
(added)
+++ incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/ByteArrayTypeConverter.java
Mon Oct  3 12:18:20 2005
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * 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.portals.graffito.jcr.persistence.atomictypeconverter;
+
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.ValueFactory;
+import javax.jcr.ValueFormatException;
+
+/**
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ *
+ */
+public class ByteArrayTypeConverter extends AbstarctAtomicTypeConverter
+{
+	
+	public ByteArrayTypeConverter(ValueFactory factory)
+	{
+		super(factory);
+		
+	}
+
+	public String getPropertyType()
+    {
+        return PropertyType.TYPENAME_STRING;
+    }
+
+    public Value getJcrValueFromJavaObject(Object propValue)
+    {
+        if (propValue == null)
+            return null;
+        String value = new String((byte[]) propValue);
+        return getValueFactory().createValue(value);
+    }
+
+    public Object getJavaObjectFromJcr(Node node, String jcrPropName) throws ValueFormatException,
PathNotFoundException,
+            RepositoryException
+    {
+        if (node.hasProperty(jcrPropName) == true)
+        {
+            byte[] value = node.getProperty(jcrPropName).getString().getBytes();
+            return value;
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    public Class[] getJavaTypes()
+    {
+        Class[] javaTypes =
+        { byte[].class };
+        return javaTypes;
+    }
+
+
+}

Added: incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/CalendarTypeConverter.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/CalendarTypeConverter.java?rev=293437&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/CalendarTypeConverter.java
(added)
+++ incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/CalendarTypeConverter.java
Mon Oct  3 12:18:20 2005
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * 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.portals.graffito.jcr.persistence.atomictypeconverter;
+
+import java.util.Calendar;
+
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.ValueFactory;
+import javax.jcr.ValueFormatException;
+
+/**
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ *
+ */
+public class CalendarTypeConverter extends AbstarctAtomicTypeConverter
+{
+	
+	public CalendarTypeConverter(ValueFactory factory)
+	{
+		super(factory);
+		
+	}
+
+	public String getPropertyType()
+    {
+        return PropertyType.TYPENAME_DATE;
+    }
+
+    public Value getJcrValueFromJavaObject(Object propValue)
+    {
+        if (propValue == null)
+            return null;
+        return this.getValueFactory().createValue(((Calendar) propValue).getTimeInMillis());
+        
+    }
+
+    public Object getJavaObjectFromJcr(Node node, String jcrPropName) throws ValueFormatException,
PathNotFoundException,
+            RepositoryException
+    {
+        if (node.hasProperty(jcrPropName) == true)
+        {
+        	Calendar calendar = Calendar.getInstance();
+        	calendar.setTimeInMillis(node.getProperty(jcrPropName).getLong());
+            return calendar;
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    public Class[] getJavaTypes()
+    {
+        Class[] javaTypes =
+        { Calendar.class };
+        return javaTypes;
+    }
+}

Added: incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/DoubleTypeConverter.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/DoubleTypeConverter.java?rev=293437&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/DoubleTypeConverter.java
(added)
+++ incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/DoubleTypeConverter.java
Mon Oct  3 12:18:20 2005
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * 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.portals.graffito.jcr.persistence.atomictypeconverter;
+
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.ValueFactory;
+import javax.jcr.ValueFormatException;
+
+/**
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ *
+ */
+public class DoubleTypeConverter extends AbstarctAtomicTypeConverter
+{
+	
+    public DoubleTypeConverter(ValueFactory factory)
+	{
+		super(factory);
+		
+	}
+
+	public String getPropertyType()
+    {
+        return PropertyType.TYPENAME_DOUBLE;
+    }
+
+    public Value getJcrValueFromJavaObject(Object propValue)
+    {
+        if (propValue == null)
+            return null;
+        double value = ((Double) propValue).doubleValue();
+        return this.getValueFactory().createValue(value);
+    }
+
+    public Object getJavaObjectFromJcr(Node node, String jcrPropName) throws ValueFormatException,
PathNotFoundException,
+            RepositoryException
+    {
+        if (node.hasProperty(jcrPropName) == true)
+        {
+            double beanPropValue = node.getProperty(jcrPropName).getDouble();
+            return new Double(beanPropValue);
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    public Class[] getJavaTypes()
+    {
+        Class[] javaTypes =
+        { Double.class, double.class };
+        return javaTypes;
+    }
+
+}

Added: incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/IntTypeConverter.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/IntTypeConverter.java?rev=293437&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/IntTypeConverter.java
(added)
+++ incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/IntTypeConverter.java
Mon Oct  3 12:18:20 2005
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * 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.portals.graffito.jcr.persistence.atomictypeconverter;
+
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.ValueFactory;
+import javax.jcr.ValueFormatException;
+
+/**
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ *
+ */
+public class IntTypeConverter extends AbstarctAtomicTypeConverter
+{
+	
+    public IntTypeConverter(ValueFactory factory)
+	{
+		super(factory);
+		
+	}
+
+	public String getPropertyType()
+    {
+        return PropertyType.TYPENAME_LONG;
+    }
+
+    public Value getJcrValueFromJavaObject(Object propValue)
+    {
+        if (propValue == null)
+            return null;
+        long value = ((Integer) propValue).intValue();
+        return this.getValueFactory().createValue(value);
+    }
+
+    public Object getJavaObjectFromJcr(Node node, String jcrPropName) throws ValueFormatException,
PathNotFoundException,
+            RepositoryException
+    {
+        if (node.hasProperty(jcrPropName) == true)
+        {
+            int beanPropValue = (int) node.getProperty(jcrPropName).getLong();
+            return new Integer(beanPropValue);
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    public Class[] getJavaTypes()
+    {
+        Class[] javaTypes =
+        { Integer.class, int.class };
+        return javaTypes;
+    }
+
+
+}

Added: incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/LongTypeConverter.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/LongTypeConverter.java?rev=293437&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/LongTypeConverter.java
(added)
+++ incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/LongTypeConverter.java
Mon Oct  3 12:18:20 2005
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * 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.portals.graffito.jcr.persistence.atomictypeconverter;
+
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.ValueFactory;
+import javax.jcr.ValueFormatException;
+
+/**
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ *
+ */
+public class LongTypeConverter extends AbstarctAtomicTypeConverter
+{
+    
+	public LongTypeConverter(ValueFactory factory)
+	{
+		super(factory);
+		
+	}
+
+	public String getPropertyType()
+    {
+        return PropertyType.TYPENAME_LONG;
+    }
+
+    public Value getJcrValueFromJavaObject(Object propValue)
+    {
+        if (propValue == null)
+            return null;
+        long value = ((Long) propValue).longValue();
+        return this.getValueFactory().createValue(value);
+    }
+
+    public Object getJavaObjectFromJcr(Node node, String jcrPropName) throws ValueFormatException,
PathNotFoundException,
+            RepositoryException
+    {
+        if (node.hasProperty(jcrPropName) == true)
+        {
+            long beanPropValue = node.getProperty(jcrPropName).getLong();
+            return new Long(beanPropValue);
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    public Class[] getJavaTypes()
+    {
+        Class[] javaTypes =
+        { Long.class, long.class };
+        return javaTypes;
+    }
+
+}

Added: incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/StringTypeConverter.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/StringTypeConverter.java?rev=293437&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/StringTypeConverter.java
(added)
+++ incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/StringTypeConverter.java
Mon Oct  3 12:18:20 2005
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * 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.portals.graffito.jcr.persistence.atomictypeconverter;
+
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.ValueFactory;
+import javax.jcr.ValueFormatException;
+
+/**
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ *
+ */
+public class StringTypeConverter extends AbstarctAtomicTypeConverter
+{
+	
+	
+	public StringTypeConverter(ValueFactory factory)
+	{
+		super(factory);
+		
+	}
+
+	public String getPropertyType()
+    {
+        return PropertyType.TYPENAME_STRING;
+    }
+
+    public Value getJcrValueFromJavaObject(Object propValue)
+    {
+        if (propValue == null)
+            return null;
+        return this.getValueFactory().createValue((String) propValue);
+    }
+
+    public Object getJavaObjectFromJcr(Node node, String jcrPropName) throws ValueFormatException,
PathNotFoundException,
+            RepositoryException
+    {
+        if (node.hasProperty(jcrPropName) == true)
+        {
+            return node.getProperty(jcrPropName).getString();
+        }
+        else
+        {
+            return null;
+        }
+
+    }
+
+    public Class[] getJavaTypes()
+    {
+        Class[] javaTypes =
+        { String.class };
+        return javaTypes;
+    }
+
+
+
+}

Added: incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/TimestampTypeConverter.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/TimestampTypeConverter.java?rev=293437&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/TimestampTypeConverter.java
(added)
+++ incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/TimestampTypeConverter.java
Mon Oct  3 12:18:20 2005
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * 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.portals.graffito.jcr.persistence.atomictypeconverter;
+
+import java.sql.Timestamp;
+
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.ValueFactory;
+import javax.jcr.ValueFormatException;
+
+/**
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ *
+ */
+public class TimestampTypeConverter extends AbstarctAtomicTypeConverter
+{
+	
+	
+    public TimestampTypeConverter(ValueFactory factory)
+	{
+		super(factory);
+		
+	}
+
+	public String getPropertyType()
+    {
+        return PropertyType.TYPENAME_LONG;
+    }
+
+    public Value getJcrValueFromJavaObject(Object propValue)
+    {
+        if (propValue == null)
+            return null;
+        long value = ((Timestamp) propValue).getTime();
+        return this.getValueFactory().createValue(value);
+    }
+
+    public Object getJavaObjectFromJcr(Node node, String jcrPropName) throws ValueFormatException,
PathNotFoundException,
+            RepositoryException
+    {
+        if (node.hasProperty(jcrPropName) == true)
+        {
+            long beanPropValue = node.getProperty(jcrPropName).getLong();
+            return new Timestamp(beanPropValue);
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+    public Class[] getJavaTypes()
+    {
+        Class[] javaTypes = { Timestamp.class };
+        return javaTypes;
+    }
+
+
+
+}

Added: incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/UtilDateTypeConverter.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/UtilDateTypeConverter.java?rev=293437&view=auto
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/UtilDateTypeConverter.java
(added)
+++ incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/UtilDateTypeConverter.java
Mon Oct  3 12:18:20 2005
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * 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.portals.graffito.jcr.persistence.atomictypeconverter;
+
+import java.util.Date;
+
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.ValueFactory;
+import javax.jcr.ValueFormatException;
+
+/**
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ *
+ */
+public class UtilDateTypeConverter extends AbstarctAtomicTypeConverter
+{
+
+	public UtilDateTypeConverter(ValueFactory factory)
+	{
+		super(factory);
+
+	}
+
+	public String getPropertyType()
+	{
+		return PropertyType.TYPENAME_DATE;
+	}
+
+	public Value getJcrValueFromJavaObject(Object propValue)
+	{
+		if (propValue == null)
+			return null;
+		return this.getValueFactory().createValue(((java.util.Date) propValue).getTime());
+	}
+
+public Object getJavaObjectFromJcr(Node node, String jcrPropName) throws ValueFormatException,
PathNotFoundException,
+            RepositoryException
+    {
+        if (node.hasProperty(jcrPropName) == true)
+        {
+            long time = node.getProperty(jcrPropName).getLong();
+            Date date = new Date(time);
+            
+            return date;
+        }
+        else
+        {
+            return null;
+        }
+    }	public Class[] getJavaTypes()
+	{
+		Class[] javaTypes =
+		{ java.util.Date.class };
+		return javaTypes;
+	}
+
+}

Modified: incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerImpl.java?rev=293437&r1=293436&r2=293437&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerImpl.java
(original)
+++ incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/impl/PersistenceManagerImpl.java
Mon Oct  3 12:18:20 2005
@@ -17,26 +17,20 @@
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Map;
 
 import javax.jcr.Item;
 import javax.jcr.Node;
 import javax.jcr.NodeIterator;
-import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
-import javax.jcr.query.QueryManager;
 import javax.jcr.query.QueryResult;
-import javax.jcr.query.Row;
-import javax.jcr.query.RowIterator;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.portals.graffito.jcr.exception.JcrMappingException;
 import org.apache.portals.graffito.jcr.mapper.Mapper;
-import org.apache.portals.graffito.jcr.mapper.impl.DigesterMapperImpl;
-import org.apache.portals.graffito.jcr.persistence.CustomNodeTypeCreator;
 import org.apache.portals.graffito.jcr.persistence.PersistenceManager;
-import org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverterFactory;
 import org.apache.portals.graffito.jcr.persistence.objectconverter.ObjectConverter;
 import org.apache.portals.graffito.jcr.query.Query;
 
@@ -53,27 +47,14 @@
 	 */
 	private final static Log log = LogFactory.getLog(PersistenceManagerImpl.class);
 
-	/** 
-	 * Jackrabbit jcr repository.
-	 */
-	private Repository repository;
 
 	/** Jackrabbit jcr session.
 	 */
 	private Session session;
 
-	/**
-	 * The Mapper component
-	 */
-	private Mapper mapper;
 
 	org.apache.portals.graffito.jcr.query.QueryManager queryManager;
 
-	/**
-	 * The Atomic Type Converter Factory
-	 */
-	private AtomicTypeConverterFactory atomicTypeConverterFactory;
-
 	 
 	/**
 	 * Object Converter
@@ -89,15 +70,12 @@
 	 * 
 	 * @throws JcrMappingException when it is impossible to create the PersistenceManager
 	 */
-	public PersistenceManagerImpl(Mapper mapper, org.apache.portals.graffito.jcr.query.QueryManager
queryManager, Repository repository, Session session) throws JcrMappingException
+	public PersistenceManagerImpl(Mapper mapper, Map atomicTypeConverters, org.apache.portals.graffito.jcr.query.QueryManager
queryManager, Session session) throws JcrMappingException
 	{
 		try
 		{
-			this.mapper = mapper;
-			this.repository = repository;
 			this.session = session;
-			this.atomicTypeConverterFactory = AtomicTypeConverterFactory.getInstance(session.getValueFactory());
-			this.objectConverter = new ObjectConverter(mapper, atomicTypeConverterFactory);
+			this.objectConverter = new ObjectConverter(mapper, atomicTypeConverters);
 			this.queryManager = queryManager;
 		}
 		catch (Exception e)
@@ -251,6 +229,11 @@
 		{
 			throw new JcrMappingException("Impossible to logout", e);
 		}
+	}
+	
+	public Session getSession()
+	{
+		return this.session;
 	}
 
 }

Modified: incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/ObjectConverter.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/ObjectConverter.java?rev=293437&r1=293436&r2=293437&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/ObjectConverter.java
(original)
+++ incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/ObjectConverter.java
Mon Oct  3 12:18:20 2005
@@ -16,8 +16,8 @@
 package org.apache.portals.graffito.jcr.persistence.objectconverter;
 
 import java.lang.reflect.InvocationTargetException;
-import java.util.Collection;
 import java.util.Iterator;
+import java.util.Map;
 
 import javax.jcr.Node;
 import javax.jcr.PathNotFoundException;
@@ -35,8 +35,7 @@
 import org.apache.portals.graffito.jcr.mapper.model.ClassDescriptor;
 import org.apache.portals.graffito.jcr.mapper.model.CollectionDescriptor;
 import org.apache.portals.graffito.jcr.mapper.model.FieldDescriptor;
-import org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter;
-import org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverterFactory;
+import org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AbstarctAtomicTypeConverter;
 import org.apache.portals.graffito.jcr.persistence.collectionconverter.CollectionConverter;
 import org.apache.portals.graffito.jcr.persistence.collectionconverter.ManageableCollection;
 import org.apache.portals.graffito.jcr.persistence.collectionconverter.ManageableCollectionUtil;
@@ -52,12 +51,12 @@
 public class ObjectConverter
 {
     private Mapper mapper;
-    private AtomicTypeConverterFactory atomicTypeConverterFactory;
+    private Map atomicTypeConverters;
 
-    public ObjectConverter(Mapper mapper, AtomicTypeConverterFactory atomicTypeConverterFactory)
+    public ObjectConverter(Mapper mapper, Map atomicTypeConverters)
     {
         this.mapper = mapper;
-        this.atomicTypeConverterFactory = atomicTypeConverterFactory;
+        this.atomicTypeConverters = atomicTypeConverters;
     }
 
     /**
@@ -161,7 +160,7 @@
             String fieldName = fieldDescriptor.getFieldName();
             String propertyName = fieldDescriptor.getJcrName();
             
-            AtomicTypeConverter converter = atomicTypeConverterFactory.getJCRTypeConverter(PropertyUtils.getPropertyType(object,
fieldName));
+            AbstarctAtomicTypeConverter converter = (AbstarctAtomicTypeConverter) atomicTypeConverters.get(PropertyUtils.getPropertyType(object,
fieldName));
             Object fieldValue = converter.getJavaObjectFromJcr(node, propertyName);
             
             PropertyUtils.setNestedProperty(object, fieldName, fieldValue);
@@ -403,8 +402,8 @@
                 if (! autoCreated)
                 {
                    Object fieldValue = PropertyUtils.getNestedProperty(object, fieldName);
               
-                
-                   AtomicTypeConverter converter = atomicTypeConverterFactory.getJCRTypeConverter(PropertyUtils.getPropertyType(object,
fieldName));
+                                   
+                   AbstarctAtomicTypeConverter converter = (AbstarctAtomicTypeConverter)
atomicTypeConverters.get(PropertyUtils.getPropertyType(object, fieldName));
                    Value value = converter.getJcrValueFromJavaObject(fieldValue);
                    // Check if mandatory property are not null
                    this.checkMandatoryProperty(objectNode, fieldDescriptor, value);

Modified: incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/Filter.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/Filter.java?rev=293437&r1=293436&r2=293437&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/Filter.java
(original)
+++ incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/Filter.java
Mon Oct  3 12:18:20 2005
@@ -51,9 +51,10 @@
      * Search content based on a fullTextSearch. 
      * Depending on the full text search engine, you can also filter on properties.
      * 
+     * @scope either a a jcr node or propserty. If a node is used, all properties of this
node are searche (following the internal index
      * @param fullTextSearch The full text search string  
      */
-    public void addContains(String fullTextSearch);
+    public void addContains(String scope, String fullTextSearch);
    
         
 	public void addBetween(String arg0, Object arg1, Object arg2);

Modified: incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/impl/FilterImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/impl/FilterImpl.java?rev=293437&r1=293436&r2=293437&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/impl/FilterImpl.java
(original)
+++ incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/impl/FilterImpl.java
Mon Oct  3 12:18:20 2005
@@ -91,9 +91,18 @@
 	/**
 	 * @see org.apache.portals.graffito.jcr.query.Filter#addContains(java.lang.String)
 	 */
-	public void addContains(String fullTextSearch)
+	public void addContains(String scope, String fullTextSearch)
 	{
-		String jcrExpression = "jcr:contains(., '" + fullTextSearch + "')";
+		String jcrExpression = null;
+		if (scope.equals("."))
+		{
+		     jcrExpression = "jcr:contains(., '" + fullTextSearch + "')";
+		}
+		else
+		{
+			jcrExpression = "jcr:contains(@" + this.getJcrFieldName(scope) + ", '" + fullTextSearch
+ "')";
+		}
+		
 		jcrExpressions.add(jcrExpression);
 	}
 
@@ -244,25 +253,15 @@
 			{
 			    if ((value instanceof Calendar))
 			    {			    	
-			    	Calendar calendar = (Calendar) value;			        
-			        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T00:00:00.000+01:00'");
-			        formatter.setCalendar(calendar);
-			         
-			         String formattedString = "'" + formatter.format(calendar.getTime()) + "'";
-			         return formattedString;
+			    	Calendar calendar = (Calendar) value;
+			    	return new Long(calendar.getTimeInMillis()).toString();			    	
 			    }
 			    else
 			    {
 			    	if (value instanceof Date)
 			    	{
 			    		Date date = (Date) value;		        
-				        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T00:00:00.000+01:00'");
-				        Calendar calendar = Calendar.getInstance();
-				        calendar.setTime(date);
-				        formatter.setCalendar(calendar);
-				         
-				         String formattedString = "'" + formatter.format(calendar.getTime()) + "'";
-				         return formattedString;			    		
+			    		return new Long(date.getTime()).toString();
 			    		
 			    	}
 			    	

Modified: incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/impl/QueryManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/impl/QueryManagerImpl.java?rev=293437&r1=293436&r2=293437&view=diff
==============================================================================
--- incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/impl/QueryManagerImpl.java
(original)
+++ incubator/graffito/trunk/jcr-mapping/src/java/org/apache/portals/graffito/jcr/query/impl/QueryManagerImpl.java
Mon Oct  3 12:18:20 2005
@@ -48,7 +48,11 @@
 		jcrExp += "//element(*, "  + this.getNodeType(filter) + ") ";
 
         // Add filter criteria
-		jcrExp += "[" + ((FilterImpl)filter).getJcrExpression() + "]";
+		String filterExp = ((FilterImpl)filter).getJcrExpression();
+		if ((filterExp != null) && ( ! filterExp.equals("")))
+		{
+		    jcrExp += "[" + filterExp + "]";
+		}
 		
 		// Add order by
 		jcrExp += ((QueryImpl)query).getOrderByExpression();



Mime
View raw message