Package org.apache.jackrabbit.ocm.mapper.model

Examples of org.apache.jackrabbit.ocm.mapper.model.CollectionDescriptor


        return fd;
    }

    private CollectionDescriptor parseCollectionDescriptor() throws XmlPullParserException {
        CollectionDescriptor fd = new CollectionDescriptor();

        /*
         * fieldName CDATA #REQUIRED
         * jcrName CDATA #IMPLIED
         * proxy (true | false) "false"
         * autoRetrieve (true|false) "true"
         * autoUpdate (true|false) "true"
         * autoInsert (true|false) "true"
         * elementClassName CDATA #REQUIRED
         * collectionClassName CDATA #IMPLIED
         * collectionConverter CDATA #IMPLIED
         * jcrType CDATA #IMPLIED
         * jcrAutoCreated (true | false) "false"
         * jcrMandatory (true | false) "false"
         * jcrOnParentVersion (COPY | VERSION | INITIALIZE | COMPUTE | IGNORE | ABORT) "COPY"
         * jcrProtected (true | false) "false"
         * jcrSameNameSiblings (true | false) "false"
         */

        fd.setFieldName(this.getRequiredAttribute("fieldName"));
        fd.setJcrName(this.getOptionalAttribute("jcrName", fd.getFieldName()));
        fd.setProxy(this.getOptionalAttribute("proxy", false));

        fd.setAutoRetrieve(this.getOptionalAttribute("autoRetrieve", true));
        fd.setAutoUpdate(this.getOptionalAttribute("autoUpdate", true));
        fd.setAutoInsert(this.getOptionalAttribute("autoInsert", true));

        fd.setElementClassName(this.getRequiredAttribute("elementClassName"));
        fd.setCollectionClassName(this.getOptionalAttribute("collectionClassName"));
        fd.setCollectionConverter(this.getOptionalAttribute("collectionConverter"));

        fd.setJcrAutoCreated(this.getOptionalAttribute("jcrAutoCreated", false));
        fd.setJcrMandatory(this.getOptionalAttribute("jcrMandatory", false));
        fd.setJcrOnParentVersion(this.getOptionalAttribute("jcrOnParentVersion", "COPY"));
        fd.setJcrProtected(this.getOptionalAttribute("jcrProtected", false));
        fd.setJcrSameNameSiblings(this.getOptionalAttribute("jcrSameNameSiblings", false));

        fd.setJcrType(this.getOptionalAttribute("jcrType"));
        fd.setJcrMultiple(this.getOptionalAttribute("jcrMultiple", false));

        return fd;
    }
View Full Code Here


        return fd;
    }

    private CollectionDescriptor parseCollectionDescriptor() throws XmlPullParserException {
        CollectionDescriptor fd = new CollectionDescriptor();

        /*
         * fieldName CDATA #REQUIRED
         * jcrName CDATA #IMPLIED
         * proxy (true | false) "false"
         * autoRetrieve (true|false) "true"
         * autoUpdate (true|false) "true"
         * autoInsert (true|false) "true"
         * elementClassName CDATA #REQUIRED
         * collectionClassName CDATA #IMPLIED
         * collectionConverter CDATA #IMPLIED
         * jcrType CDATA #IMPLIED
         * jcrAutoCreated (true | false) "false"
         * jcrMandatory (true | false) "false"
         * jcrOnParentVersion (COPY | VERSION | INITIALIZE | COMPUTE | IGNORE | ABORT) "COPY"
         * jcrProtected (true | false) "false"
         * jcrSameNameSiblings (true | false) "false"
         */

        fd.setFieldName(this.getRequiredAttribute("fieldName"));
        fd.setJcrName(this.getOptionalAttribute("jcrName", fd.getFieldName()));
        fd.setProxy(this.getOptionalAttribute("proxy", false));

        fd.setAutoRetrieve(this.getOptionalAttribute("autoRetrieve", true));
        fd.setAutoUpdate(this.getOptionalAttribute("autoUpdate", true));
        fd.setAutoInsert(this.getOptionalAttribute("autoInsert", true));

        fd.setElementClassName(this.getRequiredAttribute("elementClassName"));
        fd.setCollectionClassName(this.getOptionalAttribute("collectionClassName"));
        fd.setCollectionConverter(this.getOptionalAttribute("collectionConverter"));

        fd.setJcrAutoCreated(this.getOptionalAttribute("jcrAutoCreated", false));
        fd.setJcrMandatory(this.getOptionalAttribute("jcrMandatory", false));
        fd.setJcrOnParentVersion(this.getOptionalAttribute("jcrOnParentVersion", "COPY"));
        fd.setJcrProtected(this.getOptionalAttribute("jcrProtected", false));
        fd.setJcrSameNameSiblings(this.getOptionalAttribute("jcrSameNameSiblings", false));

        fd.setJcrType(this.getOptionalAttribute("jcrType"));
        fd.setJcrMultiple(this.getOptionalAttribute("jcrMultiple", false));

        return fd;
    }
