Example #1
0
        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) + "'");
                    }
                }
            }
        }
Example #2
0
        private static string getPropertyName(cmisProperty property)
        {
            string result = null;

            if (null != property)
            {
                result = (null != property.propertyDefinitionId) ? (property.propertyDefinitionId) : (property.localName);
            }
            return(result);
        }
Example #3
0
 private static object getPropertyValue(cmisProperty property)
 {
     if (null != property)
     {
         Type         propertyType  = property.GetType();
         PropertyInfo valueProperty = propertyType.GetProperty("value");
         if ((null != valueProperty) && valueProperty.CanRead)
         {
             object[] values = (object[])valueProperty.GetValue(property, null);
             if ((null != values) && (values.Length > 0))
             {
                 return(values[0]);
             }
         }
     }
     return(null);
 }
        public static object searchAndAssertPropertyByName(cmisProperty[] properties, string propertyName, bool multivalued, bool failOnPropertyUndefined)
        {
            foreach (cmisProperty property in properties)
            {
                Assert.IsNotNull(property, "One of the Object Properties is solely in \"not set\" state");
                string name = getPropertyName(property);
                Assert.IsTrue(((null != name) && !"".Equals(name)), "One of the Properties name is undefined");
                if (name.Equals(propertyName))
                {
                    PropertyInfo propertyValueDescription = property.GetType().GetProperty("value");
                    Assert.IsNotNull(propertyValueDescription, ("Can't receive Property Value from \"" + name + "\" property"));
                    Assert.IsTrue(propertyValueDescription.CanRead, ("Value from \"" + name + "\" Property is not Readable"));
                    Array values = propertyValueDescription.GetValue(property, null) as Array;
                    if (failOnPropertyUndefined)
                    {
                        Assert.IsFalse(isValueNotSet(values), ("Values from \"" + name + "\" Property are undefined"));
                    }
                    object result = null;
                    if (!isValueNotSet(values))
                    {
                        result = (multivalued) ? (values) : (values.GetValue(new long[] { 0 }));
                    }
                    return result;
                }
            }

            logger.log(propertyName + " Property was not found");
            if (failOnPropertyUndefined)
            {
                Assert.Fail("Expected \"" + propertyName + "\" property was not found");
            }
            return null;
        }
 /// <summary>
 /// Calculates result with searchAndAssertPropertyByName(cmisProperty[], string, bool) and third parameter equal to 'true'
 /// </summary>
 /// <param name="properties"></param>
 /// <param name="propertyName"></param>
 /// <returns></returns>
 public static object searchAndAssertPropertyByName(cmisProperty[] properties, string propertyName, bool multivalued)
 {
     return searchAndAssertPropertyByName(properties, propertyName, multivalued, true);
 }
        public static string getPropertyName(cmisProperty property)
        {
            if (null == property)
            {
                return null;
            }

            string result = property.propertyDefinitionId;
            result = (null == result) ? (property.localName) : (result);
            return (null == result) ? (property.displayName) : (result);
        }
Example #7
0
 private static object getPropertyValue(cmisProperty property)
 {
     if (null != property)
     {
         Type propertyType = property.GetType();
         PropertyInfo valueProperty = propertyType.GetProperty("value");
         if ((null != valueProperty) && valueProperty.CanRead)
         {
             object[] values = (object[])valueProperty.GetValue(property, null);
             if ((null != values) && (values.Length > 0))
             {
                 return values[0];
             }
         }
     }
     return null;
 }
Example #8
0
 private static string getPropertyName(cmisProperty property)
 {
     string result = null;
     if (null != property)
     {
         result = (null != property.propertyDefinitionId) ? (property.propertyDefinitionId) : (property.localName);
     }
     return result;
 }