Class: YACCL::Model::Type
- Inherits:
-
Object
- Object
- YACCL::Model::Type
- Defined in:
- lib/yaccl/model/type.rb
Instance Attribute Summary collapse
-
#allowed_source_types ⇒ Object
relationship type.
-
#allowed_target_types ⇒ Object
Returns the value of attribute allowed_target_types.
-
#base_id ⇒ Object
Returns the value of attribute base_id.
-
#content_stream_allowed ⇒ Object
Returns the value of attribute content_stream_allowed.
-
#controllable_acl ⇒ Object
Returns the value of attribute controllable_acl.
-
#controllable_policy ⇒ Object
Returns the value of attribute controllable_policy.
-
#creatable ⇒ Object
Returns the value of attribute creatable.
-
#description ⇒ Object
Returns the value of attribute description.
-
#display_name ⇒ Object
Returns the value of attribute display_name.
-
#fileable ⇒ Object
Returns the value of attribute fileable.
-
#fulltext_indexed ⇒ Object
Returns the value of attribute fulltext_indexed.
-
#id ⇒ Object
Returns the value of attribute id.
-
#included_in_supertype_query ⇒ Object
Returns the value of attribute included_in_supertype_query.
-
#local_name ⇒ Object
Returns the value of attribute local_name.
-
#local_namespace ⇒ Object
Returns the value of attribute local_namespace.
-
#parent_id ⇒ Object
Returns the value of attribute parent_id.
-
#property_definitions ⇒ Object
Returns the value of attribute property_definitions.
-
#query_name ⇒ Object
Returns the value of attribute query_name.
-
#queryable ⇒ Object
Returns the value of attribute queryable.
-
#repository_id ⇒ Object
readonly
Returns the value of attribute repository_id.
-
#versionable ⇒ Object
document type.
Class Method Summary collapse
Instance Method Summary collapse
- #add_property_definition(property) ⇒ Object
- #delete ⇒ Object
- #document_type? ⇒ Boolean
- #folder_type? ⇒ Boolean
-
#initialize(repository_id, hash = {}) ⇒ Type
constructor
A new instance of Type.
- #item_type? ⇒ Boolean
- #new_object ⇒ Object
- #policy_type? ⇒ Boolean
- #relationship_type? ⇒ Boolean
- #save ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(repository_id, hash = {}) ⇒ Type
Returns a new instance of Type.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/yaccl/model/type.rb', line 32 def initialize(repository_id, hash={}) @repository_id = repository_id @id = hash[:id] @local_name = hash[:localName] @local_namespace = hash[:localNamespace] @query_name = hash[:queryName] @display_name = hash[:displayName] @base_id = hash[:baseId] @parent_id = hash[:parentId] @description = hash[:description] @creatable = hash[:creatable] @fileable = hash[:fileable] @queryable = hash[:queryable] @controllable_policy = hash[:controllablePolicy] @controllable_acl = hash[:controllableACL] @fulltext_indexed = hash[:fulltextIndexed] @included_in_supertype_query = hash[:includedInSupertypeQuery] @property_definitions = hash[:propertyDefinitions] || {} @property_definitions.each { |k, v| @property_definitions[k] = PropertyDefinition.new(v) } # document type @versionable = hash[:versionable] @content_stream_allowed = hash[:contentStreamAllowed] # relationship type @allowed_source_types = hash[:allowedSourceTypes] @allowed_target_types = hash[:allowedTargetTypes] end |
Instance Attribute Details
#allowed_source_types ⇒ Object
relationship type
25 26 27 |
# File 'lib/yaccl/model/type.rb', line 25 def allowed_source_types @allowed_source_types end |
#allowed_target_types ⇒ Object
Returns the value of attribute allowed_target_types.
26 27 28 |
# File 'lib/yaccl/model/type.rb', line 26 def allowed_target_types @allowed_target_types end |
#base_id ⇒ Object
Returns the value of attribute base_id.
10 11 12 |
# File 'lib/yaccl/model/type.rb', line 10 def base_id @base_id end |
#content_stream_allowed ⇒ Object
Returns the value of attribute content_stream_allowed.
23 24 25 |
# File 'lib/yaccl/model/type.rb', line 23 def content_stream_allowed @content_stream_allowed end |
#controllable_acl ⇒ Object
Returns the value of attribute controllable_acl.
17 18 19 |
# File 'lib/yaccl/model/type.rb', line 17 def controllable_acl @controllable_acl end |
#controllable_policy ⇒ Object
Returns the value of attribute controllable_policy.
16 17 18 |
# File 'lib/yaccl/model/type.rb', line 16 def controllable_policy @controllable_policy end |
#creatable ⇒ Object
Returns the value of attribute creatable.
13 14 15 |
# File 'lib/yaccl/model/type.rb', line 13 def creatable @creatable end |
#description ⇒ Object
Returns the value of attribute description.
12 13 14 |
# File 'lib/yaccl/model/type.rb', line 12 def description @description end |
#display_name ⇒ Object
Returns the value of attribute display_name.
9 10 11 |
# File 'lib/yaccl/model/type.rb', line 9 def display_name @display_name end |
#fileable ⇒ Object
Returns the value of attribute fileable.
14 15 16 |
# File 'lib/yaccl/model/type.rb', line 14 def fileable @fileable end |
#fulltext_indexed ⇒ Object
Returns the value of attribute fulltext_indexed.
18 19 20 |
# File 'lib/yaccl/model/type.rb', line 18 def fulltext_indexed @fulltext_indexed end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/yaccl/model/type.rb', line 5 def id @id end |
#included_in_supertype_query ⇒ Object
Returns the value of attribute included_in_supertype_query.
19 20 21 |
# File 'lib/yaccl/model/type.rb', line 19 def included_in_supertype_query @included_in_supertype_query end |
#local_name ⇒ Object
Returns the value of attribute local_name.
6 7 8 |
# File 'lib/yaccl/model/type.rb', line 6 def local_name @local_name end |
#local_namespace ⇒ Object
Returns the value of attribute local_namespace.
7 8 9 |
# File 'lib/yaccl/model/type.rb', line 7 def local_namespace @local_namespace end |
#parent_id ⇒ Object
Returns the value of attribute parent_id.
11 12 13 |
# File 'lib/yaccl/model/type.rb', line 11 def parent_id @parent_id end |
#property_definitions ⇒ Object
Returns the value of attribute property_definitions.
20 21 22 |
# File 'lib/yaccl/model/type.rb', line 20 def property_definitions @property_definitions end |
#query_name ⇒ Object
Returns the value of attribute query_name.
8 9 10 |
# File 'lib/yaccl/model/type.rb', line 8 def query_name @query_name end |
#queryable ⇒ Object
Returns the value of attribute queryable.
15 16 17 |
# File 'lib/yaccl/model/type.rb', line 15 def queryable @queryable end |
#repository_id ⇒ Object (readonly)
Returns the value of attribute repository_id.
4 5 6 |
# File 'lib/yaccl/model/type.rb', line 4 def repository_id @repository_id end |
#versionable ⇒ Object
document type
22 23 24 |
# File 'lib/yaccl/model/type.rb', line 22 def versionable @versionable end |
Class Method Details
Instance Method Details
#add_property_definition(property) ⇒ Object
60 61 62 |
# File 'lib/yaccl/model/type.rb', line 60 def add_property_definition(property) @property_definitions[property[:id]] = property end |
#delete ⇒ Object
68 69 70 |
# File 'lib/yaccl/model/type.rb', line 68 def delete Services.delete_type(repository_id, id) end |
#document_type? ⇒ Boolean
91 92 93 |
# File 'lib/yaccl/model/type.rb', line 91 def document_type? base_id == 'cmis:document' end |
#folder_type? ⇒ Boolean
95 96 97 |
# File 'lib/yaccl/model/type.rb', line 95 def folder_type? base_id == 'cmis:folder' end |
#item_type? ⇒ Boolean
107 108 109 |
# File 'lib/yaccl/model/type.rb', line 107 def item_type? base_id == 'cmis:item' end |
#new_object ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/yaccl/model/type.rb', line 72 def new_object object = case base_id when 'cmis:document' Document.new(repository_id) when 'cmis:folder' Folder.new(repository_id) when 'cmis:relationship' Relationship.new(repository_id) when 'cmis:policy' Policy.new(repository_id) when 'cmis:item' Item.new(repository_id) else raise "Unsupported base type: #{base_id}" end object.object_type_id = id object end |
#policy_type? ⇒ Boolean
103 104 105 |
# File 'lib/yaccl/model/type.rb', line 103 def policy_type? base_id == 'cmis:policy' end |
#relationship_type? ⇒ Boolean
99 100 101 |
# File 'lib/yaccl/model/type.rb', line 99 def relationship_type? base_id == 'cmis:relationship' end |
#save ⇒ Object
64 65 66 |
# File 'lib/yaccl/model/type.rb', line 64 def save Type.create(repository_id, Services.update_type(repository_id, to_hash)) end |
#to_hash ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/yaccl/model/type.rb', line 111 def to_hash hash = {} hash[:id] = id hash[:localName] = local_name hash[:localNamespace] = local_namespace hash[:queryName]= query_name hash[:displayName]= display_name hash[:baseId]= base_id hash[:parentId]= parent_id hash[:description]= description hash[:creatable]= creatable hash[:fileable]= fileable hash[:queryable]= queryable hash[:controllablePolicy]= controllable_policy hash[:controllableACL]= controllable_acl hash[:fulltextIndexed]= fulltext_indexed hash[:includedInSupertypeQuery]= included_in_supertype_query hash[:propertyDefinitions]= property_definitions.to_hash # document type hash[:versionable] = versionable unless versionable.nil? hash[:contentStreamAllowed] = content_stream_allowed unless content_stream_allowed.nil? # relationship type hash[:allowedSourceTypes] = allowed_source_types unless allowed_source_types.nil? hash[:allowedTargetTypes] = allowed_target_types unless allowed_target_types.nil? hash end |