Class: UU::OS::Content::Sheet
- Inherits:
-
ContentClient
- Object
- ContentClient
- UU::OS::Content::Sheet
- Defined in:
- lib/uu/os/content/sheet.rb
Class Method Summary collapse
-
.create(artifact_uri, dto = nil) ⇒ Object
#create convenience self-instantiating shortcut.
-
.delete(sheet_uri) ⇒ Object
#delete convenience self-instantiating shortcut.
-
.export(sheet_uri) ⇒ Object
#export convenience self-instantiating shortcut.
-
.get_attributes(sheet_uri) ⇒ Object
#get_attributes convenience self-instantiating shortcut.
-
.get_data(sheet_uri, version_id = nil) ⇒ Object
#get_data convenience self-instantiating shortcut.
-
.get_sheet_list(artifact_uri, query = nil) ⇒ Object
#get_sheet_list convenience self-instantiating shortcut.
-
.get_sheet_template_list(artifact_uri, query = nil) ⇒ Object
#get_sheet_template_list convenience self-instantiating shortcut.
-
.import(sheet_uri, data = nil) ⇒ Object
#import convenience self-instantiating shortcut.
-
.lock(sheet_uri, sheet = nil) ⇒ Object
#lock convenience self-instantiating shortcut.
-
.set_attributes(sheet_uri, sheet = nil) ⇒ Object
#set_attributes convenience self-instantiating shortcut.
-
.set_constraints(sheet_uri, constraints = nil) ⇒ Object
#set_constraints convenience self-instantiating shortcut.
-
.set_data(sheet_uri, data = nil) ⇒ Object
#set_data convenience self-instantiating shortcut.
-
.unlock(sheet_uri) ⇒ Object
#unlock convenience self-instantiating shortcut.
Instance Method Summary collapse
-
#create(artifact_uri, sheet = nil) ⇒ UU::OS::UESURI
Creates a new sheet on a given Artifact.
-
#delete(sheet_uri) ⇒ Object
Removes the given sheet from the system including its content.
-
#export(sheet_uri) ⇒ BinaryValue
Exports the content of the sheet in the ZIP format.
-
#get_attributes(sheet_uri) ⇒ Hash
Retrieves the attributes of the given sheet.
-
#get_data(sheet_uri, version_id = nil) ⇒ Array<Hash>
Retrieves the content structure of the given sheet.
-
#get_sheet_list(artifact_uri, query = nil) ⇒ Array<Hash>
Retrieves a list of sheets on the specified Artifact.
-
#get_sheet_template_list(artifact_uri, query = nil) ⇒ Array<Hash>
Retrieves a list of sheet templates on the specified Meta Artifact.
-
#import(sheet_uri, data = nil) ⇒ Object
Imports the content of the sheet in the ZIP format.
-
#initialize(session) ⇒ Sheet
constructor
Creates a new instance of
Sheet
. -
#lock(sheet_uri, sheet = nil) ⇒ Object
Locks sheet content.
-
#set_attributes(sheet_uri, sheet = nil) ⇒ UU::OS::UESURI
Updates basic attributes of the given sheet.
-
#set_constraints(sheet_uri, constraints = nil) ⇒ Object
Sets constraints on the sheet.
-
#set_data(sheet_uri, data = nil) ⇒ Object
Modifies content structure on the given sheet.
-
#unlock(sheet_uri) ⇒ Object
Unlocks the content of the given sheet.
Constructor Details
Class Method Details
.create(artifact_uri, dto = nil) ⇒ Object
#create convenience self-instantiating shortcut
78 79 80 81 |
# File 'lib/uu/os/content/sheet.rb', line 78 def self.create(artifact_uri, dto = nil) session = UU::OS::Security::Session.current_session self.new(session).create(artifact_uri, dto) end |
.delete(sheet_uri) ⇒ Object
#delete convenience self-instantiating shortcut
94 95 96 97 |
# File 'lib/uu/os/content/sheet.rb', line 94 def self.delete(sheet_uri) session = UU::OS::Security::Session.current_session self.new(session).delete(sheet_uri) end |
.export(sheet_uri) ⇒ Object
#export convenience self-instantiating shortcut
412 413 414 415 |
# File 'lib/uu/os/content/sheet.rb', line 412 def self.export(sheet_uri) session = UU::OS::Security::Session.current_session self.new(session).export(sheet_uri) end |
.get_attributes(sheet_uri) ⇒ Object
#get_attributes convenience self-instantiating shortcut
130 131 132 133 |
# File 'lib/uu/os/content/sheet.rb', line 130 def self.get_attributes(sheet_uri) session = UU::OS::Security::Session.current_session self.new(session).get_attributes(sheet_uri) end |
.get_data(sheet_uri, version_id = nil) ⇒ Object
#get_data convenience self-instantiating shortcut
189 190 191 192 |
# File 'lib/uu/os/content/sheet.rb', line 189 def self.get_data(sheet_uri, version_id = nil) session = UU::OS::Security::Session.current_session self.new(session).get_data(sheet_uri , version_id) end |
.get_sheet_list(artifact_uri, query = nil) ⇒ Object
#get_sheet_list convenience self-instantiating shortcut
221 222 223 224 |
# File 'lib/uu/os/content/sheet.rb', line 221 def self.get_sheet_list(artifact_uri, query = nil) session = UU::OS::Security::Session.current_session self.new(session).get_sheet_list(artifact_uri, query) end |
.get_sheet_template_list(artifact_uri, query = nil) ⇒ Object
#get_sheet_template_list convenience self-instantiating shortcut
253 254 255 256 |
# File 'lib/uu/os/content/sheet.rb', line 253 def self.get_sheet_template_list(artifact_uri, query = nil) session = UU::OS::Security::Session.current_session self.new(session).get_sheet_template_list(artifact_uri, query) end |
.import(sheet_uri, data = nil) ⇒ Object
#import convenience self-instantiating shortcut
440 441 442 443 |
# File 'lib/uu/os/content/sheet.rb', line 440 def self.import(sheet_uri, data=nil) session = UU::OS::Security::Session.current_session self.new(session).import(sheet_uri, data) end |
.lock(sheet_uri, sheet = nil) ⇒ Object
#lock convenience self-instantiating shortcut
271 272 273 274 |
# File 'lib/uu/os/content/sheet.rb', line 271 def self.lock(sheet_uri, sheet=nil) session = UU::OS::Security::Session.current_session self.new(session).lock(sheet_uri, sheet) end |
.set_attributes(sheet_uri, sheet = nil) ⇒ Object
#set_attributes convenience self-instantiating shortcut
314 315 316 317 |
# File 'lib/uu/os/content/sheet.rb', line 314 def self.set_attributes(sheet_uri, sheet = nil) session = UU::OS::Security::Session.current_session self.new(session).set_attributes(sheet_uri, sheet) end |
.set_constraints(sheet_uri, constraints = nil) ⇒ Object
#set_constraints convenience self-instantiating shortcut
332 333 334 335 |
# File 'lib/uu/os/content/sheet.rb', line 332 def self.set_constraints(sheet_uri, constraints = nil) session = UU::OS::Security::Session.current_session self.new(session).set_constraints(sheet_uri, constraints) end |
Instance Method Details
#create(artifact_uri, sheet = nil) ⇒ UU::OS::UESURI
Creates a new sheet on a given Artifact. The initial content of the sheet can be specified.
72 73 74 75 |
# File 'lib/uu/os/content/sheet.rb', line 72 def create(artifact_uri, sheet = nil) res = @cmd.invoke("Sheet/create", artifact_uri, prepare_params(sheet)) return UU::OS::UESURI.new(res) end |
#delete(sheet_uri) ⇒ Object
Removes the given sheet from the system including its content.
89 90 91 |
# File 'lib/uu/os/content/sheet.rb', line 89 def delete(sheet_uri) @cmd.invoke("Sheet/delete", sheet_uri) end |
#export(sheet_uri) ⇒ BinaryValue
Exports the content of the sheet in the ZIP format. All the richtext elements are contained in the dedicated subfolders with richtext's id as the name
406 407 408 409 |
# File 'lib/uu/os/content/sheet.rb', line 406 def export(sheet_uri) binary_value = @cmd.invoke('Sheet/export', sheet_uri) return binary_value end |
#get_attributes(sheet_uri) ⇒ Hash
Retrieves the attributes of the given sheet.
123 124 125 126 127 |
# File 'lib/uu/os/content/sheet.rb', line 123 def get_attributes(sheet_uri) params = transform(@cmd.invoke('Sheet/getAttributes', sheet_uri)) #, invocation_method: 'get') params.delete(:comments_hidden) params end |
#get_data(sheet_uri, version_id = nil) ⇒ Array<Hash>
Retrieves the content structure of the given sheet. The data of each component in content is not returned.
184 185 186 |
# File 'lib/uu/os/content/sheet.rb', line 184 def get_data(sheet_uri, version_id = nil) transform(@cmd.invoke('Sheet/getData', sheet_uri, prepare_params(version_id))) #, invocation_method: 'get') end |
#get_sheet_list(artifact_uri, query = nil) ⇒ Array<Hash>
Retrieves a list of sheets on the specified Artifact. The list of the returned sheets can be filtered and ordered arbitrarily. The parameters available for customized filtering and ordering are the following: name, code, order, main, lock_time, lock_role_uri, lock_access_role_uri. The list is sorted by order of the sheet by default.
209 210 211 212 213 214 215 216 217 218 |
# File 'lib/uu/os/content/sheet.rb', line 209 def get_sheet_list(artifact_uri, query = nil) list = @cmd.invoke('Sheet/getSheetList', artifact_uri, prepare_params(query)) list.map! { |params| params.delete(:isTemplate) trParams = transform(params) trParams.delete(:comments_hidden) trParams } list end |
#get_sheet_template_list(artifact_uri, query = nil) ⇒ Array<Hash>
Retrieves a list of sheet templates on the specified Meta Artifact. The list of the returned sheets can be filtered and ordered arbitrarily. The parameters available for customized filtering and ordering are the following: name, code, order, main, lock_time, lock_role_uri, lock_access_role_uri. The list is sorted by order of the sheet by default.
241 242 243 244 245 246 247 248 249 250 |
# File 'lib/uu/os/content/sheet.rb', line 241 def get_sheet_template_list(artifact_uri, query = nil) list = @cmd.invoke('Sheet/getSheetTemplateList', artifact_uri, prepare_params(query)) list.map! { |params| params.delete(:isTemplate) trParams = transform(params) trParams.delete(:comments_hidden) trParams } list end |
#import(sheet_uri, data = nil) ⇒ Object
Imports the content of the sheet in the ZIP format.
431 432 433 434 435 436 437 |
# File 'lib/uu/os/content/sheet.rb', line 431 def import(sheet_uri, data = nil) if data[:data].is_a?(UU::OS::Lang::BinaryValue) data[:data] = data[:data].content end params = {:parameters => data[:data], :content_type=>"application/octet-stream"} @cmd.invoke('Sheet/import', sheet_uri, params) end |
#lock(sheet_uri, sheet = nil) ⇒ Object
Locks sheet content. If successful, all inner content parts are considered locked as well.
266 267 268 |
# File 'lib/uu/os/content/sheet.rb', line 266 def lock(sheet_uri, sheet = nil) @cmd.invoke('Sheet/lock', sheet_uri, prepare_params(sheet)) end |
#set_attributes(sheet_uri, sheet = nil) ⇒ UU::OS::UESURI
Updates basic attributes of the given sheet.
308 309 310 311 |
# File 'lib/uu/os/content/sheet.rb', line 308 def set_attributes(sheet_uri, sheet = nil) res = @cmd.invoke('Sheet/setAttributes', sheet_uri, prepare_params(sheet)) return UU::OS::UESURI.new(res) end |
#set_constraints(sheet_uri, constraints = nil) ⇒ Object
Sets constraints on the sheet. The only possible constraint is readonly.
327 328 329 |
# File 'lib/uu/os/content/sheet.rb', line 327 def set_constraints(sheet_uri, constraints = nil) @cmd.invoke('Sheet/setConstraints', sheet_uri, prepare_params(constraints)) end |
#set_data(sheet_uri, data = nil) ⇒ Object
Modifies content structure on the given sheet. In case input content contains part that is already defined on the list (recognized by its id) it is updated, otherwise replaced.
385 386 387 |
# File 'lib/uu/os/content/sheet.rb', line 385 def set_data(sheet_uri, data = nil) @cmd.invoke('Sheet/setData', sheet_uri, prepare_params(data)) end |
#unlock(sheet_uri) ⇒ Object
Unlocks the content of the given sheet. Locked sheet with flag force set to true can be unlocked by lock owner or anyone with sufficient rights. Locked sheet without flag force set to true can be unlocked only by lock owner.
284 285 286 |
# File 'lib/uu/os/content/sheet.rb', line 284 def unlock(sheet_uri) @cmd.invoke('Sheet/unlock', sheet_uri) end |