Package org.apache.jackrabbit.ocm.manager.collectionconverter

Examples of org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollection


            PropertyIterator pi = parentNode.getProperties(jcrName);
            if (!pi.hasNext()) {
                return null;
            }

            ManageableCollection collection = ManageableCollectionUtil.getManageableCollection(collectionFieldClass);
            AtomicTypeConverter atomicTypeConverter = getAtomicTypeConverter(collectionDescriptor);

            while (pi.hasNext()) {
                Property prop = pi.nextProperty();

                // ignore protected properties here
                if (prop.getDefinition().isProtected()) {
                    continue;
                }

                // handle multvalues as a list
                Object value;
                if (prop.getDefinition().isMultiple()) {
                    List valueList = new ArrayList();
                    Value[] values = prop.getValues();
                    for (int i = 0; i < values.length; i++) {
                        valueList.add(atomicTypeConverter.getObject(values[i]));
                    }
                    value = valueList;
                } else {
                    value = atomicTypeConverter.getObject(prop.getValue());
                }

                if (collection instanceof Map) {
                    String name = prop.getName();
                    ((Map) collection).put(name, value);
                } else {
                    collection.addObject(value);
                }
            }

            return collection;
        } catch (ValueFormatException vfe) {
View Full Code Here


                return null;
            }
            Property property = parentNode.getProperty(jcrName);
            Value[] values = property.getValues();

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

            return collection;
        }
        catch(Exception e) {
View Full Code Here

  }

  public Object loadObject() {
 
   
    ManageableCollection collection = collectionConverter.getCollection(session, collectionParentNode, collectionDescriptor, collectionFieldClass);
    return collection;
  }
View Full Code Here

        if (parentNode == null || !parentNode.hasNode(jcrName)) {
            return null;
        }

        ManageableCollection collection = ManageableCollectionUtil.getManageableCollection(collectionFieldClass);
        Node collectionNode = parentNode.getNode(jcrName);
        NodeIterator children = collectionNode.getNodes();
        Class elementClass = ReflectionUtils.forName(collectionDescriptor.getElementClassName());
       
        while (children.hasNext()) {
            Node itemNode = children.nextNode();
            Object item = objectConverter.getObject(session, elementClass, itemNode.getPath());
            collection.addObject(item);
        }

        return collection;
    }
View Full Code Here

                return null;
            }
            Property property = parentNode.getProperty(jcrName);
            Value[] values = property.getValues();

            ManageableCollection collection = ManageableCollectionUtil.getManageableCollection(collectionFieldClass);
            for (int i = 0; i < values.length; i++) {
               
                collection.addObject(values[i].getString());
            }

            return collection;
        }
        catch(ValueFormatException vfe) {
View Full Code Here

   
    if (collectionConverter.isNull(session, parentNode, collectionDescriptor, collectionFieldClass))   {
      return null;
    }
   
    ManageableCollection manageableCollection = ManageableCollectionUtil.getManageableCollection(collectionFieldClass);
   
    LazyLoader loader = new CollectionLazyLoader(collectionConverter, session, parentNode, collectionDescriptor, collectionFieldClass);
    return  Enhancer.create(manageableCollection.getClass(), loader);
 
View Full Code Here

                return null;
            }
            Property property = parentNode.getProperty(jcrName);
            Value[] values = property.getValues();

            ManageableCollection collection = ManageableCollectionUtil.getManageableCollection(collectionFieldClass);
            String elementClassName = collectionDescriptor.getElementClassName();
            Class elementClass = ReflectionUtils.forName(elementClassName);
            for (int i = 0; i < values.length; i++) {
                AtomicTypeConverter atomicTypeConverter = (AtomicTypeConverter) atomicTypeConverters
                    .get(elementClass);
                collection.addObject(atomicTypeConverter.getObject(values[i]));
            }

            return collection;
        }
        catch(ValueFormatException vfe) {
View Full Code Here

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

            ManageableCollection collection = ManageableCollectionUtil.getManageableCollection(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 (collection instanceof Map) {
                    String name = node.getName();
                    ((Map) collection).put(name, item);
                } else {
                    collection.addObject(item);
                }
            }

            return collection;
        } catch (ValueFormatException vfe) {
View Full Code Here

      return;
    }

    CollectionConverter collectionConverter = this.getCollectionConverter(session, collectionDescriptor);
    Class collectionFieldClass = ReflectionUtils.getPropertyType(object, collectionDescriptor.getFieldName());
    ManageableCollection collection = null;
    if (collectionDescriptor.isProxy()) {
      collection = (ManageableCollection) proxyManager.createCollectionProxy(session, collectionConverter, parentNode,
          collectionDescriptor, collectionFieldClass);

    } else {
View Full Code Here

        continue;
      }

      CollectionConverter collectionConverter = this.getCollectionConverter(session, collectionDescriptor);
      Object collection = ReflectionUtils.getNestedProperty(object, collectionDescriptor.getFieldName());
      ManageableCollection manageableCollection = ManageableCollectionUtil.getManageableCollection(collection);

      collectionConverter.insertCollection(session, objectNode, collectionDescriptor, manageableCollection);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.ocm.manager.collectionconverter.ManageableCollection

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.