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, #detached?, #move, #object_type, #parents, #policies, #relationships, #remove_aces, #unfile, #update_properties
Methods included from Helpers
#cmis_properties, #initialize_properties, #method_missing, respond_to?, #update_change_token
Constructor Details
#initialize(raw, repository) ⇒ Folder
Returns a new instance of Folder.
3
4
5
6
7
|
# File 'lib/cmis/folder.rb', line 3
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
60
61
62
63
64
65
|
# File 'lib/cmis/folder.rb', line 60
def add(object, opts = {})
connection.execute!({ cmisaction: 'addObjectToFolder',
repositoryId: repository.id,
objectId: object.cmis_object_id,
folderId: cmis_object_id }, opts)
end
|
#allowed_child_object_types ⇒ Object
13
14
15
16
|
# File 'lib/cmis/folder.rb', line 13
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
18
19
20
|
# File 'lib/cmis/folder.rb', line 18
def children(opts = {})
Children.new(self, opts)
end
|
#create(object, opts = {}) ⇒ Object
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
48
49
50
51
52
|
# File 'lib/cmis/folder.rb', line 22
def create(object, opts = {})
case object
when Relationship
raise "'cmis:relationship' is not fileable. Use Repository#create_relationship"
when Document
return object.create_in_folder(self, opts)
when Folder
o = connection.execute!({ cmisaction: 'createFolder',
repositoryId: repository.id,
properties: object.properties,
objectId: cmis_object_id }, opts)
when Policy
o = connection.execute!({ cmisaction: 'createPolicy',
repositoryId: repository.id,
properties: object.properties,
objectId: cmis_object_id }, opts)
when Item
o = connection.execute!({ cmisaction: 'createItem',
repositoryId: repository.id,
properties: object.properties,
objectId: cmis_object_id }, opts)
else
raise "Unexpected base_type_id: #{object.base_type_id}"
end
ObjectFactory.create(o, repository)
end
|
#delete_tree(opts = {}) ⇒ Object
54
55
56
57
58
|
# File 'lib/cmis/folder.rb', line 54
def delete_tree(opts = {})
connection.execute!({ cmisaction: 'deleteTree',
repositoryId: repository.id,
objectId: cmis_object_id }, opts)
end
|
#parent(opts = {}) ⇒ Object
9
10
11
|
# File 'lib/cmis/folder.rb', line 9
def parent(opts = {})
repository.object(parent_id, opts) if parent_id
end
|
#remove(object, opts = {}) ⇒ Object
67
68
69
70
71
72
|
# File 'lib/cmis/folder.rb', line 67
def remove(object, opts = {})
connection.execute!({ cmisaction: 'removeObjectFromFolder',
repositoryId: repository.id,
objectId: object.cmis_object_id,
folderId: cmis_object_id }, opts)
end
|