Creating Extensions on Properties Fails When Creating XML to Submit to Server
-----------------------------------------------------------------------------

                 Key: CMIS-497
                 URL: https://issues.apache.org/jira/browse/CMIS-497
             Project: Chemistry
          Issue Type: Bug
          Components: dotcmis
    Affects Versions: DotCMIS 0.3
            Reporter: Phil Barr


The following code should work but fails with a "Value cannot be set on 
Element" error. 

/////////////////////////////////////////
    class Program
    {
        static void Main()
        {
            const string description = "this is a new description";

            const string repositoryId = "7270744f-c07c-48c9-aa01-ef90089785e3";
            string documentId = 
"workspace://SpacesStore/f8e3dc76-4781-49d6-b5d1-d3af1299ea80";

            Dictionary<string, string> parameters = new Dictionary<string, 
string>();
            parameters[SessionParameter.BindingType] = BindingType.AtomPub;
            parameters[SessionParameter.AtomPubUrl] = 
"http://localhost:8082/alfresco/service/cmis";;
            parameters[SessionParameter.User] = "admin";
            parameters[SessionParameter.Password] = "admin";
            parameters[SessionParameter.RepositoryId] = repositoryId;

            SessionFactory factory = SessionFactory.NewInstance();
            ISession session = factory.CreateSession(parameters);

            string changeToken = null; // not sure why I need this

            Properties props = new Properties();
            props.Extensions = CreateData(description).Extensions;
            session.Binding.GetObjectService().UpdateProperties(repositoryId, 
ref documentId, ref changeToken, props, null);
        }

        private static ExtensionsData CreateData(string description)
        {
            ExtensionsData data = new ExtensionsData();
            data.Extensions = new List<ICmisExtensionElement>();
            CmisExtensionElement element = new CmisExtensionElement
                {
                    Name = "alf:setAspects",
                    Namespace = "http://www.alfresco.org";,
                    Children = new List<ICmisExtensionElement>
                    {
                        new CmisExtensionElement
                            {
                                Name = "alf:properties",
                                Namespace = "http://www.alfresco.org";,
                                Children = new List<ICmisExtensionElement>
                                    {
                                        new CmisExtensionElement
                                            {
                                                Name = "cmis:propertyString",
                                                Namespace = 
"http://docs.oasis-open.org/ns/cmis/core/200908/";,
                                                Attributes = new 
Dictionary<string, string>
                                                        {
                                                            
{"propertyDefinitionId","cm:description"},
                                                            
{"displayName","Description"},
                                                            
{"queryName","cm:description"}
                                                        },
                                                Children = new 
List<ICmisExtensionElement>
                                                        {
                                                            new 
CmisExtensionElement
                                                                {
                                                                    Name = 
"cmis:value",
                                                                    Namespace = 
"http://docs.oasis-open.org/ns/cmis/core/200908/";,
                                                                    Value = 
description
                                                                }
                                                        }
                                            }
                                    }
                            }
                    }
                };
            data.Extensions.Add(element);

            return data;
        }
////////////////////////////////////////////////////////

The following change in converter.cs, line 1869 in 
Converter::CreateXMLElement(XmlDocument doc, ICmisExtensionElement element) 
shoul be made:
   result.Value = element.Value;
should be
   result.InnerText = element.Value;


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to