chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1363791 - in /chemistry/dotcmis/trunk/DotCMIS: binding/atompub/atompub-writer.cs binding/atompub/atompub.cs const.cs
Date Fri, 20 Jul 2012 14:11:22 GMT
Author: fmui
Date: Fri Jul 20 14:11:22 2012
New Revision: 1363791

URL: http://svn.apache.org/viewvc?rev=1363791&view=rev
Log:
added filename to AtomPub content request

Modified:
    chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub-writer.cs
    chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub.cs
    chemistry/dotcmis/trunk/DotCMIS/const.cs

Modified: chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub-writer.cs
URL: http://svn.apache.org/viewvc/chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub-writer.cs?rev=1363791&r1=1363790&r2=1363791&view=diff
==============================================================================
--- chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub-writer.cs (original)
+++ chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub-writer.cs Fri Jul 20 14:11:22
2012
@@ -47,6 +47,7 @@ namespace DotCMIS.Binding.AtomPub
         public const string PrefixAtom = "atom";
         public const string PrefixCMIS = "cmis";
         public const string PrefixRestAtom = "cmisra";
+        public const string PrefixApacheChemistry = "chemistry";
     }
 
     internal class AtomEntryWriter
@@ -56,13 +57,14 @@ namespace DotCMIS.Binding.AtomPub
         private cmisObjectType cmisObject;
         private Stream stream;
         private string mediaType;
+        private string filename;
 
         public AtomEntryWriter(cmisObjectType cmisObject)
-            : this(cmisObject, null, null)
+            : this(cmisObject, null, null, null)
         {
         }
 
-        public AtomEntryWriter(cmisObjectType cmisObject, string mediaType, Stream stream)
+        public AtomEntryWriter(cmisObjectType cmisObject, string mediaType, string filename,
Stream stream)
         {
             if (cmisObject == null || cmisObject.properties == null)
             {
@@ -76,6 +78,7 @@ namespace DotCMIS.Binding.AtomPub
 
             this.cmisObject = cmisObject;
             this.mediaType = mediaType;
+            this.filename = filename;
             this.stream = stream;
         }
 
@@ -94,6 +97,10 @@ namespace DotCMIS.Binding.AtomPub
                 writer.WriteAttributeString("xmlns", AtomWriter.PrefixAtom, null, AtomPubConstants.NamespaceAtom);
                 writer.WriteAttributeString("xmlns", AtomWriter.PrefixCMIS, null, AtomPubConstants.NamespaceCMIS);
                 writer.WriteAttributeString("xmlns", AtomWriter.PrefixRestAtom, null, AtomPubConstants.NamespaceRestAtom);
+                if (filename != null)
+                {
+                    writer.WriteAttributeString("xmlns", AtomWriter.PrefixApacheChemistry,
null, AtomPubConstants.NamespaceApacheChemistry);
+                }
 
                 // atom:id
                 writer.WriteStartElement(AtomWriter.PrefixAtom, AtomPubConstants.TagAtomId,
AtomPubConstants.NamespaceAtom);
@@ -119,6 +126,13 @@ namespace DotCMIS.Binding.AtomPub
                     writer.WriteString(mediaType);
                     writer.WriteEndElement();
 
+                    if (filename != null)
+                    {
+                        writer.WriteStartElement(AtomWriter.PrefixApacheChemistry, AtomPubConstants.TagContentFilename,
AtomPubConstants.NamespaceApacheChemistry);
+                        writer.WriteString(filename);
+                        writer.WriteEndElement();
+                    }
+
                     writer.WriteStartElement(AtomWriter.PrefixRestAtom, AtomPubConstants.TagContentBase64,
AtomPubConstants.NamespaceRestAtom);
                     WriteContent(writer);
                     writer.WriteEndElement();

Modified: chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub.cs
URL: http://svn.apache.org/viewvc/chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub.cs?rev=1363791&r1=1363790&r2=1363791&view=diff
==============================================================================
--- chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub.cs (original)
+++ chemistry/dotcmis/trunk/DotCMIS/binding/atompub/atompub.cs Fri Jul 20 14:11:22 2012
@@ -1517,16 +1517,18 @@ namespace DotCMIS.Binding.AtomPub
             cmisObject.properties = Converter.Convert(properties);
             cmisObject.policyIds = Converter.ConvertPolicies(policies);
 
-            String mediaType = null;
+            string mediaType = null;
             Stream stream = null;
+            string filename = null;
 
             if (contentStream != null)
             {
                 mediaType = contentStream.MimeType;
                 stream = contentStream.Stream;
+                filename = contentStream.FileName;
             }
 
-            AtomEntryWriter entryWriter = new AtomEntryWriter(cmisObject, mediaType, stream);
+            AtomEntryWriter entryWriter = new AtomEntryWriter(cmisObject, mediaType, filename,
stream);
 
             // post the new folder object
             HttpUtils.Response resp = Post(url, AtomPubConstants.MediatypeEntry, new HttpUtils.Output(entryWriter.Write));
@@ -2231,14 +2233,16 @@ namespace DotCMIS.Binding.AtomPub
 
             string mediaType = null;
             Stream stream = null;
+            string filename = null;
 
             if (contentStream != null)
             {
                 mediaType = contentStream.MimeType;
                 stream = contentStream.Stream;
+                filename = contentStream.FileName;
             }
 
-            AtomEntryWriter entryWriter = new AtomEntryWriter(cmisObject, mediaType, stream);
+            AtomEntryWriter entryWriter = new AtomEntryWriter(cmisObject, mediaType, filename,
stream);
 
             // update
             HttpUtils.Response resp = Put(url, AtomPubConstants.MediatypeEntry, new HttpUtils.Output(entryWriter.Write));

Modified: chemistry/dotcmis/trunk/DotCMIS/const.cs
URL: http://svn.apache.org/viewvc/chemistry/dotcmis/trunk/DotCMIS/const.cs?rev=1363791&r1=1363790&r2=1363791&view=diff
==============================================================================
--- chemistry/dotcmis/trunk/DotCMIS/const.cs (original)
+++ chemistry/dotcmis/trunk/DotCMIS/const.cs Fri Jul 20 14:11:22 2012
@@ -219,6 +219,7 @@ namespace DotCMIS
         public const string NamespaceAPP = "http://www.w3.org/2007/app";
         public const string NamespaceRestAtom = "http://docs.oasis-open.org/ns/cmis/restatom/200908/";
         public const string NamespaceXSI = "http://www.w3.org/2001/XMLSchema-instance";
+        public const string NamespaceApacheChemistry = "http://chemistry.apache.org/";
 
         // media types
         public const string MediatypeService = "application/atomsvc+xml";
@@ -353,6 +354,7 @@ namespace DotCMIS
         public const string TagContent = "content";
         public const string TagContentMediatype = "mediatype";
         public const string TagContentBase64 = "base64";
+        public const string TagContentFilename = "filename";
 
         // allowable actions
         public const string TagAllowableActions = "allowableActions";



Mime
View raw message