You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chemistry.apache.org by "Florian Müller (Commented JIRA)" <ji...@apache.org> on 2012/02/01 19:54:59 UTC
[jira] [Commented] (CMIS-497) Creating Extensions on Properties
Fails When Creating XML to Submit to Server
[ https://issues.apache.org/jira/browse/CMIS-497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13198049#comment-13198049 ]
Florian Müller commented on CMIS-497:
-------------------------------------
Thanks for reporting this issue!
> 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
> Assignee: Florian Müller
> Labels: extension, xml
> Fix For: DotCMIS 0.4
>
>
> The following code should work but fails with a "Value cannot be set on Element" error.
> {code}
> 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;
> }
> {code}
> The following change in converter.cs, line 1869 in Converter::CreateXMLElement(XmlDocument doc, ICmisExtensionElement element) should be made:
> {code}
> result.Value = element.Value;
> // should be
> result.InnerText = element.Value;
> {code}
--
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