Implement copy method, update move method and remove trailing
[arvados.git] / sdk / R / R / CollectionTree.R
index 4194be95dd46e343b02abb4708f781acf1beef8f..2d4af094aa1c96b98b585cba059085c95b537f8c 100644 (file)
@@ -1,12 +1,11 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+
 source("./R/Subcollection.R")
 source("./R/ArvadosFile.R")
 source("./R/util.R")
 
-#' Arvados Collection Object
-#'
-#' Update description
-#'
-#' @examples arv = Collection$new(api, uuid)
 CollectionTree <- R6::R6Class(
     "CollectionTree",
     public = list(
@@ -20,7 +19,7 @@ CollectionTree <- R6::R6Class(
             treeBranches <- sapply(fileContent, function(filePath)
             {
                 splitPath <- unlist(strsplit(filePath, "/", fixed = TRUE))
-                branch <- private$createBranch(splitPath)      
+                branch <- private$createBranch(splitPath)
             })
 
             root <- Subcollection$new("")
@@ -81,7 +80,7 @@ CollectionTree <- R6::R6Class(
                     branch <- newFolder
                 }
             }
-            
+
             branch
         },
 
@@ -95,10 +94,10 @@ CollectionTree <- R6::R6Class(
             }
             else
             {
-                # Note: REST always returns folder name alone before other folder 
+                # Note: REST always returns folder name alone before other folder
                 # content, so in first iteration we don't know if it's a file
-                # or folder since its just a name, so we assume it's a file. 
-                # If we encounter that same name again we know 
+                # or folder since its just a name, so we assume it's a file.
+                # If we encounter that same name again we know
                 # it's a folder so we need to replace ArvadosFile with Subcollection.
                 if("ArvadosFile" %in% class(child))
                 {
@@ -122,3 +121,24 @@ CollectionTree <- R6::R6Class(
         }
     )
 )
+
+# deepCopyArvadosComposite = function(composite) 
+# {
+    # if("ArvadosFile" %in% class(content))
+    # {
+        # newFile <- ArvadosFile$new(content$name)
+        # newFile$setCollection(content$getCollection())
+
+        # return(newFile)
+    # }
+    # else if("Subcollection" %in% class(content))
+    # {
+        # root <- Subcollection$new(content$name)
+        # root$setCollection(content$getCollection())
+    # }
+    # else
+        # stop("Arvados composite is corrupted. It can contain only ArvadosFile or Subcollection.")
+    
+    
+
+# }