TypeDefinitionFactory { public TypeDefinitionList createTypeDefinitionList(List<TypeDefinition> list, boolean hasMoreItems, BigInteger numItems) { if (list == null) { throw new IllegalArgumentException("List must be set!"); } if (numItems != null && numItems.signum() < 0) { throw new IllegalArgumentException("Number of items is negative!"); } TypeDefinitionListImpl result = new TypeDefinitionListImpl(list); result.setHasMoreItems(hasMoreItems); result.setNumItems(numItems); return result; } private  TypeDefinitionFactory(); static TypeDefinitionFactory newInstance(); Class<? extends MutableDocumentTypeDefinition> getDocumentTypeDefinitionClass(); void setDocumentTypeDefinitionClass(
            Class<? extends MutableDocumentTypeDefinition> documentTypeDefinitionClass); Class<? extends MutableFolderTypeDefinition> getFolderTypeDefinitionClass(); void setFolderTypeDefinitionClass(Class<? extends MutableFolderTypeDefinition> folderTypeDefinitionClass); Class<? extends MutablePolicyTypeDefinition> getPolicyTypeDefinitionClass(); void setPolicyTypeDefinitionClass(Class<? extends MutablePolicyTypeDefinition> policyTypeDefinitionClass); Class<? extends MutableRelationshipTypeDefinition> getRelationshipTypeDefinitionClass(); void setRelationshipTypeDefinitionClass(
            Class<? extends MutableRelationshipTypeDefinition> relationshipTypeDefinitionClass); Class<? extends MutableItemTypeDefinition> getItemTypeDefinitionClass(); void setItemTypeDefinitionClass(Class<? extends MutableItemTypeDefinition> itemTypeDefinitionClass); Class<? extends MutableSecondaryTypeDefinition> getSecondaryTypeDefinitionClass(); void setSecondaryTypeDefinitionClass(
            Class<? extends MutableSecondaryTypeDefinition> secondaryTypeDefinitionClass); String getDefaultNamespace(); void setDefaultNamespace(String defaultNamespace); boolean getDefaultIsFulltextIndexed(); void setDefaultIsFulltextIndexed(boolean defaultIsFullTextIndexed); boolean getDefaultControllableAcl(); void setDefaultControllableAcl(boolean defaultControllableAcl); boolean getDefaultControllablePolicy(); void setDefaultControllablePolicy(boolean defaultControllablePolicy); boolean getDefaultQueryable(); void setDefaultQueryable(boolean defaultQueryable); boolean getDefaultFulltextIndexed(); void setDefaultFulltextIndexed(boolean defaultFulltextIndexed); TypeMutability getDefaultTypeMutability(); void setDefaultTypeMutability(TypeMutability defaultTypeMutability); TypeMutability createTypeMutability(Boolean canCreate, Boolean canUpdate, Boolean canDelete); MutableDocumentTypeDefinition createBaseDocumentTypeDefinition(CmisVersion cmisVersion); MutableDocumentTypeDefinition createDocumentTypeDefinition(CmisVersion cmisVersion, String parentId); MutableFolderTypeDefinition createBaseFolderTypeDefinition(CmisVersion cmisVersion); MutableFolderTypeDefinition createFolderTypeDefinition(CmisVersion cmisVersion, String parentId); MutablePolicyTypeDefinition createBasePolicyTypeDefinition(CmisVersion cmisVersion); MutablePolicyTypeDefinition createPolicyTypeDefinition(CmisVersion cmisVersion, String parentId); MutableRelationshipTypeDefinition createBaseRelationshipTypeDefinition(CmisVersion cmisVersion); MutableRelationshipTypeDefinition createRelationshipTypeDefinition(CmisVersion cmisVersion,
            String parentId); MutableItemTypeDefinition createBaseItemTypeDefinition(CmisVersion cmisVersion); MutableItemTypeDefinition createItemTypeDefinition(CmisVersion cmisVersion, String parentId); MutableSecondaryTypeDefinition createBaseSecondaryTypeDefinition(CmisVersion cmisVersion); MutableSecondaryTypeDefinition createSecondaryTypeDefinition(CmisVersion cmisVersion, String parentId); MutableTypeDefinition createChildTypeDefinition(TypeDefinition parentTypeDefinition, String id); MutableTypeDefinition createChildTypeDefinition(TypeDefinition parentTypeDefinition, String id,
            String localName, String queryName, String displayName, String description,
            boolean includePropertyDefinitions, CmisVersion cmisVersion); MutablePropertyDefinition<?> createPropertyDefinition(String id, String displayName, String description,
            PropertyType datatype, Cardinality cardinality, Updatability updateability, boolean inherited,
            boolean required, boolean queryable, boolean orderable); Choice<T> createChoice(String displayName, T value); Choice<T> createChoice(String displayName, List<T> value); Choice<T> createChoiceWithSubChoices(String displayName, List<Choice<T>> subChoice); TypeDefinitionList createTypeDefinitionList(List<TypeDefinition> list, boolean hasMoreItems,
            BigInteger numItems); TypeDefinitionList createTypeDefinitionList(Map<String, TypeDefinition> allTypes, String typeId,
            Boolean includePropertyDefinitions, BigInteger maxItems, BigInteger skipCount); TypeDefinitionList createTypeDefinitionList(Map<String, TypeDefinition> allTypes, String typeId,
            Boolean includePropertyDefinitions, BigInteger maxItems, BigInteger skipCount, CmisVersion cmisVersion); TypeDefinitionContainer createTypeDefinitionContainer(TypeDefinition typeDef,
            List<TypeDefinitionContainer> children); List<TypeDefinitionContainer> createTypeDescendants(Map<String, TypeDefinition> allTypes, String typeId,
            BigInteger depth, Boolean includePropertyDefinitions); List<TypeDefinitionContainer> createTypeDescendants(Map<String, TypeDefinition> allTypes, String typeId,
            BigInteger depth, Boolean includePropertyDefinitions, CmisVersion cmisVersion); MutableTypeDefinition copy(TypeDefinition sourceTypeDefintion, boolean includePropertyDefinitions); MutableTypeDefinition copy(TypeDefinition sourceTypeDefintion, boolean includePropertyDefinitions,
            CmisVersion cmisVersion); MutablePropertyDefinition<?> copy(PropertyDefinition<?> sourcePropertyDefinition);  }