View Full Code Here

                }

                if (classDescriptor.getCollectionDescriptors() != null) {
                    Iterator collectionIterator = classDescriptor.getCollectionDescriptors().iterator();
                    while (collectionIterator.hasNext()) {
                        CollectionDescriptor field = (CollectionDescriptor) collectionIterator.next();
                        if (this.isPropertyType(field.getJcrType())) {
                            propDefs.add(getPropertyDefinition(field.getFieldName(), field, nodeTypeDef.getName()));
                        } else {
                            nodeDefs.add(getNodeDefinition(field.getFieldName(), field, nodeTypeDef.getName()));
                        }
                    }
                }

                nodeTypeDef.setPropertyDefs((PropDef[]) propDefs.toArray(new PropDef[propDefs.size()]));
View Full Code Here

        ClassDescriptor classDescriptor = new ClassDescriptor();
        classDescriptor.setClassName("test.Test9Class");
        classDescriptor.setJcrType("ocm:test9");
        classDescriptor.setJcrSuperTypes("nt:base");
       
        CollectionDescriptor collection1 = new CollectionDescriptor();
        collection1.setFieldName("a");
        collection1.setJcrName("a");
        collection1.setJcrType("String");
       
        classDescriptor.addCollectionDescriptor(collection1);
       
        getJackrabbitNodeTypeManagerImpl().createSingleNodeType(session, classDescriptor);
       
View Full Code Here

        ClassDescriptor classDescriptor = new ClassDescriptor();
        classDescriptor.setClassName("test.Test13Class");
        classDescriptor.setJcrType("ocm:test13");
        classDescriptor.setJcrSuperTypes("nt:base");

        CollectionDescriptor collection1 = new CollectionDescriptor();
        collection1.setFieldName("a");
        collection1.setJcrName("a");
        collection1.setJcrType("String");           
        classDescriptor.addCollectionDescriptor(collection1);

        getJackrabbitNodeTypeManagerImpl().createSingleNodeType(session, classDescriptor);
       
        NodeType test13 = session.getWorkspace().getNodeTypeManager().getNodeType("ocm:test13");
View Full Code Here

        ClassDescriptor classDescriptor = new ClassDescriptor();
        classDescriptor.setClassName("test.Test11Class");
        classDescriptor.setJcrType("ocm:test11");
        classDescriptor.setJcrSuperTypes("nt:base");

        CollectionDescriptor collection1 = new CollectionDescriptor();
        collection1.setFieldName("a");
        collection1.setJcrName("b");
        collection1.setJcrType("nt:unstructured");
        classDescriptor.addCollectionDescriptor(collection1);

        getJackrabbitNodeTypeManagerImpl().createSingleNodeType(session, classDescriptor);
       
        NodeType test11 = session.getWorkspace().getNodeTypeManager().getNodeType("ocm:test11");
View Full Code Here

                }
               
                if (classDescriptor.getCollectionDescriptors() != null) {
                    Iterator collectionIterator = classDescriptor.getCollectionDescriptors().iterator();
                    while (collectionIterator.hasNext()) {
                        CollectionDescriptor field = (CollectionDescriptor) collectionIterator.next();
                        if (this.isPropertyType(field.getJcrType())) {
                            propDefs.add(getPropertyDefinition(field.getFieldName(), field, nodeTypeDef.getName()));
                        } else {
                            nodeDefs.add(getNodeDefinition(field.getFieldName(), field, nodeTypeDef.getName()));
                        }
                    }
                }

                nodeTypeDef.setPropertyDefs((PropDef[]) propDefs.toArray(new PropDef[propDefs.size()]));
View Full Code Here

        this.retrieveBeanField(session, beanDescriptor, node, path, object, true);
      }
      // Check if the attribute is a collection
      else
      {
        CollectionDescriptor collectionDescriptor = classDescriptor.getCollectionDescriptor(attributeName);
        if (collectionDescriptor != null)
        {
          this.retrieveCollectionField(session, collectionDescriptor, node, object, true);
        }
        else
View Full Code Here

   */
  private void retrieveCollectionFields(Session session, ClassDescriptor classDescriptor, Node parentNode, Object object,
      boolean forceToRetrieve) {
    Iterator collectionDescriptorIterator = classDescriptor.getCollectionDescriptors().iterator();
    while (collectionDescriptorIterator.hasNext()) {
      CollectionDescriptor collectionDescriptor = (CollectionDescriptor) collectionDescriptorIterator.next();
      this.retrieveCollectionField(session, collectionDescriptor, parentNode, object, forceToRetrieve);
    }
  }
View Full Code Here

  private void insertCollectionFields(Session session, Object object, ClassDescriptor classDescriptor, Node objectNode) {
    Iterator collectionDescriptorIterator = classDescriptor.getCollectionDescriptors().iterator();

    while (collectionDescriptorIterator.hasNext()) {
      CollectionDescriptor collectionDescriptor = (CollectionDescriptor) collectionDescriptorIterator.next();

      if (!collectionDescriptor.isAutoInsert()) {
        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.mapper.model.CollectionDescriptor

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.