[mapguide-commits] r5224 - in sandbox/maestro-3.0: OSGeo.MapGuide.MaestroAPI OSGeo.MapGuide.MaestroAPI.Http

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Sep 30 08:54:48 EDT 2010


Author: jng
Date: 2010-09-30 12:54:48 +0000 (Thu, 30 Sep 2010)
New Revision: 5224

Modified:
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs
   sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ServerConnectionBase.cs
Log:
Update HttpServerConnection to use RFC74 variant of MoveResource. If the connection is to a pre-2.2 server, the old method will be used.

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ServerConnectionBase.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ServerConnectionBase.cs	2010-09-30 10:52:47 UTC (rev 5223)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI/ServerConnectionBase.cs	2010-09-30 12:54:48 UTC (rev 5224)
@@ -672,9 +672,9 @@
 		/// <param name="callback">A callback delegate, being called for non progress reporting events.</param>
 		/// <param name="progress">A callback delegate, being called for progress reporting events.</param>
 		/// <returns></returns>
-		public bool MoveResourceWithReferences(string oldpath, string newpath, LengthyOperationCallBack callback, LengthyOperationProgressCallBack progress)
+		public virtual bool MoveResourceWithReferences(string oldpath, string newpath, LengthyOperationCallBack callback, LengthyOperationProgressCallBack progress)
 		{
-			LengthyOperationProgressArgs la = new LengthyOperationProgressArgs("Moving resource...", -1);
+			LengthyOperationProgressArgs la = new LengthyOperationProgressArgs("Moving resource...", -1); //LOCALIZEME
 
 			if (progress != null)
 				progress(this, la);
@@ -779,7 +779,7 @@
 		/// <param name="callback">A callback delegate, being called for non progress reporting events.</param>
 		/// <param name="progress">A callback delegate, being called for progress reporting events.</param>
 		/// <returns></returns>
-		public bool MoveFolderWithReferences(string oldpath, string newpath, LengthyOperationCallBack callback, LengthyOperationProgressCallBack progress)
+		public virtual bool MoveFolderWithReferences(string oldpath, string newpath, LengthyOperationCallBack callback, LengthyOperationProgressCallBack progress)
 		{
 			oldpath = FixAndValidateFolderPath(oldpath);
 			newpath = FixAndValidateFolderPath(newpath);

Modified: sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs
===================================================================
--- sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs	2010-09-30 10:52:47 UTC (rev 5223)
+++ sandbox/maestro-3.0/OSGeo.MapGuide.MaestroAPI.Http/HttpServerConnection.cs	2010-09-30 12:54:48 UTC (rev 5224)
@@ -1763,5 +1763,56 @@
 			FdoProviderCapabilities o = (FdoProviderCapabilities)DeserializeObject(typeof(FdoProviderCapabilities), this.OpenRead(req));
 			return o;
         }
+
+        public override bool MoveFolderWithReferences(string oldpath, string newpath, LengthyOperationCallBack callback, LengthyOperationProgressCallBack progress)
+        {
+            if (this.SiteVersion >= new Version(2, 2)) //new way
+            {
+                //Unfortunately because this is all batched server-side, there is no
+                //meaningful way to track progress
+                LengthyOperationProgressArgs la = new LengthyOperationProgressArgs("Moving resource...", -1); //LOCALIZEME
+                if (progress != null)
+                    progress(this, la);
+
+                oldpath = FixAndValidateFolderPath(oldpath);
+                newpath = FixAndValidateFolderPath(newpath);
+
+                string req = m_reqBuilder.MoveResource(oldpath, newpath, true);
+                req += "&CASCADE=1";
+
+                using (System.IO.Stream resp = this.OpenRead(req))
+                    resp.ReadByte();
+
+                return true;
+            }
+            else //old way
+            {
+                return base.MoveFolderWithReferences(oldpath, newpath, callback, progress);
+            }
+        }
+
+        public override bool MoveResourceWithReferences(string oldpath, string newpath, LengthyOperationCallBack callback, LengthyOperationProgressCallBack progress)
+        {
+            if (this.SiteVersion >= new Version(2, 2)) //new way
+            {
+                //Unfortunately because this is all batched server-side, there is no
+                //meaningful way to track progress
+                LengthyOperationProgressArgs la = new LengthyOperationProgressArgs("Moving resource...", -1); //LOCALIZEME
+                if (progress != null)
+                    progress(this, la);
+
+                string req = m_reqBuilder.MoveResource(oldpath, newpath, true);
+                req += "&CASCADE=1";
+
+                using (System.IO.Stream resp = this.OpenRead(req))
+                    resp.ReadByte();
+
+                return true;
+            }
+            else //old way
+            {
+                return base.MoveResourceWithReferences(oldpath, newpath, callback, progress);
+            }
+        }
     }
 }



More information about the mapguide-commits mailing list