+ * Rename the conflicting trashed files with the supplied new names.\r
+ */\r
+ private void updateTrashedFiles() {\r
+ for (final String name: toRename.keySet()) {\r
+ JSONObject json = new JSONObject();\r
+ json.put("name", new JSONString(name));\r
+ PostCommand cf = new PostCommand(toRename.get(name).getUri() + "?update=", json.toString(), 200) {\r
+\r
+ @Override\r
+ public void onComplete() {\r
+ toRename.remove(name);\r
+ uploadFiles();\r
+ }\r
+\r
+ @Override\r
+ public void onError(Throwable t) {\r
+ GSS app = GSS.get();\r
+ GWT.log("", t);\r
+ if (t instanceof RestException) {\r
+ int statusCode = ((RestException) t).getHttpStatusCode();\r
+ if (statusCode == 405)\r
+ app.displayError("You don't have the necessary permissions");\r
+ else if (statusCode == 404)\r
+ app.displayError("User in permissions does not exist");\r
+ else if (statusCode == 409)\r
+ app.displayError("A file with the same name already exists");\r
+ else if (statusCode == 413)\r
+ app.displayError("Your quota has been exceeded");\r
+ else\r
+ app.displayError("Unable to modify file:" + ((RestException) t).getHttpStatusText());\r
+ } else\r
+ app.displayError("System error modifying file:" + t.getMessage());\r
+ }\r
+\r
+ };\r
+ DeferredCommand.addCommand(cf);\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Checks if the renaming step for already trashed files is complete and\r
+ * starts file uploads.\r