protected ManageableObjects doGetCollection()

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


    protected ManageableObjects doGetCollection(Session session,
                                                   Node parentNode,
                                                   CollectionDescriptor collectionDescriptor,
                                                   Class collectionFieldClass) throws RepositoryException {
        try {
            String jcrName = getCollectionJcrName(collectionDescriptor);
            if (!parentNode.hasProperty(jcrName)) {
                return null;
            }
            Property property = parentNode.getProperty(jcrName);
            Value[] values = property.getValues();

            ManageableObjects objects = ManageableObjectsUtil.getManageableObjects(collectionFieldClass);

            // For collection of bean references, only Collections are supported
            if (! (objects instanceof ManageableCollection))
            {

            	throw new JcrMappingException("Impossible to retrieve the attribute "
            			+ collectionDescriptor.getFieldName() + " in the class "
            			+ collectionDescriptor.getClassDescriptor().getClassName()
            			+  " because it is not a collection");
            }

            for (int i = 0; i < values.length; i++) {
                String uuid = values[i].getString();
                String path = session.getNodeByIdentifier(uuid).getPath();
    			Object object = objectConverter.getObject(session, path);
                ((ManageableCollection) objects).addObject(object);
            }

            return objects;
        }
        catch(Exception e) {
          throw new ObjectContentManagerException("Cannot get the collection field : "
                  + collectionDescriptor.getFieldName()
                  + "for class " + collectionDescriptor.getClassDescriptor().getClassName(), e);
        }
    }