Examples of InMemoryDocumentTypeDefinition


Examples of org.apache.chemistry.opencmis.inmemory.types.InMemoryDocumentTypeDefinition

        return cmisType;
    }

    public static InMemoryDocumentTypeDefinition buildTypeWithMultiPickList() {
        InMemoryDocumentTypeDefinition cmisType = new InMemoryDocumentTypeDefinition(PICK_LIST_DOC_TYPE,
                "PickList Document Type for Validation", InMemoryDocumentTypeDefinition.getRootDocumentType());

        Map<String, PropertyDefinition<?>> propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
        // create a String property definition

        PropertyStringDefinitionImpl propDef = PropertyCreationHelper.createStringDefinition(PICK_LIST_PROP_DEF,
                "Sample PickList (choice) Property");
        List<Choice<String>> choiceList = new ArrayList<Choice<String>>();
        ChoiceImpl<String> elem = new ChoiceImpl<String>();
        List<String> valueList = new ArrayList<String>();
        valueList.add("red");
        valueList.add("green");
        valueList.add("blue");
        elem.setValue(valueList);
        elem.setDisplayName("RGB");
        choiceList.add(elem);

        elem = new ChoiceImpl<String>();
        valueList = new ArrayList<String>();
        valueList.add("cyan");
        valueList.add("magenta");
        valueList.add("yellow");
        valueList.add("black");
        elem.setValue(valueList);
        elem.setDisplayName("CMYK");
        choiceList.add(elem);

        propDef.setChoices(choiceList);
        // propDef.setDefaultValue(...);
        propDef.setCardinality(Cardinality.MULTI);
        propertyDefinitions.put(propDef.getId(), propDef);
        cmisType.setPropertyDefinitions(propertyDefinitions);

        return cmisType;
    }
View Full Code Here

Examples of org.apache.chemistry.opencmis.inmemory.types.InMemoryDocumentTypeDefinition

        return cmisType;
    }

    public static InMemoryDocumentTypeDefinition buildTypeWithHierachicalPickList(Cardinality cardinality) {
        InMemoryDocumentTypeDefinition cmisType = new InMemoryDocumentTypeDefinition(PICK_LIST_DOC_TYPE,
                "PickList Document Type for Validation", InMemoryDocumentTypeDefinition.getRootDocumentType());

        Map<String, PropertyDefinition<?>> propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
        // create a String property definition

        // Create a two-level pick list with an outer property list state and an
        // inner
        // list of city
        PropertyStringDefinitionImpl propDef = PropertyCreationHelper.createStringDefinition(PICK_LIST_PROP_DEF,
                "Sample PickList (choice) Property");
        List<Choice<String>> choiceListOuter = new ArrayList<Choice<String>>();

        ChoiceImpl<String> elemOuter = new ChoiceImpl<String>();
        elemOuter.setDisplayName("Bavaria");
        List<Choice<String>> choiceListInner = new ArrayList<Choice<String>>();
        ChoiceImpl<String> elemInner = new ChoiceImpl<String>();
        elemInner.setDisplayName("Munich");
        elemInner.setValue(Collections.singletonList("munich"));
        choiceListInner.add(elemInner);
        elemInner = new ChoiceImpl<String>();
        elemInner.setDisplayName("Ingolstadt");
        elemInner.setValue(Collections.singletonList("ingolstadt"));
        choiceListInner.add(elemInner);
        elemInner = new ChoiceImpl<String>();
        elemInner.setDisplayName("Passau");
        elemInner.setValue(Collections.singletonList("passau"));
        choiceListInner.add(elemInner);
        elemOuter.setChoice(choiceListInner);
        choiceListOuter.add(elemOuter);

        elemOuter = new ChoiceImpl<String>();
        elemOuter.setDisplayName("Baden Wurtemberg");
        choiceListInner = new ArrayList<Choice<String>>();
        elemInner = new ChoiceImpl<String>();
        elemInner.setDisplayName("Stuttgart");
        elemInner.setValue(Collections.singletonList("stuttgart"));
        choiceListInner.add(elemInner);
        elemInner = new ChoiceImpl<String>();
        elemInner.setDisplayName("Karlsruhe");
        elemInner.setValue(Collections.singletonList("karlsruhe"));
        choiceListInner.add(elemInner);
        elemInner = new ChoiceImpl<String>();
        elemInner.setDisplayName("Walldorf");
        elemInner.setValue(Collections.singletonList("walldorf"));
        choiceListInner.add(elemInner);
        elemOuter.setChoice(choiceListInner);
        choiceListOuter.add(elemOuter);

        propDef.setChoices(choiceListOuter);
        propDef.setCardinality(cardinality);
        propertyDefinitions.put(propDef.getId(), propDef);
        cmisType.setPropertyDefinitions(propertyDefinitions);

        return cmisType;
    }
