+ },
+
+ attachToNewParent = function(content, newParent)
+ {
+ # We temporary set parents collection to NULL. This will ensure that
+ # add method doesn't post this subcollection to REST.
+ # We also need to set content's collection to NULL because
+ # add method throws exception if we try to add content that already
+ # belongs to a collection.
+ parentsCollection <- newParent$getCollection()
+ content$setCollection(NULL, setRecursively = FALSE)
+ newParent$setCollection(NULL, setRecursively = FALSE)
+ newParent$add(content)
+ content$setCollection(parentsCollection, setRecursively = FALSE)
+ newParent$setCollection(parentsCollection, setRecursively = FALSE)
+ },
+
+ dettachFromCurrentParent = function()
+ {
+ # We temporary set parents collection to NULL. This will ensure that
+ # remove method doesn't remove this subcollection from REST.
+ parent <- private$parent
+ parentsCollection <- parent$getCollection()
+ parent$setCollection(NULL, setRecursively = FALSE)
+ parent$remove(private$name)
+ parent$setCollection(parentsCollection, setRecursively = FALSE)
+ },
+
+ getContentAsCharVector = function(fullPath = TRUE)
+ {
+ content <- NULL
+
+ if(fullPath)
+ {
+ for(child in private$children)
+ content <- c(content, child$getFileListing())
+
+ if(private$name != "")
+ content <- unlist(paste0(private$name, "/", content))
+ }
+ else
+ {
+ for(child in private$children)
+ content <- c(content, child$getName())
+ }
+
+ content