Index: lams_contentrepository/src/java/org/lamsfoundation/lams/contentrepository/client/ToolContentHandler.java
===================================================================
diff -u -r41de4a8b5ff40c43e8eaadc76a33ebce112d6801 -r7aa77bcecb501c019e15d8dfe06d7d3542c37460
--- lams_contentrepository/src/java/org/lamsfoundation/lams/contentrepository/client/ToolContentHandler.java (.../ToolContentHandler.java) (revision 41de4a8b5ff40c43e8eaadc76a33ebce112d6801)
+++ lams_contentrepository/src/java/org/lamsfoundation/lams/contentrepository/client/ToolContentHandler.java (.../ToolContentHandler.java) (revision 7aa77bcecb501c019e15d8dfe06d7d3542c37460)
@@ -24,6 +24,7 @@
/* $$Id$$ */
package org.lamsfoundation.lams.contentrepository.client;
+import java.io.IOException;
import java.io.InputStream;
import java.util.Set;
@@ -262,8 +263,39 @@
return nodeKey;
}
-
/**
+ * Save content in repository into local file by given toFileName
.
+ *
+ *
+ * If the toFileName
is null, file name use original file name instead
+ * and file save path will be system temporary directory.
+ *
+ * @param uuid
+ * @param toFileName file name to save. Using the original file name instead if null value given.
+ * @throws ItemNotFoundException
+ * @throws RepositoryCheckedException
+ * @throws IOException
+ */
+ public void saveFile(Long uuid, String toFileName) throws ItemNotFoundException, RepositoryCheckedException, IOException {
+ try {
+ try {
+ getRepositoryService().saveFile(getTicket(false), uuid, null, toFileName);
+ } catch (AccessDeniedException e) {
+ log.warn("Unable to access repository to add copy node "+uuid
+ +"AccessDeniedException: "+e.getMessage()+" Retrying login.");
+ getRepositoryService().saveFile(getTicket(false), uuid, null, toFileName);
+ }
+ } catch (ItemNotFoundException e) {
+ log.warn("Unable to to save node "+uuid
+ +" as the node cannot be found. Repository Exception: "+e.getMessage()+" Retry not possible.");
+ throw e;
+ } catch (RepositoryCheckedException e) {
+ log.warn("Unable to to save node "+uuid
+ +"Repository Exception: "+e.getMessage()+" Retry not possible.");
+ throw e;
+ }
+ }
+ /**
* Copy an entry in the content repository.
*
* @param uuid id of the file node. Mandatory
Index: lams_contentrepository/src/java/org/lamsfoundation/lams/contentrepository/service/IRepositoryService.java
===================================================================
diff -u -r41de4a8b5ff40c43e8eaadc76a33ebce112d6801 -r7aa77bcecb501c019e15d8dfe06d7d3542c37460
--- lams_contentrepository/src/java/org/lamsfoundation/lams/contentrepository/service/IRepositoryService.java (.../IRepositoryService.java) (revision 41de4a8b5ff40c43e8eaadc76a33ebce112d6801)
+++ lams_contentrepository/src/java/org/lamsfoundation/lams/contentrepository/service/IRepositoryService.java (.../IRepositoryService.java) (revision 7aa77bcecb501c019e15d8dfe06d7d3542c37460)
@@ -24,6 +24,7 @@
/* $$Id$$ */
package org.lamsfoundation.lams.contentrepository.service;
+import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.SortedMap;
@@ -361,7 +362,7 @@
public void logout(ITicket ticket) throws AccessDeniedException;
/** Get a complete list of all nodes in the workspace and their
- * version histories.
+ * version histories.
*
* Warning: Once a workspace gets a lot of nodes, this will be
* a very very expensive call!!!!!
@@ -370,4 +371,18 @@
* @return SortedMap key Long uuid, value IVersionDetail version history
*/
public SortedMap getNodeList(ITicket ticket) throws AccessDeniedException ;
+ /**
+ * Save current version of a node to local file by given file name. If the toFileName
is
+ * null, file name use original file name instead and file save path will be system temporary directory.
+ *
+ * So far, it only support