Class: CMIS::Folder
Instance Attribute Summary
Attributes inherited from Object
#properties, #repository
Instance Method Summary
collapse
Methods inherited from Object
#acls, #add_aces, #allowable_actions, #delete, #delete_with_relationships, #detached?, #inspect, #move, #object_type, #parents, #policies, #refresh, #relationships, #remove_aces, #unfile, #update_properties
Methods included from Helpers
#cmis_properties, #initialize_properties, #method_missing, #respond_to?, #with_change_token
Constructor Details
#initialize(raw, repository) ⇒ Folder
Returns a new instance of Folder.
5
6
7
8
9
|
# File 'lib/cmis/folder.rb', line 5
def initialize(raw, repository)
super
cmis_properties %w( cmis:parentId cmis:path
cmis:allowedChildObjectTypeIds )
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class CMIS::Helpers
Instance Method Details
#add(object, opts = {}) ⇒ Object
55
56
57
58
59
60
|
# File 'lib/cmis/folder.rb', line 55
def add(object, opts = {})
server.execute!({ cmisaction: 'addObjectToFolder',
repositoryId: repository.id,
objectId: object.cmis_object_id,
folderId: cmis_object_id }, opts)
end
|
#allowed_child_object_types ⇒ Object
15
16
17
18
|
# File 'lib/cmis/folder.rb', line 15
def allowed_child_object_types
return nil unless allowed_child_object_type_ids
allowed_child_object_type_ids.map { |type_id| repository.type(type_id) }
end
|
#children(opts = {}) ⇒ Object
20
21
22
|
# File 'lib/cmis/folder.rb', line 20
def children(opts = {})
Children.new(self, opts)
end
|
#create(object, opts = {}) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/cmis/folder.rb', line 30
def create(object, opts = {})
case object
when Document
return object.create_in_folder(self, opts)
when Folder
o = create_in_self(object, 'createFolder', opts)
when Policy
o = create_in_self(object, 'createPolicy', opts)
when Item
o = create_in_self(object, 'createItem', opts)
when Relationship
raise "`cmis:relationship` is not fileable. Use Repository#create_relationship."
else
raise "Unexpected base_type_id: #{object.base_type_id}"
end
ObjectFactory.create(o, repository)
end
|
#delete_tree(opts = {}) ⇒ Object
49
50
51
52
53
|
# File 'lib/cmis/folder.rb', line 49
def delete_tree(opts = {})
server.execute!({ cmisaction: 'deleteTree',
repositoryId: repository.id,
objectId: cmis_object_id }, opts)
end
|
#folder_tree(opts = {}) ⇒ Object
24
25
26
27
28
|
# File 'lib/cmis/folder.rb', line 24
def folder_tree(opts = {})
server.execute!({ cmisselector: 'folderTree',
repositoryId: repository.id,
objectId: cmis_object_id }, opts)
end
|
#parent(opts = {}) ⇒ Object
11
12
13
|
# File 'lib/cmis/folder.rb', line 11
def parent(opts = {})
repository.object(parent_id, opts) if parent_id
end
|
#remove(object, opts = {}) ⇒ Object
62
63
64
65
66
67
|
# File 'lib/cmis/folder.rb', line 62
def remove(object, opts = {})
server.execute!({ cmisaction: 'removeObjectFromFolder',
repositoryId: repository.id,
objectId: object.cmis_object_id,
folderId: cmis_object_id }, opts)
end
|
#root? ⇒ Boolean
69
70
71
|
# File 'lib/cmis/folder.rb', line 69
def root?
cmis_object_id == repository.root_folder_id
end
|