Module: UU::OS::Sheet
- Extended by:
- Sheet
- Included in:
- Sheet
- Defined in:
- uu_os-0.29.16/lib/uu/os/sheet/sheet_delete_version.rb,
uu_os-0.29.16/lib/uu/os/sheet.rb,
uu_os-0.29.16/lib/uu/os/sheet/mime_type.rb,
uu_os-0.29.16/lib/uu/os/sheet/sheet_create.rb,
uu_os-0.29.16/lib/uu/os/sheet/sheet_check_in.rb,
uu_os-0.29.16/lib/uu/os/sheet/sheet_check_out.rb,
uu_os-0.29.16/lib/uu/os/sheet/sheet_width_type.rb,
uu_os-0.29.16/lib/uu/os/sheet/sheet_attributes.rb,
uu_os-0.29.16/lib/uu/os/sheet/sheet_get_sheet_data.rb,
uu_os-0.29.16/lib/uu/os/sheet/sheet_get_image_data.rb,
uu_os-0.29.16/lib/uu/os/sheet/sheet_get_sheet_list.rb,
uu_os-0.29.16/lib/uu/os/sheet/sheet_set_attributes.rb,
uu_os-0.29.16/lib/uu/os/sheet/sheet_delete_versions.rb,
uu_os-0.29.16/lib/uu/os/sheet/sheet_get_version_list.rb,
uu_os-0.29.16/lib/uu/os/sheet/sheet_delete_component.rb,
uu_os-0.29.16/lib/uu/os/sheet/sheet_get_version_data.rb,
uu_os-0.29.16/lib/uu/os/sheet/sheet_replace_component.rb,
uu_os-0.29.16/lib/uu/os/sheet/sheet_get_component_data.rb,
uu_os-0.29.16/lib/uu/os/sheet/sheet_version_attributes.rb,
uu_os-0.29.16/lib/uu/os/sheet/sheet_get_component_content.rb,
uu_os-0.29.16/lib/uu/os/sheet/sheet_get_version_attributes.rb
Overview
Module Sheet.
Defined Under Namespace
Classes: MimeType, SheetAttributes, SheetCheckIn, SheetCheckOut, SheetCreate, SheetDeleteComponent, SheetDeleteVersion, SheetDeleteVersions, SheetGetComponentContent, SheetGetComponentData, SheetGetImageData, SheetGetSheetData, SheetGetSheetList, SheetGetVersionAttributes, SheetGetVersionData, SheetGetVersionList, SheetReplaceComponent, SheetSetAttributes, SheetVersionAttributes, SheetWidthType
Constant Summary
- PATH =
Service path
'ues/core/content/UESSheet'
Instance Method Summary (collapse)
-
- (Object) check_in(sheet_uri, sheet = nil)
This command changes the content of the public sheet version and unlocks it by default.
-
- (UU::OS::REST::BinaryValue) check_out(sheet_uri, sheet = nil)
This command locks the sheet for further modification, locks the given sheet of artifact.
-
- (UU::OS::UESURI) create(artifact_uri, sheet = nil)
Command creates a new sheet in the specified artifact.
-
- (Object) delete(sheet_uri)
Deletes the sheet from the system.
-
- (Object) delete_component(sheet_uri, sheet = nil)
Deletes specified component from the sheet.
-
- (Object) delete_version(sheet_uri, version = nil)
Deletes the version from the system.
-
- (Object) delete_versions(sheet_uri, versions = nil)
Deletes unlabeled historic versions of a given sheet, based on provided criteria.
-
- (SheetAttributes) get_attributes(sheet_uri)
Returns attributes representing the sheet specified by the sheetUri attribute.
-
- (UU::OS::REST::BinaryValue) get_component_data(sheet_uri, sheet = nil)
Returns the content of specified sheet component.
-
- (Object) get_image_data(sheet_uri, image)
Returns streamed data of the image from the specified content.
-
- (UU::OS::REST::BinaryValue) get_sheet_data(sheet_uri, sheet = nil)
Returns the content of the sheet specified by sheetUri.
-
- (Object) get_sheet_list(artifact_uri, criteria = nil)
This command returns a list of sheets on the specified artifact.
-
- (SheetVersionAttributes) get_version_attributes(sheet_uri, version = nil)
The uuCommand returns attributes of given sheet version.
-
- (UU::OS::REST::BinaryValue) get_version_data(sheet_uri, version)
Retrieves the specified historical version of the given sheet in xml format.
-
- (Array) get_version_list(sheet_uri, criteria = nil)
The uuCommand returns a list of sheet versions of the specified sheet.
-
- (Object) publish(sheet_uri)
Publishes private version and opens the lock sheet.
-
- (Array) replace_component(sheet_uri, sheet = nil)
The uuCommand replaces specified component with given content.
-
- (UU::OS::UESURI) set_attributes(sheet_uri, sheet = nil)
This command updates basic attributes of an sheet.
-
- (Object) unlock(sheet_uri)
Unlocks the specified sheet.
Instance Method Details
- (Object) check_in(sheet_uri, sheet = nil)
This command changes the content of the public sheet version and unlocks it by default. Sheet content is in UXML or UDF format, data are streamed.Sheet must be unlocked or the user must be the lock owner.
If using XML format document cannot contain links to property of object from other territory.
106 107 108 109 110 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 137 138 139 |
# File 'uu_os-0.29.16/lib/uu/os/sheet.rb', line 106 def check_in(sheet_uri, sheet = nil) svc = UU::OS::REST::RemoteClient.new(Sheet) dto = UU::OS::Sheet::SheetCheckIn.new(sheet) payload = dto.to_hash payload.delete(:content) tmpfile = Tempfile.new("SheetCheckIn") tmpfile.binmode begin if (!dto.content.kind_of?(UU::OS::REST::BinaryValue)) dto.content = UU::OS::REST::BinaryValue.new(dto.content) end if (dto.content.data.respond_to?(:read)) if (dto.content.data.respond_to?(:path)) payload[:content] = dto.content.to_hash(false) else dto.content.data.rewind tmpfile.write(dto.content.data.read) payload[:content] = tmpfile end else tmpfile.write(dto.content.data) payload[:content] = tmpfile end tmpfile.flush tmpfile.rewind UU::OS::QoS::QoSHandler.auto_retry do svc.post('checkIn', sheet_uri, payload) end ensure tmpfile.close tmpfile.unlink end end |
- (UU::OS::REST::BinaryValue) check_out(sheet_uri, sheet = nil)
This command locks the sheet for further modification, locks the given sheet of artifact. When lock succeed or sheet is currently locked by the user,sheet data can be returned. Sheet lock failure throws UESSheetRTException.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'uu_os-0.29.16/lib/uu/os/sheet.rb', line 83 def check_out(sheet_uri, sheet = nil) svc = UU::OS::REST::RemoteClient.new(Sheet) dto = UU::OS::Sheet::SheetCheckOut.new(sheet) payload = dto.to_json UU::OS::QoS::QoSHandler.auto_retry do if dto.lock_only == TRUE || dto.return_stream_handler == FALSE svc.post('checkOut', sheet_uri, payload) return nil else return svc.post_binary('checkOut', sheet_uri, payload) end end end |
- (UU::OS::UESURI) create(artifact_uri, sheet = nil)
Command creates a new sheet in the specified artifact. Initial sheet content could be specified. Content is streamed.
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'uu_os-0.29.16/lib/uu/os/sheet.rb', line 176 def create(artifact_uri, sheet = nil) svc = UU::OS::REST::RemoteClient.new(Sheet) dto = UU::OS::Sheet::SheetCreate.new(sheet) payload = dto.to_hash payload.delete(:content) tmpfile = Tempfile.new("SheetCreate") tmpfile.binmode begin if (!dto.content.nil?) if (!dto.content.kind_of?(UU::OS::REST::BinaryValue)) dto.content = UU::OS::REST::BinaryValue.new(dto.content) end if (dto.content.data.respond_to?(:read)) if (dto.content.data.respond_to?(:path)) payload[:content] = dto.content.to_hash(false) else dto.content.data.rewind tmpfile.write(dto.content.data.read) payload[:content] = tmpfile end else tmpfile.write(dto.content.data) payload[:content] = tmpfile end end tmpfile.flush tmpfile.rewind UU::OS::QoS::QoSHandler.auto_retry do res = svc.post('create', artifact_uri, payload) return UU::OS::UESURI.new(res) end ensure tmpfile.close tmpfile.unlink end end |
- (Object) delete(sheet_uri)
Deletes the sheet from the system.
307 308 309 310 311 312 |
# File 'uu_os-0.29.16/lib/uu/os/sheet.rb', line 307 def delete(sheet_uri) svc = UU::OS::REST::RemoteClient.new(Sheet) UU::OS::QoS::QoSHandler.auto_retry do svc.post('delete', sheet_uri) end end |
- (Object) delete_component(sheet_uri, sheet = nil)
Deletes specified component from the sheet.
318 319 320 321 322 323 324 325 |
# File 'uu_os-0.29.16/lib/uu/os/sheet.rb', line 318 def delete_component(sheet_uri, sheet = nil) svc = UU::OS::REST::RemoteClient.new(Sheet) payload = UU::OS::Sheet::SheetDeleteComponent.new(sheet).to_json UU::OS::QoS::QoSHandler.auto_retry do svc.post('deleteComponent', sheet_uri, payload) end end |
- (Object) delete_version(sheet_uri, version = nil)
Deletes the version from the system.
398 399 400 401 402 403 404 405 |
# File 'uu_os-0.29.16/lib/uu/os/sheet.rb', line 398 def delete_version(sheet_uri, version = nil) svc = UU::OS::REST::RemoteClient.new(Sheet) payload = UU::OS::Sheet::SheetDeleteVersion.new(version).to_json UU::OS::QoS::QoSHandler.auto_retry do svc.post('deleteVersion', sheet_uri, payload) end end |
- (Object) delete_versions(sheet_uri, versions = nil)
Deletes unlabeled historic versions of a given sheet, based on provided criteria. If olderThanTs timestamp is specified, only versions older than given timestamp will be deleted, otherwise will be deleted a year or more old versions. If olderThanTs is set as a date in the future, all unlabeled historic version will be deleted. Historic versions are deleted asynchronously, together with all the image mappings and images.
419 420 421 422 423 424 425 426 |
# File 'uu_os-0.29.16/lib/uu/os/sheet.rb', line 419 def delete_versions(sheet_uri, versions = nil) svc = UU::OS::REST::RemoteClient.new(Sheet) payload = UU::OS::Sheet::SheetDeleteVersions.new(versions).to_json UU::OS::QoS::QoSHandler.auto_retry do svc.post('deleteVersions', sheet_uri, payload) end end |
- (SheetAttributes) get_attributes(sheet_uri)
Returns attributes representing the sheet specified by the
sheetUri
attribute.
37 38 39 40 41 42 43 |
# File 'uu_os-0.29.16/lib/uu/os/sheet.rb', line 37 def get_attributes(sheet_uri) svc = UU::OS::REST::RemoteClient.new(Sheet) UU::OS::QoS::QoSHandler.auto_retry do res = svc.get('getAttributes', sheet_uri) return Sheet::SheetAttributes.new(res) end end |
- (UU::OS::REST::BinaryValue) get_component_data(sheet_uri, sheet = nil)
Returns the content of specified sheet component. The result is streamed in the BB code format by default. Available output data formats are UXML or BB code.
238 239 240 241 242 243 244 245 246 247 |
# File 'uu_os-0.29.16/lib/uu/os/sheet.rb', line 238 def get_component_data(sheet_uri, sheet = nil) svc = UU::OS::REST::RemoteClient.new(Sheet) dto = UU::OS::Sheet::SheetGetComponentData.new(sheet) svc.add_parameter("componentId", dto.component_id) svc.add_parameter("requestedMimeType", dto.requested_mime_type) UU::OS::QoS::QoSHandler.auto_retry do return svc.get_binary('getComponentData', sheet_uri) end end |
- (Object) get_image_data(sheet_uri, image)
Returns streamed data of the image from the specified content.
437 438 439 440 441 442 443 444 445 |
# File 'uu_os-0.29.16/lib/uu/os/sheet.rb', line 437 def get_image_data(sheet_uri, image) svc = UU::OS::REST::RemoteClient.new(Sheet) dto = UU::OS::Sheet::SheetGetImageData.new(image) svc.add_parameter('image', dto.image_id) UU::OS::QoS::QoSHandler.auto_retry do return svc.get_binary('getImageData',sheet_uri) end end |
- (UU::OS::REST::BinaryValue) get_sheet_data(sheet_uri, sheet = nil)
Returns the content of the sheet specified by sheetUri
. Data
are streamed. Available output data formats are UXML file, UDF archive, and
a zip archive with the sheet content exported as HTML document (see
SheetGetSheetData for more details).
155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'uu_os-0.29.16/lib/uu/os/sheet.rb', line 155 def get_sheet_data(sheet_uri, sheet = nil) svc = UU::OS::REST::RemoteClient.new(Sheet) dto = UU::OS::Sheet::SheetGetSheetData.new(sheet) svc.add_parameter('requestedMimeType', dto.requested_mime_type) UU::OS::QoS::QoSHandler.auto_retry do result = svc.get_binary('getSheetData', sheet_uri) if (dto.requested_mime_type == UU::OS::Sheet::MimeType::UXML) return UU::OS::REST::BinaryValue.new(StringIO.new(result.data.read.force_encoding("UTF-8")),false) else return result end end end |
- (Object) get_sheet_list(artifact_uri, criteria = nil)
This command returns a list of sheets on the specified artifact. Command does not return all sheets, only a sublist. The list of returned sheets couldbe filtered by the name, code, main, order of a sheet and state of the lock. The list is sorted by the name (and codes in case are equal) of asheet by default, or it can be sorted arbitrarily by any of sheet attributes usable for the filtering or these attributes combinations.
for selecting sheets. Available parameters are: name, code, order, main, locked, lockTime, visible and width : SheetWidthType.
63 64 65 66 67 68 69 70 71 72 73 |
# File 'uu_os-0.29.16/lib/uu/os/sheet.rb', line 63 def get_sheet_list(artifact_uri, criteria = nil) svc = UU::OS::REST::RemoteClient.new(Sheet) dto = Sheet::SheetGetSheetList.new(criteria) svc.add_parameter('pageIndex', dto.page_index) svc.add_parameter('pageSize', dto.page_size) svc.add_parameter('query', dto.query) UU::OS::QoS::QoSHandler.auto_retry do res = svc.get('getSheetList', artifact_uri) return UU::OS::REST::ResultList.new(Sheet::SheetGetSheetList, Sheet::SheetAttributes, res) end end |
- (SheetVersionAttributes) get_version_attributes(sheet_uri, version = nil)
The uuCommand returns attributes of given sheet version.
354 355 356 357 358 359 360 361 362 363 |
# File 'uu_os-0.29.16/lib/uu/os/sheet.rb', line 354 def get_version_attributes(sheet_uri, version = nil) svc = UU::OS::REST::RemoteClient.new(Sheet) dto = UU::OS::Sheet::SheetGetVersionAttributes.new(version) svc.add_parameter('versionID', dto.version_id) UU::OS::QoS::QoSHandler.auto_retry do res = svc.get('getVersionAttributes', sheet_uri) return Sheet::SheetVersionAttributes.new(res) end end |
- (UU::OS::REST::BinaryValue) get_version_data(sheet_uri, version)
Retrieves the specified historical version of the given sheet in xml format.
459 460 461 462 463 464 465 466 467 468 469 470 471 472 |
# File 'uu_os-0.29.16/lib/uu/os/sheet.rb', line 459 def get_version_data(sheet_uri, version) svc = UU::OS::REST::RemoteClient.new(Sheet) dto = UU::OS::Sheet::SheetGetVersionData.new(version) svc.add_parameter('requestedMimeType', dto.requested_mime_type) svc.add_parameter('versionID', dto.version_id) UU::OS::QoS::QoSHandler.auto_retry do result = svc.get_binary('getVersionData', sheet_uri) if (dto.requested_mime_type == UU::OS::Sheet::MimeType::UXML) return UU::OS::REST::BinaryValue.new(StringIO.new(result.data.read.force_encoding("UTF-8")),false) else return result end end end |
- (Array) get_version_list(sheet_uri, criteria = nil)
The uuCommand returns a list of sheet versions of the specified sheet.
376 377 378 379 380 381 382 383 384 385 386 387 |
# File 'uu_os-0.29.16/lib/uu/os/sheet.rb', line 376 def get_version_list(sheet_uri, criteria = nil) svc = UU::OS::REST::RemoteClient.new(Sheet) dto = Sheet::SheetGetVersionList.new(criteria) svc.add_parameter('pageIndex', dto.page_index) svc.add_parameter('pageSize', dto.page_size) svc.add_parameter('query', dto.query) UU::OS::QoS::QoSHandler.auto_retry do res = svc.get('getVersionList', sheet_uri) return UU::OS::REST::ResultList.new(Sheet::SheetGetVersionList, Sheet::SheetVersionAttributes, res) end end |
- (Object) publish(sheet_uri)
Publishes private version and opens the lock sheet. All changes made in private version are published.
287 288 289 290 291 292 |
# File 'uu_os-0.29.16/lib/uu/os/sheet.rb', line 287 def publish(sheet_uri) svc = UU::OS::REST::RemoteClient.new(Sheet) UU::OS::QoS::QoSHandler.auto_retry do svc.post('publish', sheet_uri) end end |
- (Array) replace_component(sheet_uri, sheet = nil)
The uuCommand replaces specified component with given content.
273 274 275 276 277 278 279 280 281 |
# File 'uu_os-0.29.16/lib/uu/os/sheet.rb', line 273 def replace_component(sheet_uri, sheet = nil) svc = UU::OS::REST::RemoteClient.new(Sheet) payload = UU::OS::Sheet::SheetReplaceComponent.new(sheet).to_json UU::OS::QoS::QoSHandler.auto_retry do res = svc.post('replaceComponent',sheet_uri, payload) return JSON.parse(res).values[0] end end |
- (UU::OS::UESURI) set_attributes(sheet_uri, sheet = nil)
This command updates basic attributes of an sheet.
333 334 335 336 337 338 339 340 341 |
# File 'uu_os-0.29.16/lib/uu/os/sheet.rb', line 333 def set_attributes(sheet_uri, sheet = nil) svc = UU::OS::REST::RemoteClient.new(Sheet) payload = UU::OS::Sheet::SheetSetAttributes.new(sheet).to_json UU::OS::QoS::QoSHandler.auto_retry do res = svc.post('setAttributes', sheet_uri, payload) return UU::OS::UESURI.new(res) end end |
- (Object) unlock(sheet_uri)
Unlocks the specified sheet. Allows to unlock the sheet locked by another user
297 298 299 300 301 302 |
# File 'uu_os-0.29.16/lib/uu/os/sheet.rb', line 297 def unlock(sheet_uri) svc = UU::OS::REST::RemoteClient.new(Sheet) UU::OS::QoS::QoSHandler.auto_retry do svc.post('unlock', sheet_uri) end end |