Class: CmisServer::Folder

Inherits:
BaseType show all
Defined in:
lib/cmis_server/base_objects/folder.rb

Instance Attribute Summary

Attributes inherited from BaseType

#base_id, #controllable_acl, #controllable_policy, #creatable, #description, #display_name, #fileable, #fulltext_indexed, #id, #included_in_supertype_query, #local_name, #local_namespace, #parent_type, #properties, #property_definitions, #query_name, #queryable

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseType

#==, #adapter, adapter_class, #adapter_class, base_type, #copy_properties_values_of, #initialize, #initialize_properties, parent_id, parent_property_definitions, property, property_definitions, #to_renderable_object, type_definition

Constructor Details

This class inherits a constructor from CmisServer::BaseType

Class Method Details

.base_idObject



14
15
16
# File 'lib/cmis_server/base_objects/folder.rb', line 14

def base_id
  id
end

.root_folderObject



4
5
6
7
8
9
10
# File 'lib/cmis_server/base_objects/folder.rb', line 4

def self.root_folder
  unless @root
    @root=CmisServer::Folder.new(**CmisServer.configuration.arguments_for_root_folder)
    @root.define_singleton_method :is_root?, lambda { true }
  end
  @root
end

Instance Method Details

#is_root?Boolean

Return False Is overwrited only for root_folder singleton instance

Returns:



48
49
50
# File 'lib/cmis_server/base_objects/folder.rb', line 48

def is_root?
  false
end

#parentObject



42
43
44
# File 'lib/cmis_server/base_objects/folder.rb', line 42

def parent
  self.class.find(cmis_parent_id)
end

#pathObject



57
58
59
60
61
62
63
# File 'lib/cmis_server/base_objects/folder.rb', line 57

def path
  if cmis_parent_id && !cmis_parent_id=self.class.root_folder.cmis_object_id
    "#{parent.path}/#{path_slug}"
  else
    '/'+path_slug
  end
end

#path_slugObject



52
53
54
# File 'lib/cmis_server/base_objects/folder.rb', line 52

def path_slug
  self.is_root? ? '' : self.cmis_object_id
end

#to_plugandwork_objectObject

def find_slug_in_children(slug)

self.class.find(slug)||CmisServer::DocumentAdapter::ClassAdapter.new(context: {current_user: }).find(slug)

end



97
98
99
# File 'lib/cmis_server/base_objects/folder.rb', line 97

def to_plugandwork_object
  Tagset.find_by(id:self.cmis_object_id)||Category.find_by(id: self.cmis_object_id)
end