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())); } }
public getTypeChildrenResponse(cmisTypeDefinitionListType types) { this.types = types; }