private cmisTypeDefinitionType[] assertGetTypeChildrenResponse(RepositoryServicePortClient client, int maxItems, int skipCount)
        {
            string repositoryId = getAndAssertRepositoryId();

            logger.log("Getting types for repositoryId=" + repositoryId);
            logger.log("[RepositoryService->getTypeChildren]");
            cmisTypeDefinitionListType types = client.getTypeChildren(repositoryId, BASE_TYPE_DOCUMENT, false, Convert.ToString(maxItems), Convert.ToString(skipCount), null);

            Assert.IsNotNull(types, "types response is null");
            Assert.IsNotNull(types.types, "types are undefined");
            logger.log("Types were recieved, number of types=" + types.types.Length);
            return(types.types);
        }
示例#2
0
        public getTypeChildrenResponse GetTypeChildren(getTypeChildrenRequest request)
        {
            if (string.IsNullOrEmpty(request.typeId))
            {
                var types = SupportedBaseObjectTypes;
                cmisTypeDefinitionListType list = new cmisTypeDefinitionListType();
                list.numItems = types.Count().ToString();
                if (!string.IsNullOrEmpty(request.maxItems))
                {
                    var maxItems = request.maxItems.As <int>();
                    if (SupportedBaseObjectTypes.Length > maxItems)
                    {
                        list.hasMoreItems = true;
                    }
                    types = types.Take(maxItems).ToArray();
                }
                list.types = SupportedBaseObjectTypes;
                return(new getTypeChildrenResponse(list));
            }
            else if (request.typeId.ToLower() == "cmis:document")
            {
                var repository = ModelHelper.GetRepository(request.repositoryId);
                cmisTypeDefinitionListType list = new cmisTypeDefinitionListType();
                var schemas = _schemaManager.All(repository, "");
                list.numItems = schemas.Count().ToString();
                var skipCount = request.skipCount.As <int>();
                schemas = schemas.Skip(skipCount);
                if (!string.IsNullOrEmpty(request.maxItems))
                {
                    var maxItems = request.maxItems.As <int>();
                    if (schemas.Count() > maxItems)
                    {
                        list.hasMoreItems = true;
                    }
                    schemas = schemas.Take(maxItems);
                }

                list.types = schemas.Select(it => ToTypeDefinition(it, request.includePropertyDefinitions != null ? request.includePropertyDefinitions.Value : false)).ToArray();

                return(new getTypeChildrenResponse(list));
            }
            else
            {
                throw new FaultException <cmisFaultType>(ModelHelper.CreateFault(enumServiceException.notSupported, "Kooboo CMS does not support the object type hierarchy.".Localize()));
            }
        }