protected ManageableObjects doGetCollection()

in src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/ResidualNodesCollectionConverterImpl.java [136:178]


    protected ManageableObjects doGetCollection(Session session,
        Node parentNode, CollectionDescriptor collectionDescriptor,
        Class collectionFieldClass) throws RepositoryException {

        try {
            String jcrName = getCollectionJcrName(collectionDescriptor);
            NodeIterator ni = parentNode.getNodes(jcrName);
            if (!ni.hasNext()) {
                return null;
            }

            ManageableObjects objects = ManageableObjectsUtil.getManageableObjects(collectionFieldClass);
            while (ni.hasNext()) {
                Node node = ni.nextNode();

                // ignore protected nodes here
                if (node.getDefinition().isProtected()) {
                    continue;
                }

                Object item = objectConverter.getObject(session, node.getPath());
                if (objects instanceof Map) {
                    String name = node.getName();
                    ((Map) objects).put(name, item);
                }
                else {
                	if (objects instanceof ManageableCollection)
                        ((ManageableCollection)objects).addObject(item);
               	   else
               	   {
               		String name = node.getName();
               		((ManageableMap)objects).addObject(name, item);
               	   }
                }
            }
            return objects;

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