Class: CmisServer::Type

Inherits:
Object
  • Object
show all
Defined in:
lib/cmis_server/type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Type

Returns a new instance of Type.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/cmis_server/type.rb', line 22

def initialize(attrs={})
  @id                          = CmisServer::Id.new(attrs.fetch(:id).to_s)
  @parent_type                 = attrs.fetch(:parent_type)
  @local_name                  = attrs.fetch(:local_name, id)
  @local_namespace             = attrs.fetch(:local_namespace, 'local')
  @query_name                  = attrs.fetch(:query_name, id)
  @display_name                = attrs.fetch(:display_name, id)
  @description                 = attrs.fetch(:description, 'No description provided')
  @creatable                   = attrs.fetch(:creatable, false)
  @fileable                    = attrs.fetch(:fileable, false)
  @queryable                   = attrs.fetch(:queryable, false)
  @controllable_policy         = attrs.fetch(:controllable_policy, false)
  @controllable_acl            = attrs.fetch(:controllable_acl, false)
  @fulltext_indexed            = attrs.fetch(:fulltext_indexed, false)
  @included_in_supertype_query = attrs.fetch(:included_in_supertype_query, false)

  @self_property_definitions = attrs.fetch(:property_definitions, []).dup
end

Instance Attribute Details

#base_idObject

Returns the value of attribute base_id.



4
5
6
# File 'lib/cmis_server/type.rb', line 4

def base_id
  @base_id
end

#controllable_aclObject

Returns the value of attribute controllable_acl.



4
5
6
# File 'lib/cmis_server/type.rb', line 4

def controllable_acl
  @controllable_acl
end

#controllable_policyObject

Returns the value of attribute controllable_policy.



4
5
6
# File 'lib/cmis_server/type.rb', line 4

def controllable_policy
  @controllable_policy
end

#creatableObject

Returns the value of attribute creatable.



4
5
6
# File 'lib/cmis_server/type.rb', line 4

def creatable
  @creatable
end

#descriptionObject

Returns the value of attribute description.



4
5
6
# File 'lib/cmis_server/type.rb', line 4

def description
  @description
end

#display_nameObject

Returns the value of attribute display_name.



4
5
6
# File 'lib/cmis_server/type.rb', line 4

def display_name
  @display_name
end

#fileableObject

Returns the value of attribute fileable.



4
5
6
# File 'lib/cmis_server/type.rb', line 4

def fileable
  @fileable
end

#fulltext_indexedObject

Returns the value of attribute fulltext_indexed.



4
5
6
# File 'lib/cmis_server/type.rb', line 4

def fulltext_indexed
  @fulltext_indexed
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/cmis_server/type.rb', line 4

def id
  @id
end

#included_in_supertype_queryObject

Returns the value of attribute included_in_supertype_query.



4
5
6
# File 'lib/cmis_server/type.rb', line 4

def included_in_supertype_query
  @included_in_supertype_query
end

#local_nameObject

Returns the value of attribute local_name.



4
5
6
# File 'lib/cmis_server/type.rb', line 4

def local_name
  @local_name
end

#local_namespaceObject

Returns the value of attribute local_namespace.



4
5
6
# File 'lib/cmis_server/type.rb', line 4

def local_namespace
  @local_namespace
end

#parent_typeObject

Returns the value of attribute parent_type.



4
5
6
# File 'lib/cmis_server/type.rb', line 4

def parent_type
  @parent_type
end

#query_nameObject

Returns the value of attribute query_name.



4
5
6
# File 'lib/cmis_server/type.rb', line 4

def query_name
  @query_name
end

#queryableObject

Returns the value of attribute queryable.



4
5
6
# File 'lib/cmis_server/type.rb', line 4

def queryable
  @queryable
end

#self_property_definitionsObject

Returns the value of attribute self_property_definitions.



4
5
6
# File 'lib/cmis_server/type.rb', line 4

def self_property_definitions
  @self_property_definitions
end

Instance Method Details

#base_typeObject



45
46
47
# File 'lib/cmis_server/type.rb', line 45

def base_type
  self.parent_type ? self.parent_type.base_type : self
end

#parent_idObject



41
42
43
# File 'lib/cmis_server/type.rb', line 41

def parent_id
  self.parent_type&.id
end

#parent_property_definitionsObject



57
58
59
60
# File 'lib/cmis_server/type.rb', line 57

def parent_property_definitions
  #Decorate parent property_definitions as inherited
  self.parent_type&.property_definitions.to_a.map { |pd| InheritedDecorator.new(pd) }
end

#property_definitionsObject



53
54
55
# File 'lib/cmis_server/type.rb', line 53

def property_definitions
  @self_property_definitions.to_a+parent_property_definitions
end