View Full Code Here

Examples of org.apache.chemistry.opencmis.inmemory.types.InMemoryDocumentTypeDefinition

        TypeManagerImpl tm = new TypeManagerImpl();
        tm.initTypeSystem(null); // create CMIS default types

        // create super type
        InMemoryDocumentTypeDefinition cmisSuperType = new InMemoryDocumentTypeDefinition(DOC_TYPE_SUPER,
                "Document Type With a child", InMemoryDocumentTypeDefinition.getRootDocumentType());

        Map<String, PropertyDefinition<?>> propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
        // create a String property definition
        PropertyStringDefinitionImpl propDef = PropertyCreationHelper.createStringDefinition(STRING_PROP_TYPE_SUPER,
                "Sample String Property SuperType");
        propDef.setMaxLength(BigInteger.valueOf(10));
        propertyDefinitions.put(propDef.getId(), propDef);
        cmisSuperType.setPropertyDefinitions(propertyDefinitions);

        // create sub type
        InMemoryDocumentTypeDefinition cmisSubType = new InMemoryDocumentTypeDefinition(DOC_TYPE_SUB,
                "Document Type With a parent", cmisSuperType);

        propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
        // create a String property definition
        propDef = PropertyCreationHelper.createStringDefinition(STRING_PROP_TYPE_SUB, "Sample String Property Subtype");
        propDef.setMaxLength(BigInteger.valueOf(20));
        propertyDefinitions.put(propDef.getId(), propDef);
        cmisSubType.setPropertyDefinitions(propertyDefinitions);

        tm.addTypeDefinition(cmisSuperType);
        tm.addTypeDefinition(cmisSubType);

        return tm;
View Full Code Here

