You are viewing a plain text version of this content. The canonical link for it is here.
Posted to graffito-commits@incubator.apache.org by cl...@apache.org on 2007/03/06 21:03:36 UTC
svn commit: r515299 - in /incubator/graffito/trunk/jcr/jcr-mapping/src: dtd/
java/org/apache/portals/graffito/jcr/mapper/model/
java/org/apache/portals/graffito/jcr/persistence/
java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/...
Author: clombart
Date: Tue Mar 6 13:03:34 2007
New Revision: 515299
URL: http://svn.apache.org/viewvc?view=rev&rev=515299
Log:
continue to work GRFT-40
Added:
incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/ReferenceTypeConverterImpl.java
incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/UndefinedTypeConverterImpl.java
incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-uuid.xml
incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/uuid/
incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/uuid/PersistenceManagerUuidTest.java
incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/uuid/
incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/uuid/A.java
incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/uuid/B.java
Modified:
incubator/graffito/trunk/jcr/jcr-mapping/src/dtd/graffito-jcr-mapping.dtd
incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/model/ClassDescriptor.java
incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/model/FieldDescriptor.java
incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/PersistenceManager.java
incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/PathTypeConverterImpl.java
incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java
incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/SimpleFieldsHelper.java
incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-atomic.xml
incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-testdigester.xml
incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/TestBase.java
incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/mapper/DigesterMapperImplTest.java
incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomic/AtomicTest.java
incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/beanconverter/BeanDescriptorTest.java
incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/Atomic.java
Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/dtd/graffito-jcr-mapping.dtd
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/dtd/graffito-jcr-mapping.dtd?view=diff&rev=515299&r1=515298&r2=515299
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/dtd/graffito-jcr-mapping.dtd (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/dtd/graffito-jcr-mapping.dtd Tue Mar 6 13:03:34 2007
@@ -60,7 +60,8 @@
* fieldType: the primitive type or fully qualified class name of the field (optional)
* jcrName : the jcr property name (optional). If it is not defined, fieldname is used to specify the jcr property name
* id : specifies if the field is an id. Id is optional. If the class contains an id field, some process can run faster
- * path : specified if the fiels is the object path
+ * path : specified if the field is the object path
+ * uuid : specified if the field is the object uuid
* converter : AtomicTypeConverter class name to used for this field descriptor. If not defined, a default one is provided by default in function of the field type
* jcrType: specifies the JCR property type (supported jcr property types: STRING, DATE, LONG, DOUBLE, BOOLEAN), optional
* jcrAutoCreated: specifies if this JCR property will be autocreated (true/false / default is false), optional
@@ -77,6 +78,7 @@
jcrName CDATA #IMPLIED
id (true | false) "false"
path (true | false) "false"
+ uuid (true | false) "false"
converter CDATA #IMPLIED
jcrType (String | Date | Long | Double | Boolean | Binary) #IMPLIED
jcrAutoCreated (true | false) "false"
Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/model/ClassDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/model/ClassDescriptor.java?view=diff&rev=515299&r1=515298&r2=515299
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/model/ClassDescriptor.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/model/ClassDescriptor.java Tue Mar 6 13:03:34 2007
@@ -53,6 +53,7 @@
private String[] jcrMixinTypes = new String[0];
private FieldDescriptor idFieldDescriptor;
private FieldDescriptor pathFieldDescriptor;
+ private FieldDescriptor uuidFieldDescriptor;
private Map fieldDescriptors = new HashMap();
private Map beanDescriptors = new HashMap();
@@ -147,6 +148,9 @@
if (fieldDescriptor.isPath()) {
this.pathFieldDescriptor = fieldDescriptor;
}
+ if (fieldDescriptor.isUuid()) {
+ this.uuidFieldDescriptor = fieldDescriptor;
+ }
fieldDescriptors.put(fieldDescriptor.getFieldName(), fieldDescriptor);
fieldNames.put(fieldDescriptor.getFieldName(), fieldDescriptor.getJcrName());
@@ -253,6 +257,20 @@
return null;
}
+ /**
+ * @return the fieldDescriptor path
+ */
+ public FieldDescriptor getUuidFieldDescriptor() {
+ if (null != this.uuidFieldDescriptor) {
+ return this.uuidFieldDescriptor;
+ }
+
+ if (null != this.superClassDescriptor) {
+ return this.superClassDescriptor.getUuidFieldDescriptor();
+ }
+
+ return null;
+ }
/**
* Check if this class has an ID
Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/model/FieldDescriptor.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/model/FieldDescriptor.java?view=diff&rev=515299&r1=515298&r2=515299
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/model/FieldDescriptor.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/mapper/model/FieldDescriptor.java Tue Mar 6 13:03:34 2007
@@ -42,6 +42,7 @@
private ClassDescriptor classDescriptor;
private boolean id;
private boolean path;
+ private boolean uuid;
private String converter;
@@ -169,6 +170,20 @@
this.path = path;
}
+ /**
+ * @return Returns true if the field is the UUID.
+ */
+ public boolean isUuid() {
+ return uuid;
+ }
+
+ /**
+ * @param path The path to set.
+ */
+ public void setUuid(boolean uuid) {
+ this.uuid = uuid;
+ }
+
/** Getter for property jcrType.
*
* @return jcrType
Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/PersistenceManager.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/PersistenceManager.java?view=diff&rev=515299&r1=515298&r2=515299
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/PersistenceManager.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/PersistenceManager.java Tue Mar 6 13:03:34 2007
@@ -112,7 +112,7 @@
*
* @throws PersistenceException when it is not possible to retrieve the object
*/
- public Object getObject(Class objectClass, String path, String versionNumber) throws PersistenceException;
+ public Object getObject(Class objectClass, String path, String versionNumber) throws PersistenceException;
/**
Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/PathTypeConverterImpl.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/PathTypeConverterImpl.java?view=diff&rev=515299&r1=515298&r2=515299
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/PathTypeConverterImpl.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/PathTypeConverterImpl.java Tue Mar 6 13:03:34 2007
@@ -50,7 +50,7 @@
}
catch (RepositoryException e)
{
- throw new IncorrectAtomicTypeException("Impossible to convert the value : " + propValue.toString(), e);
+ throw new IncorrectAtomicTypeException("Impossible to convert the value into a path property : " + propValue.toString() + ". Check if it is a valid path.", e);
}
}
@@ -67,7 +67,7 @@
}
catch (RepositoryException e)
{
- throw new IncorrectAtomicTypeException("Impossible to convert the value : " + value.toString(), e);
+ throw new IncorrectAtomicTypeException("Impossible to convert the path into a string", e);
}
}
Added: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/ReferenceTypeConverterImpl.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/ReferenceTypeConverterImpl.java?view=auto&rev=515299
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/ReferenceTypeConverterImpl.java (added)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/ReferenceTypeConverterImpl.java Tue Mar 6 13:03:34 2007
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.impl;
+
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+import javax.jcr.ValueFactory;
+
+import org.apache.portals.graffito.jcr.exception.IncorrectAtomicTypeException;
+import org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter;
+
+/**
+ *
+ * Reference Type Converter(java string attribute into a JCR property based on the REFERENCE type)
+ *
+ *
+ * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a>
+ *
+ */
+public class ReferenceTypeConverterImpl implements AtomicTypeConverter
+{
+ /**
+ *
+ * @see org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter#getValue(java.lang.Object)
+ */
+ public Value getValue(ValueFactory valueFactory, Object propValue)
+ {
+ try
+ {
+ if (propValue == null)
+ {
+ return null;
+ }
+ return valueFactory.createValue((String) propValue, PropertyType.REFERENCE);
+ }
+ catch (RepositoryException e)
+ {
+ throw new IncorrectAtomicTypeException("Impossible to convert the value into a reference property : " + propValue.toString() + ". Check if it is a correct uuid", e);
+ }
+
+ }
+
+ /**
+ *
+ * @see org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter#getObject(javax.jcr.Value)
+ */
+ public Object getObject(Value value)
+ {
+ try
+ {
+ return value.getString();
+ }
+ catch (RepositoryException e)
+ {
+ throw new IncorrectAtomicTypeException("Impossible to convert the uuid into a string ", e);
+ }
+
+ }
+
+ /**
+ *
+ * @see org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter#getStringValue(java.lang.Object)
+ */
+ public String getStringValue(Object object)
+ {
+ return "'" + object.toString() + "'";
+ }
+}
Added: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/UndefinedTypeConverterImpl.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/UndefinedTypeConverterImpl.java?view=auto&rev=515299
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/UndefinedTypeConverterImpl.java (added)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/atomictypeconverter/impl/UndefinedTypeConverterImpl.java Tue Mar 6 13:03:34 2007
@@ -0,0 +1,186 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.impl;
+
+import java.io.InputStream;
+import java.sql.Timestamp;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.Value;
+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 UndefinedTypeConverterImpl implements AtomicTypeConverter
+{
+ /**
+ *
+ * @see org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter#getValue(java.lang.Object)
+ */
+ public Value getValue(ValueFactory valueFactory, Object propValue)
+ {
+
+ if (propValue == null)
+ {
+ return null;
+ }
+
+ if (propValue.getClass() == String.class)
+ {
+ return valueFactory.createValue((String) propValue);
+ }
+
+ if (propValue.getClass() == InputStream.class)
+ {
+ return valueFactory.createValue((InputStream) propValue);
+ }
+
+ if ((propValue.getClass() == Long.class) ||(propValue.getClass() == Integer.class))
+ {
+ return valueFactory.createValue((Long) propValue);
+ }
+
+ if (propValue.getClass() == Double.class )
+ {
+ return valueFactory.createValue((Double) propValue);
+ }
+
+ if (propValue.getClass() == Boolean.class )
+ {
+ return valueFactory.createValue((Long) propValue);
+ }
+
+ if (propValue.getClass() == Calendar.class )
+ {
+
+ return valueFactory.createValue((Calendar) propValue);
+ }
+
+ if (propValue.getClass() == GregorianCalendar.class )
+ {
+ return valueFactory.createValue((GregorianCalendar) propValue);
+ }
+
+ if (propValue.getClass() == GregorianCalendar.class )
+ {
+ return valueFactory.createValue((GregorianCalendar) propValue);
+ }
+
+ if (propValue.getClass() == Date.class )
+ {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime((Date) propValue);
+ return valueFactory.createValue(calendar);
+ }
+
+ if (propValue.getClass() == Date.class )
+ {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime((Date) propValue);
+ return valueFactory.createValue(calendar);
+ }
+
+ throw new IncorrectAtomicTypeException("Impossible to convert the value - property type not found");
+
+ }
+
+ /**
+ *
+ * @see org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter#getObject(javax.jcr.Value)
+ */
+ public Object getObject(Value value)
+ {
+ try
+ {
+
+ if (value.getType() == PropertyType.STRING )
+ {
+ return value.getString();
+ }
+
+ if (value.getType() == PropertyType.DATE)
+ {
+ return value.getDate();
+ }
+
+ if (value.getType() == PropertyType.BINARY)
+ {
+ return value.getStream();
+ }
+
+ if (value.getType() == PropertyType.DOUBLE)
+ {
+ return value.getDouble();
+ }
+
+ if (value.getType() == PropertyType.LONG)
+ {
+ return value.getLong();
+ }
+
+ if (value.getType() == PropertyType.BOOLEAN)
+ {
+ return value.getBoolean();
+ }
+
+ if (value.getType() == PropertyType.NAME)
+ {
+ return value.getString();
+ }
+
+ if (value.getType() == PropertyType.PATH)
+ {
+ return value.getString();
+ }
+
+ if (value.getType() == PropertyType.REFERENCE)
+ {
+ return value.getString();
+ }
+
+ throw new IncorrectAtomicTypeException("Impossible to create the value object - unsupported class");
+
+ }
+ catch (RepositoryException e)
+ {
+ throw new IncorrectAtomicTypeException("Impossible to convert the value : " + value.toString(), e);
+ }
+
+ }
+
+ /**
+ *
+ * @see org.apache.portals.graffito.jcr.persistence.atomictypeconverter.AtomicTypeConverter#getStringValue(java.lang.Object)
+ */
+ public String getStringValue(Object object)
+ {
+ return "'" + object.toString() + "'";
+ }
+}
Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/ObjectConverterImpl.java?view=diff&rev=515299&r1=515298&r2=515299
==============================================================================
--- 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 Tue Mar 6 13:03:34 2007
@@ -202,6 +202,8 @@
objectNode.setProperty(PersistenceConstant.DISCRIMINATOR_PROPERTY_NAME, ReflectionUtils.getBeanClass(object)
.getName());
}
+
+
} catch (NoSuchNodeTypeException nsnte) {
throw new JcrMappingException("Unknown mixin type " + mixinTypeName + " for mapped class " + object.getClass(), nsnte);
} catch (RepositoryException re) {
Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/SimpleFieldsHelper.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/SimpleFieldsHelper.java?view=diff&rev=515299&r1=515298&r2=515299
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/SimpleFieldsHelper.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/java/org/apache/portals/graffito/jcr/persistence/objectconverter/impl/SimpleFieldsHelper.java Tue Mar 6 13:03:34 2007
@@ -19,6 +19,7 @@
import java.util.Iterator;
import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.Value;
@@ -77,65 +78,82 @@
public Object retrieveSimpleFields(Session session, ClassDescriptor classDescriptor, Node node, Object object)
{
Object initializedBean = object;
- try
- {
+ try {
Iterator fieldDescriptorIterator = classDescriptor.getFieldDescriptors().iterator();
- while (fieldDescriptorIterator.hasNext())
- {
+ while (fieldDescriptorIterator.hasNext()) {
FieldDescriptor fieldDescriptor = (FieldDescriptor) fieldDescriptorIterator.next();
String fieldName = fieldDescriptor.getFieldName();
String propertyName = fieldDescriptor.getJcrName();
- if (fieldDescriptor.isPath())
- {
- // HINT: lazy initialize target bean - The bean can be null when it is inline
- if (null == initializedBean)
- {
+ if (fieldDescriptor.isPath()) {
+ // HINT: lazy initialize target bean - The bean can be null
+ // when it is inline
+ if (null == initializedBean) {
initializedBean = ReflectionUtils.newInstance(classDescriptor.getClassName());
}
ReflectionUtils.setNestedProperty(initializedBean, fieldName, node.getPath());
-
- }
- else
- {
- if (classDescriptor.usesNodeTypePerHierarchyStrategy() && classDescriptor.hasDiscriminator())
- {
- if ( ! node.hasProperty(PersistenceConstant.DISCRIMINATOR_PROPERTY_NAME))
- {
- throw new PersistenceException("Class '" + classDescriptor.getClassName() + "' has not a discriminator property.");
- }
- }
- if (node.hasProperty(propertyName))
- {
- Value propValue = node.getProperty(propertyName).getValue();
- // HINT: lazy initialize target bean - The bean can be null when it is inline
- if (null != propValue && null == initializedBean) {
+
+ } else {
+ if (fieldDescriptor.isUuid()) {
+ // HINT: lazy initialize target bean - The bean can be
+ // null when it is inline
+ if (null == initializedBean) {
initializedBean = ReflectionUtils.newInstance(classDescriptor.getClassName());
}
- AtomicTypeConverter converter = getAtomicTypeConverter(fieldDescriptor, initializedBean, fieldName);
- Object fieldValue = converter.getObject(propValue);
- ReflectionUtils.setNestedProperty(initializedBean, fieldName, fieldValue);
- }
- else
- {
- log.warn("Class '" + classDescriptor.getClassName() + "' has an unmapped property : " + propertyName);
+ ReflectionUtils.setNestedProperty(initializedBean, fieldName, node.getUUID());
+
+ } else {
+ initializedBean = retrieveSimpleField(classDescriptor, node, initializedBean, fieldDescriptor, fieldName, propertyName);
}
}
-
+
}
} catch (ValueFormatException vfe) {
- throw new PersistenceException("Cannot retrieve properties of object " + object + " from node " + node, vfe);
+ throw new PersistenceException(
+ "Cannot retrieve properties of object " + object + " from node " + node, vfe);
} catch (RepositoryException re) {
- throw new org.apache.portals.graffito.jcr.exception.RepositoryException("Cannot retrieve properties of object "
- + object + " from node " + node, re);
+ throw new org.apache.portals.graffito.jcr.exception.RepositoryException( "Cannot retrieve properties of object " + object
+ + " from node " + node, re);
}
return initializedBean;
}
+
+
+ private Object retrieveSimpleField(ClassDescriptor classDescriptor, Node node, Object initializedBean, FieldDescriptor fieldDescriptor, String fieldName, String propertyName) throws RepositoryException, ValueFormatException, PathNotFoundException {
+ if (classDescriptor.usesNodeTypePerHierarchyStrategy() && classDescriptor.hasDiscriminator())
+ {
+ if (!node.hasProperty(PersistenceConstant.DISCRIMINATOR_PROPERTY_NAME))
+ {
+ throw new PersistenceException("Class '"
+ + classDescriptor.getClassName()
+ + "' has not a discriminator property.");
+ }
+ }
+ if (node.hasProperty(propertyName))
+ {
+ Value propValue = node.getProperty(propertyName).getValue();
+ // HINT: lazy initialize target bean - The bean can be null when it is inline
+ if (null != propValue && null == initializedBean)
+ {
+ initializedBean = ReflectionUtils.newInstance(classDescriptor.getClassName());
+ }
+
+ AtomicTypeConverter converter = getAtomicTypeConverter(fieldDescriptor, initializedBean, fieldName);
+ Object fieldValue = converter.getObject(propValue);
+ ReflectionUtils.setNestedProperty(initializedBean, fieldName, fieldValue);
+
+ }
+ else
+ {
+ log.warn("Class '" + classDescriptor.getClassName() + "' has an unmapped property : " + propertyName);
+ }
+ return initializedBean;
+ }
public void storeSimpleFields(Session session, Object object, ClassDescriptor classDescriptor, Node objectNode) {
try {
@@ -148,36 +166,12 @@
String fieldName = fieldDescriptor.getFieldName();
String jcrName = fieldDescriptor.getJcrName();
- // Of course, Path field is not stored as property
- if (fieldDescriptor.isPath()) {
+ // Of course, Path && UUID fields are not stored as property
+ if (fieldDescriptor.isPath() || fieldDescriptor.isUuid()) {
continue;
}
- boolean protectedProperty = fieldDescriptor.isJcrProtected();
-
- if (objectNode.hasProperty(jcrName)) {
- protectedProperty = objectNode.getProperty(jcrName).getDefinition().isProtected();
- }
-
- if (!protectedProperty) { // DO NOT TRY TO WRITE PROTECTED PROPERTIES
- Object fieldValue = ReflectionUtils.getNestedProperty(object, fieldName);
- AtomicTypeConverter converter = getAtomicTypeConverter(fieldDescriptor, object, fieldName);
- Value value = converter.getValue(valueFactory, fieldValue);
-
- // Check if the node property is "autocreated"
- boolean autoCreated = fieldDescriptor.isJcrAutoCreated();
-
- if (objectNode.hasProperty(jcrName)) {
- autoCreated = objectNode.getProperty(jcrName).getDefinition().isAutoCreated();
- }
-
- if (!autoCreated) {
- // Check if mandatory property are not null
- checkMandatoryProperty(objectNode, fieldDescriptor, value);
- }
-
- objectNode.setProperty(jcrName, value);
- }
+ storeSimpleField(object, objectNode, valueFactory, fieldDescriptor, fieldName, jcrName);
}
} catch (ValueFormatException vfe) {
throw new PersistenceException("Cannot persist properties of object " + object + ". Value format exception.", vfe);
@@ -191,6 +185,35 @@
throw new org.apache.portals.graffito.jcr.exception.RepositoryException("Cannot persist properties of object "
+ object, re);
}
+ }
+
+
+ private void storeSimpleField(Object object, Node objectNode, ValueFactory valueFactory, FieldDescriptor fieldDescriptor, String fieldName, String jcrName) throws RepositoryException, PathNotFoundException, ValueFormatException, VersionException, LockException, ConstraintViolationException {
+ boolean protectedProperty = fieldDescriptor.isJcrProtected();
+
+ if (objectNode.hasProperty(jcrName)) {
+ protectedProperty = objectNode.getProperty(jcrName).getDefinition().isProtected();
+ }
+
+ if (!protectedProperty) { // DO NOT TRY TO WRITE PROTECTED PROPERTIES
+ Object fieldValue = ReflectionUtils.getNestedProperty(object, fieldName);
+ AtomicTypeConverter converter = getAtomicTypeConverter(fieldDescriptor, object, fieldName);
+ Value value = converter.getValue(valueFactory, fieldValue);
+
+ // Check if the node property is "autocreated"
+ boolean autoCreated = fieldDescriptor.isJcrAutoCreated();
+
+ if (objectNode.hasProperty(jcrName)) {
+ autoCreated = objectNode.getProperty(jcrName).getDefinition().isAutoCreated();
+ }
+
+ if (!autoCreated) {
+ // Check if mandatory property are not null
+ checkMandatoryProperty(objectNode, fieldDescriptor, value);
+ }
+
+ objectNode.setProperty(jcrName, value);
+ }
}
private void checkMandatoryProperty(Node objectNode, FieldDescriptor fieldDescriptor, Value value) throws RepositoryException {
Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-atomic.xml
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-atomic.xml?view=diff&rev=515299&r1=515298&r2=515299
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-atomic.xml (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-atomic.xml Tue Mar 6 13:03:34 2007
@@ -20,6 +20,7 @@
<field-descriptor fieldName="int2boolean" jcrName="int2boolean" converter="org.apache.portals.graffito.jcr.persistence.atomic.Int2BooleanTypeConverterImpl" />
<field-descriptor fieldName="namedProperty" jcrName="namedProperty" converter="org.apache.portals.graffito.jcr.persistence.atomictypeconverter.impl.NameTypeConverterImpl" />
<field-descriptor fieldName="pathProperty" jcrName="pathProperty" converter="org.apache.portals.graffito.jcr.persistence.atomictypeconverter.impl.PathTypeConverterImpl" />
+ <field-descriptor fieldName="undefinedProperty" jcrName="undefinedProperty" converter="org.apache.portals.graffito.jcr.persistence.atomictypeconverter.impl.UndefinedTypeConverterImpl" />
</class-descriptor>
<class-descriptor
Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-testdigester.xml
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-testdigester.xml?view=diff&rev=515299&r1=515298&r2=515299
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-testdigester.xml (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-testdigester.xml Tue Mar 6 13:03:34 2007
@@ -90,4 +90,12 @@
<field-descriptor fieldName="id" jcrName="graffito:id" />
<field-descriptor fieldName="text" jcrName="graffito:text" />
</class-descriptor>
+
+
+ <class-descriptor
+ className="org.apache.portals.graffito.jcr.testmodel.uuid.A" jcrNodeType="nt:unstructured" >
+ <field-descriptor fieldName="path" path="true" />
+ <field-descriptor fieldName="uuid" uuid="true" />
+ <field-descriptor fieldName="stringData" jcrName="stringData" />
+ </class-descriptor>
</graffito-jcr>
Added: incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-uuid.xml
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-uuid.xml?view=auto&rev=515299
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-uuid.xml (added)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test-config/jcrmapping-uuid.xml Tue Mar 6 13:03:34 2007
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE graffito-jcr PUBLIC "-//The Apache Software Foundation//DTD Repository//EN" "./src/dtd/graffito-jcr-mapping.dtd">
+<graffito-jcr>
+ <class-descriptor
+ className="org.apache.portals.graffito.jcr.testmodel.uuid.A" jcrNodeType="nt:unstructured" jcrMixinTypes="mix:referenceable" >
+ <field-descriptor fieldName="path" path="true" />
+ <field-descriptor fieldName="uuid" uuid="true" />
+ <field-descriptor fieldName="stringData" jcrName="stringData" />
+ </class-descriptor>
+
+ <class-descriptor
+ className="org.apache.portals.graffito.jcr.testmodel.uuid.B" jcrNodeType="nt:unstructured" >
+ <field-descriptor fieldName="path" path="true" />
+ <field-descriptor fieldName="reference2A" jcrName="reference2A" converter="org.apache.portals.graffito.jcr.persistence.atomictypeconverter.impl.ReferenceTypeConverterImpl" />
+
+ </class-descriptor>
+</graffito-jcr>
+
\ No newline at end of file
Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/TestBase.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/TestBase.java?view=diff&rev=515299&r1=515298&r2=515299
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/TestBase.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/TestBase.java Tue Mar 6 13:03:34 2007
@@ -195,7 +195,8 @@
"./src/test-config/jcrmapping-atomic.xml",
"./src/test-config/jcrmapping-beandescriptor.xml",
"./src/test-config/jcrmapping-inheritance.xml",
- "./src/test-config/jcrmapping-jcrnodetypes.xml"};
+ "./src/test-config/jcrmapping-jcrnodetypes.xml",
+ "./src/test-config/jcrmapping-uuid.xml"};
session = RepositoryUtil.login(repository, "superuser", "superuser");
Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/mapper/DigesterMapperImplTest.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/mapper/DigesterMapperImplTest.java?view=diff&rev=515299&r1=515298&r2=515299
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/mapper/DigesterMapperImplTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/mapper/DigesterMapperImplTest.java Tue Mar 6 13:03:34 2007
@@ -102,6 +102,28 @@
* Simple test mapper
*
*/
+ public void testUuid() {
+ try {
+
+ Mapper mapper = new DigesterMapperImpl(
+ "./src/test-config/jcrmapping-testdigester.xml");
+
+ assertNotNull("Mapper is null", mapper);
+
+ ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(org.apache.portals.graffito.jcr.testmodel.uuid.A.class);
+ assertNotNull("ClassDescriptor is null", classDescriptor);
+ assertTrue("Invalid uuid field", classDescriptor.getUuidFieldDescriptor().getFieldName().equals("uuid"));
+
+ } catch (JcrMappingException e) {
+ e.printStackTrace();
+ fail("Impossible to retrieve the converter " + e);
+ }
+ }
+
+ /**
+ * Simple test mapper
+ *
+ */
public void testDiscriminatorSetting() {
try {
Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomic/AtomicTest.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomic/AtomicTest.java?view=diff&rev=515299&r1=515298&r2=515299
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomic/AtomicTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/atomic/AtomicTest.java Tue Mar 6 13:03:34 2007
@@ -102,6 +102,7 @@
a.setInputStream(byteArrayInputStream);
a.setNamedProperty("graffito:test");
a.setPathProperty("/node1/node2");
+ a.setUndefinedProperty("aStringData");
persistenceManager.insert(a);
persistenceManager.save();
@@ -142,7 +143,7 @@
assertTrue("Invalid namedProperty value ", a.getNamedProperty().equals("graffito:test"));
assertTrue("Invalid pathProperty value ", a.getPathProperty().equals("/node1/node2"));
-
+ assertTrue("Invalid undefinedProperty value ", ((String) a.getUndefinedProperty()).equals("aStringData"));
// --------------------------------------------------------------------------------
// Update the property "namedProperty" with an invalid value
// --------------------------------------------------------------------------------
@@ -159,7 +160,7 @@
}
-
+
// --------------------------------------------------------------------------------
// Update the property "pathProperty" with an invalid value
// --------------------------------------------------------------------------------
@@ -177,6 +178,23 @@
}
+ // --------------------------------------------------------------------------------
+ // Update the property "undefinedProperty" with an invalid value
+ // --------------------------------------------------------------------------------
+ a = null;
+ a = (Atomic) persistenceManager.getObject( "/test");
+
+ a.setUndefinedProperty(1.2);
+ persistenceManager.update(a);
+ persistenceManager.save();
+
+ // --------------------------------------------------------------------------------
+ // Get the object
+ // --------------------------------------------------------------------------------
+ a = null;
+ a = (Atomic) persistenceManager.getObject( "/test");
+ assertNotNull("a is null", a);
+ assertTrue("Invalid undefinedProperty value ", ((Double) a.getUndefinedProperty()).doubleValue() == 1.2);
}
catch (Exception e)
Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/beanconverter/BeanDescriptorTest.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/beanconverter/BeanDescriptorTest.java?view=diff&rev=515299&r1=515298&r2=515299
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/beanconverter/BeanDescriptorTest.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/beanconverter/BeanDescriptorTest.java Tue Mar 6 13:03:34 2007
@@ -139,7 +139,6 @@
assertNull("b1 was not removed", actD.getB1());
actDFull = (DFull) persistenceManager.getObject( DFull.class, "/someD");
-
assertEquals(expD.getD1(), actDFull.getD1());
assertNull("b1 was not removed", actDFull.getB1());
assertNull("b2 wan not remove", actDFull.getB2());
@@ -228,8 +227,8 @@
for (Iterator iter = paragraphs.iterator(); iter.hasNext();) {
Paragraph paragraph = (Paragraph) iter.next();
System.out.println("Paragraph path : " + paragraph.getPath());
- }
- Paragraph p1 = (Paragraph) persistenceManager.getObject(Paragraph.class, "/test/collection-element[2]");
+ }
+ Paragraph p1 = (Paragraph) persistenceManager.getObject("/test/collection-element[2]");
Page paraPage = p1.getPage();
assertNotNull("Parent page is null", paraPage);
assertTrue("Invalid parent page", paraPage.getPath().equals("/test"));
Added: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/uuid/PersistenceManagerUuidTest.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/uuid/PersistenceManagerUuidTest.java?view=auto&rev=515299
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/uuid/PersistenceManagerUuidTest.java (added)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/persistence/uuid/PersistenceManagerUuidTest.java Tue Mar 6 13:03:34 2007
@@ -0,0 +1,154 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.uuid;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.portals.graffito.jcr.RepositoryLifecycleTestSetup;
+import org.apache.portals.graffito.jcr.TestBase;
+import org.apache.portals.graffito.jcr.persistence.PersistenceManager;
+import org.apache.portals.graffito.jcr.testmodel.uuid.A;
+import org.apache.portals.graffito.jcr.testmodel.uuid.B;
+
+
+/**
+ * Test JcrSession
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ */
+public class PersistenceManagerUuidTest extends TestBase
+{
+ private final static Log log = LogFactory.getLog(PersistenceManagerUuidTest.class);
+
+ /**
+ * <p>Defines the test case name for junit.</p>
+ * @param testName The test case name.
+ */
+ public PersistenceManagerUuidTest(String testName) throws Exception
+ {
+ super(testName);
+ }
+
+ public static Test suite()
+ {
+ // All methods starting with "test" will be executed in the test suite.
+ return new RepositoryLifecycleTestSetup(
+ new TestSuite(PersistenceManagerUuidTest.class));
+ }
+
+
+ /**
+ * @see junit.framework.TestCase#tearDown()
+ */
+ public void tearDown() throws Exception
+ {
+ if (getPersistenceManager().objectExists("/testB"))
+ {
+ getPersistenceManager().remove("/testB");
+ getPersistenceManager().save();
+ }
+
+ if (getPersistenceManager().objectExists("/test"))
+ {
+ getPersistenceManager().remove("/test");
+ getPersistenceManager().save();
+ }
+
+ super.tearDown();
+ }
+
+ public void testClassA()
+ {
+ try
+ {
+ PersistenceManager persistenceManager = getPersistenceManager();
+
+
+ // --------------------------------------------------------------------------------
+ // Create and store an object A in the repository
+ // --------------------------------------------------------------------------------
+ A a = new A();
+ a.setPath("/test");
+ a.setStringData("testdata");
+ persistenceManager.insert(a);
+ persistenceManager.save();
+
+ // --------------------------------------------------------------------------------
+ // Get the object
+ // --------------------------------------------------------------------------------
+ a = (A) persistenceManager.getObject( "/test");
+ assertNotNull("a is null", a);
+ String uuidA = a.getUuid();
+ assertNotNull("uuid is null", uuidA);
+ System.out.println("UUID : " + uuidA);
+
+ // --------------------------------------------------------------------------------
+ // Update the object
+ // --------------------------------------------------------------------------------
+ a.setStringData("testdata2");
+ persistenceManager.update(a);
+ persistenceManager.save();
+
+ // --------------------------------------------------------------------------------
+ // Get the object
+ // --------------------------------------------------------------------------------
+ a = (A) persistenceManager.getObject("/test");
+ assertNotNull("a is null", a);
+ assertTrue("The uuid has been modified", uuidA.equals(a.getUuid()));
+
+ // --------------------------------------------------------------------------------
+ // Create and store an object B in the repository which has a reference on A
+ // --------------------------------------------------------------------------------
+ B b = new B();
+ b.setReference2A(uuidA);
+ b.setPath("/testB");
+ persistenceManager.insert(b);
+ persistenceManager.save();
+
+ // --------------------------------------------------------------------------------
+ // Update the object B with an invalid reference
+ // --------------------------------------------------------------------------------
+ b = (B) persistenceManager.getObject("/testB");
+ b.setReference2A("1245");
+ try
+ {
+ persistenceManager.update(b);
+ fail("Exception not throw");
+ }
+ catch(Exception e)
+ {
+ //Exception has to triggered due to an invalid uuid
+ System.out.println("Invalid uuid : " + e);
+
+ }
+
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail("Exception occurs during the unit test : " + e);
+ }
+
+ }
+
+
+
+}
\ No newline at end of file
Modified: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/Atomic.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/Atomic.java?view=diff&rev=515299&r1=515298&r2=515299
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/Atomic.java (original)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/Atomic.java Tue Mar 6 13:03:34 2007
@@ -18,7 +18,6 @@
import java.io.InputStream;
import java.sql.Timestamp;
-import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
@@ -49,6 +48,7 @@
private String namedProperty;
private String pathProperty; // used to refer another node
+ private Object undefinedProperty;
@@ -192,7 +192,16 @@
{
this.pathProperty = pathProperty;
}
-
-
+ public Object getUndefinedProperty()
+ {
+ return undefinedProperty;
+ }
+
+ public void setUndefinedProperty(Object undefinedProperty)
+ {
+ this.undefinedProperty = undefinedProperty;
+ }
+
+
}
Added: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/uuid/A.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/uuid/A.java?view=auto&rev=515299
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/uuid/A.java (added)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/uuid/A.java Tue Mar 6 13:03:34 2007
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.testmodel.uuid;
+
+
+/**
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe </a>
+ * @version $Id: Exp $
+ */
+public class A
+{
+ private String path;
+ private String uuid;
+ private String stringData;
+
+
+ public String getPath()
+ {
+ return path;
+ }
+
+ public void setPath(String path)
+ {
+ this.path = path;
+ }
+
+ public String getUuid() {
+ return uuid;
+ }
+
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+ public String getStringData() {
+ return stringData;
+ }
+
+ public void setStringData(String stringData) {
+ this.stringData = stringData;
+ }
+
+
+
+
+}
Added: incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/uuid/B.java
URL: http://svn.apache.org/viewvc/incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/uuid/B.java?view=auto&rev=515299
==============================================================================
--- incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/uuid/B.java (added)
+++ incubator/graffito/trunk/jcr/jcr-mapping/src/test/org/apache/portals/graffito/jcr/testmodel/uuid/B.java Tue Mar 6 13:03:34 2007
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.testmodel.uuid;
+
+
+/**
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe </a>
+ * @version $Id: Exp $
+ */
+public class B
+{
+ private String path;
+ private String reference2A; // This String attribute is mapped to a reference jcr property
+
+
+ public String getPath()
+ {
+ return path;
+ }
+
+ public void setPath(String path)
+ {
+ this.path = path;
+ }
+
+ public String getReference2A()
+ {
+ return reference2A;
+ }
+
+ public void setReference2A(String reference2A)
+ {
+ this.reference2A = reference2A;
+ }
+
+
+}