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

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


        return fd;
    }

    private FieldDescriptor parseFieldDescriptor() throws XmlPullParserException {
        FieldDescriptor fd = new FieldDescriptor();

        /*
         *  fieldName CDATA #REQUIRED
         *  jcrName CDATA #IMPLIED
         *  id (true | false) "false"
         *  path (true | false) "false"
         *  jcrType (String | Date | Long | Double | Boolean | Binary) #IMPLIED
         *  jcrAutoCreated (true | false) "false"
         *  jcrMandatory (true | false) "false"
         *  jcrOnParentVersion (COPY | VERSION | INITIALIZE | COMPUTE | IGNORE | ABORT) "COPY"
         *  jcrProtected (true | false) "false"
         *  jcrMultiple (true | false) "false"
         */

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

        fd.setId(this.getOptionalAttribute("id", false));
        fd.setPath(this.getOptionalAttribute("path", false));

        fd.setJcrType(this.getOptionalAttribute("jcrType"));
        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.setJcrMultiple(this.getOptionalAttribute("jcrMultiple", false));
        fd.setJcrDefaultValue(this.getOptionalAttribute("jcrDefaultValue"));

        return fd;
    }
View Full Code Here


        return fd;
    }

    private FieldDescriptor parseFieldDescriptor() throws XmlPullParserException {
        FieldDescriptor fd = new FieldDescriptor();

        /*
         *  fieldName CDATA #REQUIRED
         *  jcrName CDATA #IMPLIED
         *  id (true | false) "false"
         *  path (true | false) "false"
         *  jcrType (String | Date | Long | Double | Boolean | Binary) #IMPLIED
         *  jcrAutoCreated (true | false) "false"
         *  jcrMandatory (true | false) "false"
         *  jcrOnParentVersion (COPY | VERSION | INITIALIZE | COMPUTE | IGNORE | ABORT) "COPY"
         *  jcrProtected (true | false) "false"
         *  jcrMultiple (true | false) "false"
         */

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

        fd.setId(this.getOptionalAttribute("id", false));
        fd.setPath(this.getOptionalAttribute("path", false));

        fd.setJcrType(this.getOptionalAttribute("jcrType"));
        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.setJcrMultiple(this.getOptionalAttribute("jcrMultiple", false));
        fd.setJcrDefaultValue(this.getOptionalAttribute("jcrDefaultValue"));

        return fd;
    }
View Full Code Here

                if (classDescriptor.getFieldDescriptors() != null)
                {
                    Iterator fieldIterator = classDescriptor.getFieldDescriptors().iterator();
                    while (fieldIterator.hasNext())
                    {
                        FieldDescriptor field = (FieldDescriptor) fieldIterator.next();
                        if (!field.isPath()) {
                            propDefs.add(getPropertyDefinition(field.getFieldName(), field, nodeTypeDef.getName()));
                        }
                    }
                }

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

                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.TestClass");
        classDescriptor.setJcrType("ocm:test2");
        classDescriptor.setJcrSuperTypes("nt:base");
       
        FieldDescriptor field1 = new FieldDescriptor();
        field1.setFieldName("a");
        field1.setJcrName("ocm:a");
        field1.setJcrType("String");
        field1.setJcrAutoCreated(true);
        field1.setJcrMandatory(true);
        field1.setJcrMultiple(true);       
        classDescriptor.addFieldDescriptor(field1);

        FieldDescriptor field2 = new FieldDescriptor();
        field2.setFieldName("b");
        field2.setJcrName("ocm:b");
        field2.setJcrType("Long");
        field1.setJcrAutoCreated(false);
        field1.setJcrMandatory(true);
        field1.setJcrMultiple(false);       
        classDescriptor.addFieldDescriptor(field2);       
View Full Code Here

        ClassDescriptor classDescriptor = new ClassDescriptor();
        classDescriptor.setClassName("test.Test3Class");
        classDescriptor.setJcrType("test3");
        classDescriptor.setJcrSuperTypes("nt:base");

        FieldDescriptor field1 = new FieldDescriptor();
        field1.setFieldName("a");
        field1.setJcrName("a");
        field1.setJcrType("String");
        classDescriptor.addFieldDescriptor(field1);

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

    {
        ClassDescriptor classDescriptor = new ClassDescriptor();
        classDescriptor.setClassName("test.Test4Class");
        classDescriptor.setJcrSuperTypes("nt:base");

        FieldDescriptor field1 = new FieldDescriptor();
        field1.setFieldName("a");
        field1.setJcrName("a");
        field1.setJcrType("String");
        classDescriptor.addFieldDescriptor(field1);

        getJackrabbitNodeTypeManagerImpl().createSingleNodeType(session, classDescriptor);
       
        NodeType test4 = session.getWorkspace().getNodeTypeManager().getNodeType("test.Test4Class");
View Full Code Here

        ClassDescriptor classDescriptor = new ClassDescriptor();
        classDescriptor.setClassName("test.Test5Class");
        classDescriptor.setJcrType("ocm:test5");
        classDescriptor.setJcrSuperTypes("ocm:test2");
       
        FieldDescriptor field1 = new FieldDescriptor();
        field1.setFieldName("abc");
        classDescriptor.addFieldDescriptor(field1);

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

        ClassDescriptor classDescriptor = new ClassDescriptor();
        classDescriptor.setClassName("test.Test6Class");
        classDescriptor.setJcrType("nt:test3");
        classDescriptor.setJcrSuperTypes("nt:base");

        FieldDescriptor field1 = new FieldDescriptor();
        field1.setFieldName("a");
        field1.setJcrName("a");
        field1.setJcrType("String");
        classDescriptor.addFieldDescriptor(field1);
       
        boolean failed = false;
       
        try
View Full Code Here

        ClassDescriptor classDescriptor = new ClassDescriptor();
        classDescriptor.setClassName("test.Test6Class");
        classDescriptor.setJcrType("ocm:test6");
        classDescriptor.setJcrSuperTypes("nt:base");
       
        FieldDescriptor field1 = new FieldDescriptor();
        field1.setFieldName("a");
        field1.setJcrName("ocm:a");
        field1.setJcrType("String");
        classDescriptor.addFieldDescriptor(field1);

        FieldDescriptor field2 = new FieldDescriptor();
        field2.setFieldName("b");
        field2.setJcrName("ocm:b");
        field2.setJcrType("Long");
        classDescriptor.addFieldDescriptor(field2);
       
        ClassDescriptor classDescriptor2 = new ClassDescriptor();
        classDescriptor2.setClassName("test.Test7Class");
        classDescriptor2.setJcrType("ocm:test7");
        classDescriptor2.setJcrSuperTypes("nt:base");
       
        FieldDescriptor field3 = new FieldDescriptor();
        field3.setFieldName("a");
        field3.setJcrName("ocm:a");
        field3.setJcrType("String");
        classDescriptor2.addFieldDescriptor(field3);

        FieldDescriptor field4 = new FieldDescriptor();
        field4.setFieldName("b");
        field4.setJcrName("ocm:b");
        field4.setJcrType("Long");
        classDescriptor2.addFieldDescriptor(field4);
       
        ClassDescriptor[] classDescriptorArray = new ClassDescriptor[2];
        classDescriptorArray[0] = classDescriptor;
        classDescriptorArray[1] = classDescriptor2;
View Full Code Here

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

        FieldDescriptor field1 = new FieldDescriptor();
        field1.setFieldName("a");
        field1.setJcrName("a");
        field1.setJcrType("String");
        classDescriptor.addFieldDescriptor(field1);

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

TOP

Related Classes of org.apache.jackrabbit.ocm.mapper.model.FieldDescriptor

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.