Module: UU::OS::SheetTemplate
- Extended by:
- SheetTemplate
- Included in:
- SheetTemplate
- Defined in:
- uu_os-0.29.16/lib/uu/os/sheet_template.rb,
uu_os-0.29.16/lib/uu/os/sheet_template/sheet_template_create.rb,
uu_os-0.29.16/lib/uu/os/sheet_template/sheet_template_check_in.rb,
uu_os-0.29.16/lib/uu/os/sheet_template/sheet_template_get_data.rb,
uu_os-0.29.16/lib/uu/os/sheet_template/sheet_template_attributes.rb,
uu_os-0.29.16/lib/uu/os/sheet_template/sheet_template_set_attributes.rb,
uu_os-0.29.16/lib/uu/os/sheet_template/sheet_template_get_sheet_template_list.rb
Defined Under Namespace
Classes: SheetTemplateAttributes, SheetTemplateCheckIn, SheetTemplateCreate, SheetTemplateGetData, SheetTemplateGetSheetTemplateList, SheetTemplateSetAttributes
Constant Summary
- PATH =
Service path
'ues/core/content/UESSheetTemplate'
Instance Method Summary (collapse)
-
- (Object) check_in(sheet_template_uri, sheet_template = nil)
Replaces the content of the specified sheet template and unlock it by default.
-
- (UU::OS::UESURI) create(meta_artifact_uri, sheet_template = nil)
Creates a new sheet template on the specified Meta Artifact.
-
- (Object) delete(sheet_template_uri)
Deletes the sheet template from the system.
-
- (SheetTemplateAttributes) get_attributes(sheet_template_uri)
Returns attributes representing specified sheet template.
-
- (UU::OS::REST::BinaryValue) get_data(sheet_template_uri, sheet_template = nil)
Returns the content of the sheet template.
-
- (Array) get_sheet_template_list(meta_artifact_uri, criteria = nil)
Returns a list of sheet templates on the specified Meta Artifact.
-
- (UU::OS::UESURI) set_attributes(sheet_template_uri, sheet_template = nil)
Updates basic attributes of the sheet template.
Instance Method Details
- (Object) check_in(sheet_template_uri, sheet_template = nil)
Replaces the content of the specified sheet template and unlock it by default. Sheet template content must be in UXML or UDF format. Sheet template must be locked by the current user or must be unlocked.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'uu_os-0.29.16/lib/uu/os/sheet_template.rb', line 56 def check_in(sheet_template_uri, sheet_template = nil) svc = UU::OS::REST::RemoteClient.new(SheetTemplate) dto = UU::OS::SheetTemplate::SheetTemplateCheckIn.new(sheet_template) payload = dto.to_hash payload.delete(:content) tmpfile = Tempfile.new("SheetTemplateCheckIn") 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_template_uri, payload) end ensure tmpfile.close tmpfile.unlink end end |
- (UU::OS::UESURI) create(meta_artifact_uri, sheet_template = nil)
Creates a new sheet template on the specified Meta Artifact. Initial sheet template content can be specified.
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 213 214 215 216 217 218 219 |
# File 'uu_os-0.29.16/lib/uu/os/sheet_template.rb', line 182 def create(, sheet_template = nil) svc = UU::OS::REST::RemoteClient.new(SheetTemplate) dto = UU::OS::SheetTemplate::SheetTemplateCreate.new(sheet_template) payload = dto.to_hash payload.delete(:content) tmpfile = Tempfile.new("SheetTemplateCreate") 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', , payload) return UU::OS::UESURI.new(res) end ensure tmpfile.close tmpfile.unlink end end |
- (Object) delete(sheet_template_uri)
Deletes the sheet template from the system.
228 229 230 231 232 233 |
# File 'uu_os-0.29.16/lib/uu/os/sheet_template.rb', line 228 def delete(sheet_template_uri) svc = UU::OS::REST::RemoteClient.new(SheetTemplate) UU::OS::QoS::QoSHandler.auto_retry do svc.post('delete', sheet_template_uri) end end |
- (SheetTemplateAttributes) get_attributes(sheet_template_uri)
Returns attributes representing specified sheet template.
29 30 31 32 33 34 35 |
# File 'uu_os-0.29.16/lib/uu/os/sheet_template.rb', line 29 def get_attributes(sheet_template_uri) svc = UU::OS::REST::RemoteClient.new(SheetTemplate) UU::OS::QoS::QoSHandler.auto_retry do res = svc.get('getAttributes', sheet_template_uri) return SheetTemplate::SheetTemplateAttributes.new(res) end end |
- (UU::OS::REST::BinaryValue) get_data(sheet_template_uri, sheet_template = nil)
Returns the content of the sheet template. The content may be returned as structured UXML or full content including images in a compressed UDF format. The type of the returned stream is determined by options (see UU::OS::SheetTemplate::SheetTemplateGetData#requested_mime_type), UXML is returned by default.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'uu_os-0.29.16/lib/uu/os/sheet_template.rb', line 103 def get_data(sheet_template_uri, sheet_template = nil) svc = UU::OS::REST::RemoteClient.new(SheetTemplate) dto = UU::OS::SheetTemplate::SheetTemplateGetData.new(sheet_template) svc.add_parameter('requestedMimeType', dto.requested_mime_type) UU::OS::QoS::QoSHandler.auto_retry do res = svc.get_binary('getData', sheet_template_uri) if res if (dto.requested_mime_type == UU::OS::Sheet::MimeType::UXML) return UU::OS::REST::BinaryValue.new(StringIO.new(res.data.read.force_encoding("UTF-8")),false) else return res end else return nil end end end |
- (Array) get_sheet_template_list(meta_artifact_uri, criteria = nil)
Returns a list of sheet templates on the specified Meta Artifact. Command does not return all sheet templates, only a sublist. The list of returned sheet templates could be filtered by the name, code, main, visible, order of a sheet template, state of the lock and width. The list is sorted by the name (and code in case are equal) of a sheet template by default, or it can be sorted arbitrarily by any of sheet template attributes usable for the filtering or these attributes combinations. See the UES query documentation for more information.
It is possible to filter result by: name, code, order, main, locked, lockTime, visible and width : UU::OS::Sheet::SheetWidthType.
141 142 143 144 145 146 147 148 149 150 151 |
# File 'uu_os-0.29.16/lib/uu/os/sheet_template.rb', line 141 def get_sheet_template_list(, criteria = nil) svc = UU::OS::REST::RemoteClient.new(SheetTemplate) dto = SheetTemplate::SheetTemplateGetSheetTemplateList.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('getSheetTemplateList', ) return UU::OS::REST::ResultList.new(SheetTemplate::SheetTemplateGetSheetTemplateList, SheetTemplate::SheetTemplateAttributes, res) end end |
- (UU::OS::UESURI) set_attributes(sheet_template_uri, sheet_template = nil)
Updates basic attributes of the sheet template.
259 260 261 262 263 264 265 266 267 |
# File 'uu_os-0.29.16/lib/uu/os/sheet_template.rb', line 259 def set_attributes(sheet_template_uri, sheet_template = nil) svc = UU::OS::REST::RemoteClient.new(SheetTemplate) payload = UU::OS::SheetTemplate::SheetTemplateSetAttributes.new(sheet_template).to_json UU::OS::QoS::QoSHandler.auto_retry do res = svc.post('setAttributes', sheet_template_uri, payload) return UU::OS::UESURI.new(res) end end |