alf_node.delete: Deletes an Alfresco node

Description Usage Arguments Examples

View source: R/alf_node.R

Description

Deletes an Alfresco node identified by node_id. If the node is a folder then all the delete recurses through the primary children.

Usage

1
alf_node.delete(session, node_id, permanent = FALSE)

Arguments

session

valid Alfresco repository session

node_id

node id to delete

permanent

indicates whether the node is permanently deleted or places in the trashcan where where it can be recovered from. FALSE by default.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# try to establish a connection to the alfresco content repository
my_session <- tryCatch(
                alf_session("http://localhost:8080", "admin", "admin"),
                error = function(e) NULL)

if (!is.null(my_session)) {

  # create document
  my_new_document <- alf_node.new(my_session, node_id="-root-",
    list(
      name = "example.txt",
      nodeType = "cm:content",
      relativePath = "example"
    ))

  # upload content
  my_new_document$content$update(
    system.file("extdata", "sample.txt", package="alfr"))

  # get details of document node
  my_document <- alf_node(my_session, relative_path = "example/example.txt")

  # output the name of the document
  print(my_document$name)

  # output the details of documents content
  print(my_document$content$mime_type)
  print(my_document$content$mime_type_name)
  print(my_document$content$size)
  print(my_document$content$encoding)

  # read document content
  my_content_file <- file(my_document$content$as.file(), "r")
  my_content <- readLines(my_content_file)
  close(my_content_file)
  print(my_content)

  # upload new content
  my_updated_document <- my_document$content$update(
    system.file("extdata", "modified_sample.txt", package="alfr"))

  # print updated content size
  print(my_updated_document$content$size)

  # delete document
  alf_node.delete(my_session, my_document$id)
}

rwetherall/alfr documentation built on July 19, 2019, 11:34 a.m.