Examples of org.apache.chemistry.opencmis.inmemory.types.InMemoryDocumentTypeDefinition

        }

        private static List<TypeDefinition> buildTypesList() {
            List<TypeDefinition> typesList = new LinkedList<TypeDefinition>();

            InMemoryDocumentTypeDefinition cmisType1 = new InMemoryDocumentTypeDefinition("MyDocType1",
                    "My Type 1 Level 1", InMemoryDocumentTypeDefinition.getRootDocumentType());
            typesList.add(cmisType1);

            InMemoryDocumentTypeDefinition cmisType2 = new InMemoryDocumentTypeDefinition("MyDocType2",
                    "My Type 2 Level 1", InMemoryDocumentTypeDefinition.getRootDocumentType());
            typesList.add(cmisType2);

            InMemoryDocumentTypeDefinition cmisType11 = new InMemoryDocumentTypeDefinition("MyDocType1.1",
                    "My Type 3 Level 2", cmisType1);
            typesList.add(cmisType11);

            InMemoryDocumentTypeDefinition cmisType111 = new InMemoryDocumentTypeDefinition("MyDocType1.1.1",
                    "My Type 4 Level 3", cmisType11);
            typesList.add(cmisType111);

            InMemoryDocumentTypeDefinition cmisType112 = new InMemoryDocumentTypeDefinition("MyDocType1.1.2",
                    "My Type 5 Level 3", cmisType11);
            typesList.add(cmisType112);

            InMemoryDocumentTypeDefinition cmisType12 = new InMemoryDocumentTypeDefinition("MyDocType1.2",
                    "My Type 6 Level 2", cmisType1);
            typesList.add(cmisType12);

            InMemoryDocumentTypeDefinition cmisType21 = new InMemoryDocumentTypeDefinition("MyDocType2.1",
                    "My Type 7 Level 2", cmisType2);
            typesList.add(cmisType21);

            InMemoryDocumentTypeDefinition cmisType22 = new InMemoryDocumentTypeDefinition("MyDocType2.2",
                    "My Type 8 Level 2", cmisType2);
            typesList.add(cmisType22);
            InMemoryDocumentTypeDefinition cmisType23 = new InMemoryDocumentTypeDefinition("MyDocType2.3",
                    "My Type 9 Level 2", cmisType2);
            typesList.add(cmisType23);
            InMemoryDocumentTypeDefinition cmisType24 = new InMemoryDocumentTypeDefinition("MyDocType2.4",
                    "My Type 10 Level 2", cmisType2);
            typesList.add(cmisType24);
            InMemoryDocumentTypeDefinition cmisType25 = new InMemoryDocumentTypeDefinition("MyDocType2.5",
                    "My Type 11 Level 2", cmisType2);
            typesList.add(cmisType25);

            InMemoryDocumentTypeDefinition cmisType26 = new InMemoryDocumentTypeDefinition("MyDocType2.6",
                    "My Type 12 Level 2", cmisType2);
            typesList.add(cmisType26);
            InMemoryDocumentTypeDefinition cmisType27 = new InMemoryDocumentTypeDefinition("MyDocType2.7",
                    "My Type 13 Level 2", cmisType2);
            typesList.add(cmisType27);
            InMemoryDocumentTypeDefinition cmisType28 = new InMemoryDocumentTypeDefinition("MyDocType2.8",
                    "My Type 14 Level 2", cmisType2);
            typesList.add(cmisType28);
            InMemoryDocumentTypeDefinition cmisType29 = new InMemoryDocumentTypeDefinition("MyDocType2.9",
                    "My Type 15 Level 2", cmisType2);
            typesList.add(cmisType29);

            // create a complex type with properties
            InMemoryDocumentTypeDefinition cmisComplexType = new InMemoryDocumentTypeDefinition(COMPLEX_TYPE,
                    "Complex type with properties, Level 1", InMemoryDocumentTypeDefinition.getRootDocumentType());

            // create a boolean property definition

            Map<String, PropertyDefinition<?>> propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();

            PropertyDefinition<Boolean> prop = PropertyCreationHelper.createBooleanDefinition("BooleanProp",
                    "Sample Boolean Property");
            propertyDefinitions.put(prop.getId(), prop);

            prop = PropertyCreationHelper.createBooleanMultiDefinition("BooleanPropMV",
                    "Sample Boolean multi-value Property");
            propertyDefinitions.put(prop.getId(), prop);

            PropertyDateTimeDefinitionImpl prop2 = PropertyCreationHelper.createDateTimeDefinition("DateTimeProp",
                    "Sample DateTime Property");
            propertyDefinitions.put(prop2.getId(), prop2);

            prop2 = PropertyCreationHelper.createDateTimeMultiDefinition("DateTimePropMV",
                    "Sample DateTime multi-value Property");
            propertyDefinitions.put(prop2.getId(), prop2);

            PropertyDecimalDefinitionImpl prop3 = PropertyCreationHelper.createDecimalDefinition("DecimalProp",
                    "Sample Decimal Property");
            propertyDefinitions.put(prop3.getId(), prop3);

            prop3 = PropertyCreationHelper.createDecimalDefinition("DecimalPropMV",
                    "Sample Decimal multi-value Property");
            propertyDefinitions.put(prop3.getId(), prop3);

            PropertyHtmlDefinitionImpl prop4 = PropertyCreationHelper.createHtmlDefinition("HtmlProp",
                    "Sample Html Property");
            propertyDefinitions.put(prop4.getId(), prop4);

            prop4 = PropertyCreationHelper.createHtmlDefinition("HtmlPropMV", "Sample Html multi-value Property");
            propertyDefinitions.put(prop4.getId(), prop4);

            PropertyIdDefinitionImpl prop5 = PropertyCreationHelper.createIdDefinition("IdProp", "Sample Id Property");
            propertyDefinitions.put(prop5.getId(), prop5);

            prop5 = PropertyCreationHelper.createIdDefinition("IdPropMV", "Sample Id Html multi-value Property");
            propertyDefinitions.put(prop5.getId(), prop5);

            PropertyIntegerDefinitionImpl prop6 = PropertyCreationHelper.createIntegerDefinition("IntProp",
                    "Sample Int Property");
            propertyDefinitions.put(prop6.getId(), prop6);

            prop6 = PropertyCreationHelper.createIntegerDefinition("IntPropMV", "Sample Int multi-value Property");
            propertyDefinitions.put(prop6.getId(), prop6);

            PropertyStringDefinitionImpl prop7 = PropertyCreationHelper.createStringDefinition("StringProp",
                    "Sample String Property");
            propertyDefinitions.put(prop7.getId(), prop7);

            PropertyUriDefinitionImpl prop8 = PropertyCreationHelper.createUriDefinition("UriProp",
                    "Sample Uri Property");
            propertyDefinitions.put(prop8.getId(), prop8);

            prop8 = PropertyCreationHelper.createUriDefinition("UriPropMV", "Sample Uri multi-value Property");
            propertyDefinitions.put(prop8.getId(), prop8);

            PropertyStringDefinitionImpl prop9 = PropertyCreationHelper.createStringDefinition("PickListProp",
                    "Sample Pick List Property");
            List<Choice<String>> choiceList = new ArrayList<Choice<String>>();
            ChoiceImpl<String> elem = new ChoiceImpl<String>();
            elem.setValue(Collections.singletonList("red"));
            choiceList.add(elem);
            elem = new ChoiceImpl<String>();
            elem.setValue(Collections.singletonList("green"));
            choiceList.add(elem);
            elem = new ChoiceImpl<String>();
            elem.setValue(Collections.singletonList("blue"));
            choiceList.add(elem);
            elem = new ChoiceImpl<String>();
            elem.setValue(Collections.singletonList("black"));
            choiceList.add(elem);
            prop9.setChoices(choiceList);
            prop9.setDefaultValue(Collections.singletonList("blue"));

            /*
             * try short form: / PropertyCreationHelper.addElemToPicklist(prop9,
             * "red"); PropertyCreationHelper.addElemToPicklist(prop9, "green");
             * PropertyCreationHelper.addElemToPicklist(prop9, "blue");
             * PropertyCreationHelper.addElemToPicklist(prop9, "black");
             * PropertyCreationHelper.setDefaultValue(prop9, "blue"); /
             */

            cmisComplexType.addCustomPropertyDefinitions(propertyDefinitions);

            // add type to types collection
            typesList.add(cmisComplexType);

            // create a type hierarchy with inherited properties
            InMemoryDocumentTypeDefinition cmisDocTypeTopLevel = new InMemoryDocumentTypeDefinition(TOPLEVEL_TYPE,
                    "Document type with properties, Level 1", InMemoryDocumentTypeDefinition.getRootDocumentType());

            InMemoryDocumentTypeDefinition cmisDocTypeLevel1 = new InMemoryDocumentTypeDefinition(LEVEL1_TYPE,
                    "Document type with inherited properties, Level 2", cmisDocTypeTopLevel);

            InMemoryDocumentTypeDefinition cmisDocTypeLevel2 = new InMemoryDocumentTypeDefinition(LEVEL2_TYPE,
                    "Document type with inherited properties, Level 3", cmisDocTypeLevel1);

            propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
            PropertyStringDefinitionImpl propTop = PropertyCreationHelper.createStringDefinition("StringPropTopLevel",
                    "Sample String Property");
            propertyDefinitions.put(propTop.getId(), propTop);
            cmisDocTypeTopLevel.addCustomPropertyDefinitions(propertyDefinitions);

            propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
            PropertyStringDefinitionImpl propLevel1 = PropertyCreationHelper.createStringDefinition("StringPropLevel1",
                    "String Property Level 1");
            propertyDefinitions.put(propLevel1.getId(), propLevel1);
            cmisDocTypeLevel1.addCustomPropertyDefinitions(propertyDefinitions);

            propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
            PropertyStringDefinitionImpl propLevel2 = PropertyCreationHelper.createStringDefinition("StringPropLevel2",
                    "String Property Level 2");
            propertyDefinitions.put(propLevel2.getId(), propLevel2);
            cmisDocTypeLevel2.addCustomPropertyDefinitions(propertyDefinitions);

            // add type to types collection
            typesList.add(cmisDocTypeTopLevel);
            typesList.add(cmisDocTypeLevel1);
            typesList.add(cmisDocTypeLevel2);
View Full Code Here

Examples of org.apache.chemistry.opencmis.inmemory.types.InMemoryDocumentTypeDefinition

    private static List<TypeDefinition> buildTypesList() {
        // always add CMIS default types
        List<TypeDefinition> typesList = new LinkedList<TypeDefinition>();

        // create a complex type with properties
        InMemoryDocumentTypeDefinition cmisComplexType = new InMemoryDocumentTypeDefinition(
                VERSION_TEST_DOCUMENT_TYPE_ID, "VersionedType", InMemoryDocumentTypeDefinition.getRootDocumentType());

        // create a boolean property definition

        Map<String, PropertyDefinition<?>> propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();

        PropertyStringDefinitionImpl prop1 = PropertyCreationHelper.createStringDefinition(PROPERTY_ID,
                "Sample String Property");
        propertyDefinitions.put(prop1.getId(), prop1);

        cmisComplexType.addCustomPropertyDefinitions(propertyDefinitions);
        cmisComplexType.setIsVersionable(true); // make it a versionable type;

        // add type to types collection
        typesList.add(cmisComplexType);

        return typesList;
View Full Code Here

Examples of org.apache.chemistry.opencmis.inmemory.types.InMemoryDocumentTypeDefinition

         *
         * @return typesMap map filled with created types
         */
        public List<TypeDefinition> createTypesList() {
            List<TypeDefinition> typesList = new LinkedList<TypeDefinition>();
            InMemoryDocumentTypeDefinition cmisDocumentType = new InMemoryDocumentTypeDefinition(TEST_DOCUMENT_TYPE_ID,
                    "My Document Type", InMemoryDocumentTypeDefinition.getRootDocumentType());

            InMemoryFolderTypeDefinition cmisFolderType = new InMemoryFolderTypeDefinition(TEST_FOLDER_TYPE_ID,
                    "My Folder Type", InMemoryFolderTypeDefinition.getRootFolderType());
            // create a simple string property type and
            // attach the property definition to the type definition for
            // document and folder type
            Map<String, PropertyDefinition<?>> propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
            PropertyStringDefinitionImpl prop = PropertyCreationHelper.createStringDefinition(
                    TEST_DOCUMENT_STRING_PROP_ID, "Sample Doc String Property");
            propertyDefinitions.put(prop.getId(), prop);
            cmisDocumentType.addCustomPropertyDefinitions(propertyDefinitions);

            propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
            prop = PropertyCreationHelper.createStringDefinition(TEST_FOLDER_STRING_PROP_ID,
                    "Sample Folder String Property");
            propertyDefinitions.put(prop.getId(), prop);
            cmisFolderType.addCustomPropertyDefinitions(propertyDefinitions);

            InMemoryDocumentTypeDefinition customDocType = createCustomTypeWithStringIntProperty();
            // add type to types collection
            typesList.add(cmisDocumentType);
            typesList.add(cmisFolderType);
            typesList.add(customDocType);
            typesList.add(createCustomInheritedType(customDocType));
View Full Code Here

Examples of org.apache.chemistry.opencmis.inmemory.types.InMemoryDocumentTypeDefinition

            typesList.add(createFolderTypeWithDefault());
            return typesList;
        }

        private static InMemoryDocumentTypeDefinition createCustomTypeWithStringIntProperty() {
            InMemoryDocumentTypeDefinition cmisDocumentType = new InMemoryDocumentTypeDefinition(
                    TEST_CUSTOM_DOCUMENT_TYPE_ID, "My Custom Document Type", InMemoryDocumentTypeDefinition
                            .getRootDocumentType());
            Map<String, PropertyDefinition<?>> propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
            PropertyStringDefinitionImpl prop = PropertyCreationHelper.createStringDefinition(
                    TEST_DOCUMENT_MY_STRING_PROP_ID, "My String Property");
            prop.setIsRequired(false);
            prop.setMaxLength(BigInteger.valueOf(20)); // max len to 20
            propertyDefinitions.put(prop.getId(), prop);

            PropertyIntegerDefinitionImpl prop2 = PropertyCreationHelper.createIntegerDefinition(
                    TEST_DOCUMENT_MY_INT_PROP_ID, "My Integer Property");
            prop2.setIsRequired(true);
            prop2.setMinValue(BigInteger.valueOf(-10000));
            prop2.setMaxValue(BigInteger.valueOf(10000));
            propertyDefinitions.put(prop2.getId(), prop2);
            cmisDocumentType.addCustomPropertyDefinitions(propertyDefinitions);
            return cmisDocumentType;
        }
View Full Code Here

Examples of org.apache.chemistry.opencmis.inmemory.types.InMemoryDocumentTypeDefinition

            cmisDocumentType.addCustomPropertyDefinitions(propertyDefinitions);
            return cmisDocumentType;
        }

        private static InMemoryDocumentTypeDefinition createCustomInheritedType(InMemoryDocumentTypeDefinition baseType) {
            InMemoryDocumentTypeDefinition cmisDocumentType = new InMemoryDocumentTypeDefinition(
                    TEST_INHERITED_CUSTOM_DOCUMENT_TYPE_ID, "My Custom Document Type", baseType);
            Map<String, PropertyDefinition<?>> propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
            PropertyStringDefinitionImpl prop = PropertyCreationHelper.createStringDefinition(
                    TEST_DOCUMENT_MY_SUB_STRING_PROP_ID, "Subtype String Property");
            prop.setIsRequired(false);
            propertyDefinitions.put(prop.getId(), prop);

            PropertyIntegerDefinitionImpl prop2 = PropertyCreationHelper.createIntegerDefinition(
                    TEST_DOCUMENT_MY_SUB_INT_PROP_ID, "Subtype");
            prop2.setIsRequired(true);
            propertyDefinitions.put(prop2.getId(), prop2);
            cmisDocumentType.addCustomPropertyDefinitions(propertyDefinitions);
            return cmisDocumentType;
        }
View Full Code Here

Examples of org.apache.chemistry.opencmis.inmemory.types.InMemoryDocumentTypeDefinition

            cmisDocumentType.addCustomPropertyDefinitions(propertyDefinitions);
            return cmisDocumentType;
        }

        private static InMemoryDocumentTypeDefinition createDocumentTypeWithDefault() {
            InMemoryDocumentTypeDefinition cmisDocumentType = new InMemoryDocumentTypeDefinition(
                    TEST_DOC_TYPE_WITH_DEFAULTS_ID, "Document Type With default values", InMemoryDocumentTypeDefinition
                    .getRootDocumentType());
            Map<String, PropertyDefinition<?>> propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();
            PropertyStringDefinitionImpl prop = PropertyCreationHelper.createStringMultiDefinition(
                    TEST_DOCUMENT_MY_MULTI_STRING_PROP_ID, "Test Multi String Property");
            prop.setIsRequired(false);
            List<String> defValS = new ArrayList<String>() {{ add("Apache"); add("CMIS"); }};
            prop.setDefaultValue(defValS);
            propertyDefinitions.put(prop.getId(), prop);

            PropertyIntegerDefinitionImpl prop2 = PropertyCreationHelper.createIntegerDefinition(
                    TEST_DOCUMENT_MY_INT_PROP_ID, "Test Integer Property");
            prop2.setIsRequired(false);
            List<BigInteger> defVal = new ArrayList<BigInteger>() {{ add(BigInteger.valueOf(100)); }};
            prop2.setDefaultValue(defVal);
            propertyDefinitions.put(prop2.getId(), prop2);

            PropertyIntegerDefinitionImpl prop3 = PropertyCreationHelper.createIntegerDefinition(
                    TEST_DOCUMENT_MY_INT_PROP_ID_MANDATORY_DEFAULT, "Test Integer Property Mandatory default");
            prop3.setIsRequired(true);
            List<BigInteger> defVal2 = new ArrayList<BigInteger>() {{ add(BigInteger.valueOf(100)); }};
            prop3.setDefaultValue(defVal2);
            propertyDefinitions.put(prop3.getId(), prop3);

            cmisDocumentType.addCustomPropertyDefinitions(propertyDefinitions);

            return cmisDocumentType;
        }
