示例#1
0
        public IItemEnumerable <IObjectType> GetTypeChildren(string typeId, bool includePropertyDefinitions)
        {
            IRepositoryService service = Binding.GetRepositoryService();

            PageFetcher <IObjectType> .FetchPage fetchPageDelegate = delegate(long maxNumItems, long skipCount)
            {
                // fetch the data
                ITypeDefinitionList tdl = service.GetTypeChildren(RepositoryId, typeId, includePropertyDefinitions, maxNumItems, skipCount, null);

                // convert type definitions
                int count = (tdl != null && tdl.List != null ? tdl.List.Count : 0);
                IList <IObjectType> page = new List <IObjectType>(count);
                if (count > 0)
                {
                    foreach (ITypeDefinition typeDefinition in tdl.List)
                    {
                        page.Add(ObjectFactory.ConvertTypeDefinition(typeDefinition));
                    }
                }

                return(new PageFetcher <IObjectType> .Page <IObjectType>(page, tdl.NumItems, tdl.HasMoreItems));
            };

            return(new CollectionEnumerable <IObjectType>(new PageFetcher <IObjectType>(DefaultContext.MaxItemsPerPage, fetchPageDelegate)));
        }
示例#2
0
        public void TestTypeChildren()
        {
            ITypeDefinitionList typeList = Binding.GetRepositoryService().GetTypeChildren(RepositoryInfo.Id, null, null, null, null, null);

            Assert.NotNull(typeList);
            Assert.NotNull(typeList.List);
            Assert.NotNull(typeList.NumItems);
            Assert.True(typeList.NumItems >= 2);
            Assert.True(typeList.NumItems <= 4);

            bool foundDocument = false;
            bool foundFolder   = false;

            foreach (ITypeDefinition type in typeList.List)
            {
                Assert.NotNull(type);
                Assert.NotNull(type.Id);

                if (type.Id == "cmis:document")
                {
                    foundDocument = true;
                }
                if (type.Id == "cmis:folder")
                {
                    foundFolder = true;
                }
            }

            Assert.True(foundDocument);
            Assert.True(foundFolder);
        }
示例#3
0
        public ITypeDefinitionList GetTypeChildren(string repositoryId, string typeId, bool?includePropertyDefinitions,
                                                   long?maxItems, long?skipCount, IExtensionsData extension)
        {
            ITypeDefinitionList result = null;
            bool hasExtension          = (extension != null) && (extension.Extensions != null) && (extension.Extensions.Count > 0);

            // get the SPI and fetch the type definitions
            ICmisSpi spi = session.GetSpi();

            result = spi.GetRepositoryService().GetTypeChildren(repositoryId, typeId, includePropertyDefinitions, maxItems,
                                                                skipCount, extension);

            // put it into the cache
            if (!hasExtension && (includePropertyDefinitions ?? false) && (result != null) && (result.List != null))
            {
                TypeDefinitionCache cache = session.GetTypeDefinitionCache();
                foreach (ITypeDefinition tdd in result.List)
                {
                    cache.Put(repositoryId, tdd);
                }
            }

            return(result);
        }