Class: YACCL::Model::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/yaccl/model/document.rb

Instance Attribute Summary collapse

Attributes inherited from Object

#base_type_id, #change_token, #created_by, #creation_date, #description, #last_modification_date, #last_modified_by, #name, #object_id, #object_type_id, #properties, #repository_id, #secondary_object_type_ids

Instance Method Summary collapse

Methods inherited from Object

#acls, #add_aces, #allowable_actions, #delete, #object_type, #parents, #policies, #relationships, #remove_aces, #repository, #unfile, #update_properties

Constructor Details

#initialize(repository_id, raw = {}) ⇒ Document

Returns a new instance of Document.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/yaccl/model/document.rb', line 20

def initialize(repository_id, raw={})
  super
  @is_immutable = @properties[:'cmis:isImmutable']
  @is_latest_version = @properties[:'cmis:isLatestVersion']
  @is_major_version = @properties[:'cmis:isMajorVersion']
  @is_lastest_major_version = @properties[:'cmis:isLatestMajorVersion']
  @is_private_working_copy = @properties[:'cmis:isPrivateWorkingCopy']
  @version_label = @properties[:'cmis:versionLabel']
  @version_series_id = @properties[:'cmis:versionSeriesId']
  @version_series_checked_out = @properties[:'cmis:isVersionSeriesCheckedOut']
  @version_series_checked_out_by = @properties[:'cmis:versionSeriesCheckedOutBy']
  @version_series_checked_out_id = @properties[:'cmis:versionSeriesCheckedOutId']
  @checkin_comment = @properties[:'cmis:checkinComment']
  @content_stream_length = @properties[:'cmis:contentStreamLength']
  @content_stream_mime_type = @properties[:'cmis:contentStreamMimeType']
  @content_stream_file_name = @properties[:'cmis:contentStreamFileName']
  @content_stream_id = @properties[:'cmis:contentStreamId']
end

Instance Attribute Details

#checkin_commentObject (readonly)

Returns the value of attribute checkin_comment.



14
15
16
# File 'lib/yaccl/model/document.rb', line 14

def checkin_comment
  @checkin_comment
end

#content_stream_file_nameObject (readonly)

Returns the value of attribute content_stream_file_name.



17
18
19
# File 'lib/yaccl/model/document.rb', line 17

def content_stream_file_name
  @content_stream_file_name
end

#content_stream_idObject (readonly)

Returns the value of attribute content_stream_id.



18
19
20
# File 'lib/yaccl/model/document.rb', line 18

def content_stream_id
  @content_stream_id
end

#content_stream_lengthObject (readonly)

Returns the value of attribute content_stream_length.



15
16
17
# File 'lib/yaccl/model/document.rb', line 15

def content_stream_length
  @content_stream_length
end

#content_stream_mime_typeObject (readonly)

Returns the value of attribute content_stream_mime_type.



16
17
18
# File 'lib/yaccl/model/document.rb', line 16

def content_stream_mime_type
  @content_stream_mime_type
end

#is_immutableObject (readonly)

Returns the value of attribute is_immutable.



4
5
6
# File 'lib/yaccl/model/document.rb', line 4

def is_immutable
  @is_immutable
end

#is_latest_major_versionObject (readonly)

Returns the value of attribute is_latest_major_version.



7
8
9
# File 'lib/yaccl/model/document.rb', line 7

def is_latest_major_version
  @is_latest_major_version
end

#is_latest_versionObject (readonly)

Returns the value of attribute is_latest_version.



5
6
7
# File 'lib/yaccl/model/document.rb', line 5

def is_latest_version
  @is_latest_version
end

#is_major_versionObject (readonly)

Returns the value of attribute is_major_version.



6
7
8
# File 'lib/yaccl/model/document.rb', line 6

def is_major_version
  @is_major_version
end

#is_private_working_copyObject (readonly)

Returns the value of attribute is_private_working_copy.



8
9
10
# File 'lib/yaccl/model/document.rb', line 8

def is_private_working_copy
  @is_private_working_copy
end

#version_labelObject (readonly)

Returns the value of attribute version_label.



9
10
11
# File 'lib/yaccl/model/document.rb', line 9

def version_label
  @version_label
end

#version_series_checked_outObject (readonly)

Returns the value of attribute version_series_checked_out.



11
12
13
# File 'lib/yaccl/model/document.rb', line 11

def version_series_checked_out
  @version_series_checked_out
end

#version_series_checked_out_byObject (readonly)

Returns the value of attribute version_series_checked_out_by.



12
13
14
# File 'lib/yaccl/model/document.rb', line 12

def version_series_checked_out_by
  @version_series_checked_out_by
end

#version_series_checked_out_idObject (readonly)

Returns the value of attribute version_series_checked_out_id.



13
14
15
# File 'lib/yaccl/model/document.rb', line 13

def version_series_checked_out_id
  @version_series_checked_out_id
end

#version_series_idObject (readonly)

Returns the value of attribute version_series_id.



10
11
12
# File 'lib/yaccl/model/document.rb', line 10

def version_series_id
  @version_series_id
end

Instance Method Details

#contentObject



44
45
46
47
48
49
50
# File 'lib/yaccl/model/document.rb', line 44

def content
  begin
    Services.get_content_stream(repository_id, object_id, nil, nil, nil)
  rescue Services::CMISRequestError
    nil
  end
end

#copy_in_folder(folder) ⇒ Object



39
40
41
42
# File 'lib/yaccl/model/document.rb', line 39

def copy_in_folder(folder)
  new_object_id = Services.create_document_from_source(repository_id, object_id, nil, folder.object_id, nil, nil, nil, nil)
  repository.object(new_object_id)
end

#create_in_folder(folder_id) ⇒ Object



61
62
63
64
# File 'lib/yaccl/model/document.rb', line 61

def create_in_folder(folder_id)
  hash = Services.create_document(repository_id, create_properties, folder_id, @local_content, nil, nil, nil, nil)
  ObjectFactory.create(repository_id, hash)
end

#set_content(stream, mime_type, filename) ⇒ Object



52
53
54
55
56
57
58
59
# File 'lib/yaccl/model/document.rb', line 52

def set_content(stream, mime_type, filename)
  content = {stream: stream, mime_type: mime_type, filename: filename}
  if detached?
    @local_content = content
  else
    Services.set_content_stream(repository_id, object_id, nil, nil, content)
  end
end