public static void Main(string[] args) { initialize(); cmisRepositoryEntryType[] repositories = repositoryService.getRepositories(null); string repositoryId = repositories[0].repositoryId; Console.WriteLine("Repositories description were received. Repositories amount: '" + repositories.Length + "'. First Repository Id='" + repositoryId + "'."); string rootFolder = repositoryService.getRepositoryInfo(repositoryId, null).rootFolderId; Console.WriteLine("Root folder Id='" + rootFolder + "'.\n"); Console.WriteLine("Trying to get RepositoryInfo for the first repository:"); cmisRepositoryInfoType repositoryInfo = repositoryService.getRepositoryInfo(repositoryId, null); Console.WriteLine("Repository info was received, name='" + repositoryInfo.repositoryName + "'.\n"); try { Console.WriteLine("Actual Reaction of ObjectService.getProperties() service method with invalid Object Id:"); objectService.getProperties(repositoryId, "Invalid Object Id", "*", null); Console.WriteLine(INVALID_REACTION_MESSAGE); } catch (FaultException <cmisFaultType> e) { Console.WriteLine("Expected error was returned. Message: " + e.Message + "\n"); } cmisObjectInFolderListType childrenResponse = null; try { Console.WriteLine("Trying to receive the first 20 Children of Root Folder..."); childrenResponse = navigationService.getChildren(repositoryId, rootFolder, "*", null, false, enumIncludeRelationships.none, null, false, "20", "0", null); } catch (FaultException <cmisFaultType> e) { Console.WriteLine("Can't receive children of Root Folder. Cause error message: " + e.Message); } if (null != childrenResponse && null != childrenResponse.objects) { Console.WriteLine("Children of Root Folder were received."); Console.WriteLine("Total amount: '" + childrenResponse.numItems + "'"); Console.WriteLine("Received: '" + childrenResponse.objects.Length + "'"); Console.WriteLine("Has More Items='" + childrenResponse.hasMoreItems + "'"); Console.WriteLine("Root folder listing: "); foreach (cmisObjectInFolderType cmisObject in childrenResponse.objects) { if (null != cmisObject && null != cmisObject.@object) { cmisProperty nameProperty = searchForProperty([email protected], "cmis:name"); cmisProperty baseTypeProperty = searchForProperty([email protected], "cmis:baseTypeId"); Console.WriteLine((("[" + getPropertyValue(baseTypeProperty) + "] ")) + getPropertyValue(nameProperty) + "'"); } } } }
private static void assertRepositoryInfoReponse(cmisRepositoryInfoType repositoryInfo, string repositoryId) { Assert.IsNotNull(repositoryInfo, "repositoryInfo is null"); Assert.AreEqual(repositoryId, repositoryInfo.repositoryId, "repositoryId is not equal to repositoryId from Repository Info request"); Assert.IsNotNull(repositoryInfo.cmisVersionSupported, "Supported CMIS version is not specified"); Assert.IsNotNull(repositoryInfo.cmisVersionSupported, "Unsupported CMIS implementation version"); Assert.IsNotNull(repositoryInfo.productName, "Product Name property is undefined"); Assert.IsNotNull(repositoryInfo.productVersion, "Product Version property is undefined"); Assert.IsNotNull(repositoryInfo.repositoryDescription, "Repository Description property is undefined"); Assert.IsNotNull(repositoryInfo.repositoryName, "Repository Name property is undefined"); Assert.IsNotNull(repositoryInfo.rootFolderId, "Repository Root Folder Id is undefined"); Assert.IsNotNull(repositoryInfo.vendorName, "Repository Vendor Name property is undefined"); Assert.IsNotNull(repositoryInfo.aclCapability, "ACL Capability is undefined"); Assert.IsNotNull(repositoryInfo.changesIncomplete, "Changes Incomplete is undefined"); assertAndLogRepositoryCapabilities(repositoryInfo); }
private static void assertAndLogRepositoryCapabilities(cmisRepositoryInfoType repositoryInfo) { cmisRepositoryCapabilitiesType capabilities = repositoryInfo.capabilities; Assert.IsNotNull(capabilities, "Repository Info Capabilities are null"); Assert.IsNotNull(repositoryInfo.aclCapability, "Change Incomplete property is undefined"); Assert.IsNotNull(repositoryInfo.changesIncomplete, "Change Incomplete property is undefined"); Assert.IsNotNull(repositoryInfo.changesIncompleteSpecified, "Change Incomplete Specified property is undefined"); Assert.IsNotNull(capabilities.capabilityACL, "ACL capability is undefined"); Assert.IsNotNull(capabilities.capabilityChanges, "Changes capability is undefined"); Assert.IsNotNull(capabilities.capabilityRenditions, "Renditions capability is undefined"); Assert.IsNotNull(capabilities.capabilityAllVersionsSearchable, "All Versions Searchable capability is undefined"); Assert.IsNotNull(capabilities.capabilityContentStreamUpdatability, "Content Stream Updatability capability is undefined"); Assert.IsNotNull(capabilities.capabilityGetDescendants, "Get Descendants capability is undefined"); Assert.IsNotNull(capabilities.capabilityGetFolderTree, "Get Folder Tree capability is undefined"); Assert.IsNotNull(capabilities.capabilityJoin, "Join capability is undefined"); Assert.IsNotNull(capabilities.capabilityMultifiling, "Multi filing capability is undefined"); Assert.IsNotNull(capabilities.capabilityPWCSearchable, "PWC Searchable capability is undefined"); Assert.IsNotNull(capabilities.capabilityPWCUpdatable, "PWC Updatable capability is undefined"); Assert.IsNotNull(capabilities.capabilityQuery, "Query capability is undefined"); Assert.IsNotNull(capabilities.capabilityUnfiling, "Unfiling capability is undefined"); Assert.IsNotNull(capabilities.capabilityVersionSpecificFiling, "Version Specific Filing capability is undefined"); logger.log("Repository capabilities:"); logger.log("ACL capability: " + capabilities.capabilityACL); logger.log("All Versions Searchable capability: " + capabilities.capabilityAllVersionsSearchable); logger.log("Changes capability: " + capabilities.capabilityChanges); logger.log("Content Stream Updatability capability: " + capabilities.capabilityContentStreamUpdatability); logger.log("Get Descendants capability: " + capabilities.capabilityGetDescendants); logger.log("Join capability: " + capabilities.capabilityJoin); logger.log("Multi filing capability: " + capabilities.capabilityMultifiling); logger.log("PWC Searchable capability: " + capabilities.capabilityPWCSearchable); logger.log("PWC Updatable capability: " + capabilities.capabilityPWCUpdatable); logger.log("Query capability: " + capabilities.capabilityQuery); logger.log("Renditions capability: " + capabilities.capabilityRenditions); logger.log("Unfiling capability: " + capabilities.capabilityUnfiling); logger.log("Version Specific Filing capability: " + capabilities.capabilityVersionSpecificFiling); logger.log("Get Folder Tree capability: " + capabilities.capabilityGetFolderTree); }
private cmisRepositoryInfoType ToRepositoryInfo(Kooboo.CMS.Sites.Models.Site site) { var repositoryInfo = new cmisRepositoryInfoType() { repositoryId = site.FullName, repositoryName = string.IsNullOrEmpty(site.DisplayName) ? site.Name : site.DisplayName, vendorName = "Kooboo", repositoryDescription = "", productName = "Kooboo CMS", productVersion = this.GetType().Assembly.GetName().Version.ToString(), rootFolderId = "/", latestChangeLogToken = "", capabilities = GetRepositoryCapabilities(site), aclCapability = null, //todo: Not very clear for acl now. cmisVersionSupported = "1.1", thinClientURI = null, changesIncomplete = false, changesOnType = new[] { enumBaseObjectTypeIds.cmisdocument }, principalAnonymous = null, principalAnyone = null }; return(repositoryInfo); }
public void testGetRepositoryInfo() { cmisRepositoryInfoType repositoryInfo = getAndAssertRepositoryInfo(); assertRepositoryInfoReponse(repositoryInfo, getAndAssertRepositoryId()); }
private static void getRepositoryPropertiesAndCapabilities(cmisRepositoryInfoType repositoryInfo) { Assert.IsNotNull((rootFolderId = repositoryInfo.rootFolderId), "Repository Root Folder Id is undefined"); cmisRepositoryCapabilitiesType capabilities = repositoryInfo.capabilities; Assert.IsNotNull(capabilities, "Repository Info Capabilities are null"); allVersionsSearchable = capabilities.capabilityAllVersionsSearchable; contentStreamUpdates = capabilities.capabilityContentStreamUpdatability; capabilityGetDescendants = capabilities.capabilityGetDescendants; capabilityJoin = capabilities.capabilityJoin; capabilityACL = capabilities.capabilityACL; multifilingEnabled = capabilities.capabilityMultifiling; pwcSearchable = capabilities.capabilityPWCSearchable; pwcUpdatable = capabilities.capabilityPWCUpdatable; queryAllowed = capabilities.capabilityQuery; unfilingEnabled = capabilities.capabilityUnfiling; versionSpecificFiling = capabilities.capabilityVersionSpecificFiling; capabilityChanges = capabilities.capabilityChanges; renditionsEnabled = enumCapabilityRendition.read.Equals(capabilities.capabilityRenditions); aclPropagation = repositoryInfo.aclCapability.propagation; }