Package org.apache.chemistry.opencmis.commons.definitions

Examples of org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionList


        String typeId = "cmis:document";

        // get all children
        BigInteger maxItems = BigInteger.valueOf(1000);
        BigInteger skipCount = BigInteger.valueOf(0);
        TypeDefinitionList children = fRepSvc.getTypeChildren(repositoryId, typeId, null, maxItems, skipCount, null);

        children = fRepSvc.getTypeChildren(repositoryId, typeId, null, maxItems, null, null);

        for (TypeDefinition type : children.getList()) {
            assertNull(type.getPropertyDefinitions());
        }

        log.info("... testGetTypeChildrenNoProperties() finished.");
    }
View Full Code Here


        } catch (CmisObjectNotFoundException e) {
            log.info("getTypeDefinition() with unknown type raised expected exception: " + e);
        }

        try {
            TypeDefinitionList types = fRepSvc.getTypeChildren(wrongRepositoryId, "CMISDocument", Boolean.TRUE,
                    BigInteger.valueOf(100), BigInteger.ZERO, null);
            log.debug("getTypeChildren(): " + types);
            fail("getTypeDescendants() with unknown type should throw InvalidArgumentException.");
        } catch (CmisInvalidArgumentException e) {
            log.info("getTypeDescendants() with unknown repository id raised expected exception: " + e);
        }

        try {
            TypeDefinitionList types = fRepSvc.getTypeChildren(repositoryId, wrongTypeId, Boolean.TRUE, BigInteger
                    .valueOf(100), BigInteger.ZERO, null);
            log.debug("getTypeChildren(): " + types);
            fail("getTypeDescendants() with unknown type should throw exception.");
        } catch (CmisInvalidArgumentException e) {
            log.info("getTypeDescendants() with unknown type raised expected exception: " + e);
View Full Code Here

        // policies and relationships
        info.setSupportsRelationships(false);
        info.setSupportsPolicies(false);

        TypeDefinitionList baseTypesList = getTypeChildren(repositoryId, null, Boolean.FALSE, BigInteger.valueOf(4),
                BigInteger.ZERO, null);
        for (TypeDefinition type : baseTypesList.getList()) {
            if (BaseTypeId.CMIS_RELATIONSHIP.value().equals(type.getId())) {
                info.setSupportsRelationships(true);
            } else if (BaseTypeId.CMIS_POLICY.value().equals(type.getId())) {
                info.setSupportsPolicies(true);
            }
View Full Code Here

        String typeId = "MyDocType2";

        // get all children
        BigInteger maxItems = BigInteger.valueOf(1000);
        BigInteger skipCount = BigInteger.valueOf(0);
        TypeDefinitionList children = fRepSvc.getTypeChildren(repositoryId, typeId, true, maxItems, skipCount, null);

        for (TypeDefinition type : children.getList()) {
            log.info("Found type: " + type.getId() + ", display name is: " + type.getDisplayName());
            containsAllBasePropertyDefinitions(type);
        }
        assertEquals(9, children.getList().size());
        assertEquals(9, children.getNumItems().intValue());
        assertFalse(children.hasMoreItems());

        // get a chunk
        maxItems = BigInteger.valueOf(5);
        skipCount = BigInteger.valueOf(3);
        children = fRepSvc.getTypeChildren(repositoryId, typeId, true, maxItems, skipCount, null);

        for (TypeDefinition type : children.getList()) {
            log.info("Found type: " + type.getId() + ", display name is: " + type.getDisplayName());
            containsAllBasePropertyDefinitions(type);
        }
        assertEquals(5, children.getList().size());
        assertEquals(9, children.getNumItems().intValue());
        assertTrue(children.hasMoreItems());

        log.info("... testGetTypeChildren() finished.");
    }
View Full Code Here

        } catch (CmisObjectNotFoundException e) {
            log.info("getTypeDefinition() with unknown type raised expected exception: " + e);
        }

        try {
            TypeDefinitionList types = fRepSvc.getTypeChildren(wrongRepositoryId, "CMISDocument", Boolean.TRUE,
                    BigInteger.valueOf(100), BigInteger.ZERO, null);
            log.debug("getTypeChildren(): " + types);
            fail("getTypeDescendants() with unknown type should throw InvalidArgumentException.");
        } catch (CmisInvalidArgumentException e) {
            log.info("getTypeDescendants() with unknown repository id raised expected exception: " + e);
        }

        try {
            TypeDefinitionList types = fRepSvc.getTypeChildren(repositoryId, wrongTypeId, Boolean.TRUE, BigInteger
                    .valueOf(100), BigInteger.ZERO, null);
            log.debug("getTypeChildren(): " + types);
            fail("getTypeDescendants() with unknown type should throw exception.");
        } catch (CmisInvalidArgumentException e) {
            log.info("getTypeDescendants() with unknown type raised expected exception: " + e);
View Full Code Here

            @Override
            protected AbstractPageFetcher.Page<ObjectType> fetchPage(long skipCount) {

                // fetch the data
                TypeDefinitionList tdl = repositoryService.getTypeChildren(SessionImpl.this.getRepositoryId(), typeId,
                        includePropertyDefinitions, BigInteger.valueOf(this.maxNumItems),
                        BigInteger.valueOf(skipCount), null);

                // convert type definitions
                List<ObjectType> page = new ArrayList<ObjectType>(tdl.getList().size());
                for (TypeDefinition typeDefinition : tdl.getList()) {
                    page.add(objectFactory.convertTypeDefinition(typeDefinition));
                }

                return new AbstractPageFetcher.Page<ObjectType>(page, tdl.getNumItems(), tdl.hasMoreItems()) {
                };
            }
        });
    }