View Full Code Here

Examples of org.apache.chemistry.opencmis.inmemory.types.InMemoryDocumentTypeDefinition

    protected  List<TypeDefinition> createTypes() {

        List<TypeDefinition> typeDefs = new ArrayList<TypeDefinition>();

        // First test type
        InMemoryDocumentTypeDefinition cmisType = new InMemoryDocumentTypeDefinition(MY_DOC_TYPE,
                "Document Type for Validation", InMemoryDocumentTypeDefinition.getRootDocumentType());

        Map<String, PropertyDefinition<?>> propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();

        PropertyBooleanDefinition prop1 = PropertyCreationHelper.createBooleanDefinition(BOOL_PROP,
                "Sample Boolean Property");
        ((PropertyBooleanDefinitionImpl) prop1).setIsRequired(true);
        propertyDefinitions.put(prop1.getId(), prop1);

        PropertyStringDefinition prop2 = PropertyCreationHelper.createStringDefinition(STRING_PROP,
                "Sample String Property");
        propertyDefinitions.put(prop2.getId(), prop2);

        PropertyIntegerDefinitionImpl prop3 = PropertyCreationHelper.createIntegerDefinition(INT_PROP,
                "Sample Integer Property");
        propertyDefinitions.put(prop2.getId(), prop2);

        cmisType.setPropertyDefinitions(propertyDefinitions);

        typeDefs.add(cmisType);
        myType = cmisType;

        // add another type definition with exactly the same properties
        cmisType = new InMemoryDocumentTypeDefinition(MY_DOC_TYPE_COPY,
                "Document Type Duplicated", InMemoryDocumentTypeDefinition.getRootDocumentType());
        cmisType.setPropertyDefinitions(propertyDefinitions); // add same properties
        typeDefs.add(cmisType);
        myTypeCopy = cmisType;


        // Second test type

        cmisType = new InMemoryDocumentTypeDefinition(BOOK_TYPE,
                "Book Document Type", InMemoryDocumentTypeDefinition.getRootDocumentType());

        propertyDefinitions = new HashMap<String, PropertyDefinition<?>>();

        prop2 = PropertyCreationHelper.createStringDefinition(TITLE_PROP, "Title of Book");
        propertyDefinitions.put(prop2.getId(), prop2);

        prop2 = PropertyCreationHelper.createStringDefinition(AUTHOR_PROP, "Author of Book");
        propertyDefinitions.put(prop2.getId(), prop2);

        prop3 = PropertyCreationHelper.createIntegerDefinition(ISBN_PROP,
                "ISBN of Book");
        propertyDefinitions.put(prop3.getId(), prop3);

        PropertyDateTimeDefinitionImpl prop4 = PropertyCreationHelper.createDateTimeDefinition(PUB_DATE_PROP,
                "Publishing Date of Book");
        propertyDefinitions.put(prop4.getId(), prop4);

        cmisType.setPropertyDefinitions(propertyDefinitions);

        typeDefs.add(cmisType);
        bookType = cmisType;

        return typeDefs;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.