[mapguide-commits] r5243 - trunk/Tools/Maestro/MaestroAPI

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Oct 5 01:05:23 EDT 2010


Author: jng
Date: 2010-10-05 05:05:23 +0000 (Tue, 05 Oct 2010)
New Revision: 5243

Modified:
   trunk/Tools/Maestro/MaestroAPI/HttpServerConnection.cs
   trunk/Tools/Maestro/MaestroAPI/ServerConnectionBase.cs
Log:
Backport from 3.0 sandbox: Use RFC74 variant of MOVERESOURCE for site versions >= 2.2 (which implements this RFC)


Modified: trunk/Tools/Maestro/MaestroAPI/HttpServerConnection.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPI/HttpServerConnection.cs	2010-10-05 04:38:11 UTC (rev 5242)
+++ trunk/Tools/Maestro/MaestroAPI/HttpServerConnection.cs	2010-10-05 05:05:23 UTC (rev 5243)
@@ -877,8 +877,57 @@
 			//Do nothing... there is no return value
 		}
 
+        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);
+            }
+        }
+
 		public override System.IO.Stream RenderRuntimeMap(string resourceId, double x, double y, double scale, int width, int height, int dpi, string format, bool clip)
 		{
             ResourceIdentifier.Validate(resourceId, ResourceTypes.RuntimeMap);

Modified: trunk/Tools/Maestro/MaestroAPI/ServerConnectionBase.cs
===================================================================
--- trunk/Tools/Maestro/MaestroAPI/ServerConnectionBase.cs	2010-10-05 04:38:11 UTC (rev 5242)
+++ trunk/Tools/Maestro/MaestroAPI/ServerConnectionBase.cs	2010-10-05 05:05:23 UTC (rev 5243)
@@ -815,7 +815,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 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);
 
@@ -922,7 +922,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);



More information about the mapguide-commits mailing list