View Full Code Here

        String typeId = "MyDocType2";

        // get all children
        BigInteger maxItems = BigInteger.valueOf(1000);
        BigInteger skipCount = BigInteger.valueOf(0);
        TypeDefinitionList children = fRepSvc.getTypeChildren(repositoryId, typeId, true, maxItems, skipCount, null);

        for (TypeDefinition type : children.getList()) {
            log.info("Found type: " + type.getId() + ", display name is: " + type.getDisplayName());
            containsAllBasePropertyDefinitions(type);
        }
        assertEquals(9, children.getList().size());
        assertEquals(9, children.getNumItems().intValue());
        assertFalse(children.hasMoreItems());

        // get a chunk
        maxItems = BigInteger.valueOf(5);
        skipCount = BigInteger.valueOf(3);
        children = fRepSvc.getTypeChildren(repositoryId, typeId, true, maxItems, skipCount, null);

        for (TypeDefinition type : children.getList()) {
            log.info("Found type: " + type.getId() + ", display name is: " + type.getDisplayName());
            containsAllBasePropertyDefinitions(type);
        }
        assertEquals(5, children.getList().size());
        assertEquals(9, children.getNumItems().intValue());
        assertTrue(children.hasMoreItems());

        log.info("... testGetTypeChildren() finished.");
    }
View Full Code Here

        String typeId = "cmis:document";

        // get all children
        BigInteger maxItems = BigInteger.valueOf(1000);
        BigInteger skipCount = BigInteger.valueOf(0);
        TypeDefinitionList children = fRepSvc.getTypeChildren(repositoryId, typeId, null, maxItems, skipCount, null);

        children = fRepSvc.getTypeChildren(repositoryId, typeId, null, maxItems, null, null);

        for (TypeDefinition type : children.getList()) {
            assertNull(type.getPropertyDefinitions());
        }

        log.info("... testGetTypeChildrenNoProperties() finished.");
    }
View Full Code Here

        } catch (CmisObjectNotFoundException e) {
            log.info("getTypeDefinition() with unknown type raised expected exception: " + e);
        }

        try {
            TypeDefinitionList types = fRepSvc.getTypeChildren(wrongRepositoryId, "CMISDocument", Boolean.TRUE,
                    BigInteger.valueOf(100), BigInteger.ZERO, null);
            log.debug("getTypeChildren(): " + types);
            fail("getTypeDescendants() with unknown type should throw InvalidArgumentException.");
        } catch (CmisInvalidArgumentException e) {
            log.info("getTypeDescendants() with unknown repository id raised expected exception: " + e);
        }

        try {
            TypeDefinitionList types = fRepSvc.getTypeChildren(repositoryId, wrongTypeId, Boolean.TRUE, BigInteger
                    .valueOf(100), BigInteger.ZERO, null);
            log.debug("getTypeChildren(): " + types);
            fail("getTypeDescendants() with unknown type should throw exception.");
        } catch (CmisInvalidArgumentException e) {
            log.info("getTypeDescendants() with unknown type raised expected exception: " + e);
View Full Code Here

        return result;
    }

    public TypeDefinitionList getTypeChildren(String repositoryId, String typeId, Boolean includePropertyDefinitions,
            BigInteger maxItems, BigInteger skipCount, ExtensionsData extension) {
        TypeDefinitionList result = null;
        boolean hasExtension = (extension != null) && (!extension.getExtensions().isEmpty());
        boolean propDefs = (includePropertyDefinitions == null ? false : includePropertyDefinitions.booleanValue());

        // get the SPI and fetch the type definitions
        CmisSpi spi = CmisBindingsHelper.getSPI(session);
        result = spi.getRepositoryService().getTypeChildren(repositoryId, typeId, includePropertyDefinitions, maxItems,
                skipCount, extension);

        // put it into the cache
        if (!hasExtension && propDefs && (result != null)) {
            TypeDefinitionCache cache = CmisBindingsHelper.getTypeDefinitionCache(session);

            for (TypeDefinition tdd : result.getList()) {
                cache.put(repositoryId, tdd);
            }
        }

        return result;
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.commons.definitions.TypeDefinitionList

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.