private void addUuidProperties()

in src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/BeanReferenceCollectionConverterImpl.java [158:197]


	private void addUuidProperties(Session session, Node parentNode,
			CollectionDescriptor collectionDescriptor,
			ManageableObjects objects)
	        throws UnsupportedRepositoryOperationException, RepositoryException, VersionException, LockException, ConstraintViolationException {
		try {
            if (objects == null) {
                return;
            }

            String jcrName = getCollectionJcrName(collectionDescriptor);
            Value[] values = new Value[objects.getSize()];
            ValueFactory valueFactory = session.getValueFactory();
            Iterator collectionIterator = objects.getIterator();
            for (int i = 0; i < objects.getSize(); i++) {
                Object object = collectionIterator.next();
				if (object != null)
				{
					ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(object.getClass());

					FieldDescriptor fieldDescriptor = classDescriptor.getUuidFieldDescriptor();
					if (fieldDescriptor == null)
					{
						throw new JcrMappingException("The bean doesn't have an uuid - classdescriptor : "
										              + classDescriptor.getClassName());
					}

					String uuid = (String) ReflectionUtils.getNestedProperty(object, fieldDescriptor.getFieldName());
					values[i] = valueFactory.createValue(uuid, PropertyType.REFERENCE);
				}
            }

            parentNode.setProperty(jcrName, values);
        }
        catch(Exception e) {
            throw new ObjectContentManagerException("Cannot insert collection field : "
                    + collectionDescriptor.getFieldName()
                    + " of class "
                    + collectionDescriptor.getClassDescriptor().getClassName(), e);
        }
	}