@Test public void testCreateTypeDefinitionList() { TypeDefinitionFactory tdf = TypeDefinitionFactory.newInstance(); CmisVersion cmisVersion = CmisVersion.CMIS_1_1; Map<String, TypeDefinition> types = new HashMap<String, TypeDefinition>(); TypeDefinition type; TypeDefinition docType; TypeDefinition folderType; docType = tdf.createBaseDocumentTypeDefinition(cmisVersion); types.put(docType.getId(), docType); type = tdf.createChildTypeDefinition(docType, "test:docType1"); types.put(type.getId(), type); type = tdf.createChildTypeDefinition(docType, "test:docType2"); types.put(type.getId(), type); type = tdf.createChildTypeDefinition(docType, "test:docType3"); types.put(type.getId(), type); type = tdf.createChildTypeDefinition(docType, "test:docType4"); types.put(type.getId(), type); type = tdf.createChildTypeDefinition(docType, "test:docType5"); types.put(type.getId(), type); folderType = tdf.createBaseFolderTypeDefinition(cmisVersion); types.put(folderType.getId(), folderType); TypeDefinitionList tdl1 = tdf.createTypeDefinitionList(types, null, true, null, null); assertNotNull(tdl1); assertEquals(2, tdl1.getList().size()); assertEquals(2, tdl1.getNumItems().intValue()); assertEquals(Boolean.FALSE, tdl1.hasMoreItems()); assertEquals("cmis:document", tdl1.getList().get(0).getId()); assertEquals("cmis:folder", tdl1.getList().get(1).getId()); assertEquals(26, tdl1.getList().get(0).getPropertyDefinitions().size()); assertEquals(14, tdl1.getList().get(1).getPropertyDefinitions().size()); TypeDefinitionList tdl2 = tdf.createTypeDefinitionList(types, "cmis:document", false, null, null); assertNotNull(tdl2); assertEquals(5, tdl2.getList().size()); assertEquals(5, tdl2.getNumItems().intValue()); assertEquals(Boolean.FALSE, tdl2.hasMoreItems()); assertTrue(tdl2.getList().get(0).getPropertyDefinitions().isEmpty()); TypeDefinitionList tdl3 = tdf.createTypeDefinitionList(types, "cmis:document", true, BigInteger.valueOf(3), BigInteger.ZERO); assertNotNull(tdl3); assertEquals(3, tdl3.getList().size()); assertEquals(5, tdl3.getNumItems().intValue()); assertEquals(Boolean.TRUE, tdl3.hasMoreItems()); assertFalse(tdl3.getList().get(0).getPropertyDefinitions().isEmpty()); TypeDefinitionList tdl4 = tdf.createTypeDefinitionList(types, "cmis:document", true, BigInteger.valueOf(3), BigInteger.valueOf(2)); assertNotNull(tdl4); assertEquals(3, tdl4.getList().size()); assertEquals(5, tdl4.getNumItems().intValue()); assertEquals(Boolean.FALSE, tdl4.hasMoreItems()); TypeDefinitionList tdl5 = tdf.createTypeDefinitionList(types, "cmis:document", true, BigInteger.valueOf(2), BigInteger.valueOf(2)); assertNotNull(tdl5); assertEquals(2, tdl5.getList().size()); assertEquals(5, tdl5.getNumItems().intValue()); assertEquals(Boolean.TRUE, tdl5.hasMoreItems()); assertEquals("test:docType1", tdl2.getList().get(0).getId()); assertEquals("test:docType2", tdl2.getList().get(1).getId()); assertEquals("test:docType3", tdl2.getList().get(2).getId()); assertEquals("test:docType4", tdl2.getList().get(3).getId()); assertEquals("test:docType5", tdl2.getList().get(4).getId()); assertEquals(tdl2.getList().get(0).getId(), tdl3.getList().get(0).getId()); assertEquals(tdl2.getList().get(2).getId(), tdl4.getList().get(0).getId()); assertEquals(tdl2.getList().get(2).getId(), tdl5.getList().get(0).getId()); assertEquals(tdl4.getList().get(0).getId(), tdl5.getList().get(0).getId()); }