Module: UU::OS::PropertyTemplate
- Extended by:
- PropertyTemplate
- Included in:
- PropertyTemplate
- Defined in:
- uu_os-0.29.16/lib/uu/os/property_template.rb,
uu_os-0.29.16/lib/uu/os/property_template/property_template_move.rb,
uu_os-0.29.16/lib/uu/os/property_template/property_template_create.rb,
uu_os-0.29.16/lib/uu/os/property_template/property_template_attributes.rb,
uu_os-0.29.16/lib/uu/os/property_template/property_template_get_entry_list.rb,
uu_os-0.29.16/lib/uu/os/property_template/property_template_set_attributes.rb,
uu_os-0.29.16/lib/uu/os/property_template/property_template_move_collection.rb,
uu_os-0.29.16/lib/uu/os/property_template/property_template_entry_attributes.rb,
uu_os-0.29.16/lib/uu/os/property_template/property_template_delete_collection.rb,
uu_os-0.29.16/lib/uu/os/property_template/property_template_collection_create.rb,
uu_os-0.29.16/lib/uu/os/property_template/property_template_collection_attributes.rb,
uu_os-0.29.16/lib/uu/os/property_template/property_template_set_collection_attributes.rb
Overview
UES Property Template service.
Defined Under Namespace
Classes: PropertyTemplateAttributes, PropertyTemplateCollectionAttributes, PropertyTemplateCollectionCreate, PropertyTemplateCreate, PropertyTemplateDeleteCollection, PropertyTemplateEntryAttributes, PropertyTemplateGetEntryList, PropertyTemplateMove, PropertyTemplateMoveCollection, PropertyTemplateSetAttributes, PropertyTemplateSetCollectionAttributes
Constant Summary
- PATH =
Service path
'ues/core/property/UESPropertyTemplate'
Instance Method Summary (collapse)
-
- (UU::OS::UESURI) create(parent_node_uri, property_template = nil)
Creates a new property template on the specified Meta Artifact or in the specified property template group.
-
- (UU::OS::UESURI) create_collection(parent_node_uri, collection = nil)
Creates a new property template collection on the specified Meta Artifact or in the specified property collection template.
-
- (Object) delete(template_uri)
Deletes the property template from the system.
-
- (Object) delete_collection(collection_uri, collection = nil)
Deletes the specified property collection template.
-
- (PropertyTemplateAttributes) get_attributes(template_uri)
Returns attributes representing the specified property template.
-
- (PropertyTemplateCollectionAttributes) get_collection_attributes(collection_uri)
Returns attributes of the specified property collection template.
-
- (Array) get_entry_list(parent_node_uri, criteria = nil)
Returns a list of entries (property templates or property template collections) enlisted in the specified property template collection or on the specified Meta Artifact (property template entries from the Meta Artifact root property template collection are returned in that case).
-
- (Object) get_value(template_uri)
Returns the value of the given property template of the corresponding type.
-
- (Object) move(template_uri, collection = nil)
Moves a property template to the new location (see PropertyTemplateMove#parent_node_uri) on the same artifact.
-
- (Object) move_collection(collection_uri, collection = nil)
Moves a property template collection to the new location (see PropertyTemplateMoveCollection#parent_node_uri) on the same Meta Artifact.
-
- (UU::OS::UESURI) set_attributes(template_uri, property_template = nil)
Sets basic attributes of the specified property template.
-
- (UU::OS::UESURI) set_collection_attributes(collection_uri, collection = nil)
Modifies basic attributes of the property collection template specified in collTemplateUri.
-
- (Object) set_value(template_uri, value = nil)
Sets a new value on the specified property template.
Instance Method Details
- (UU::OS::UESURI) create(parent_node_uri, property_template = nil)
Creates a new property template on the specified Meta Artifact or in the specified property template group. At the very least property template type and name have to be specified in this command. Value of the property template is optional.
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 |
# File 'uu_os-0.29.16/lib/uu/os/property_template.rb', line 183 def create(parent_node_uri, property_template = nil) svc = UU::OS::REST::RemoteClient.new(PropertyTemplate) prop = UU::OS::PropertyTemplate::PropertyTemplateCreate.new(property_template) value = prop.value if (value.kind_of?File) prop.value = UU::OS::REST::BinaryValue.new(value) end if (prop.value.kind_of?UU::OS::REST::BinaryValue) payload = prop.to_hash payload.delete(:value) if (prop.value.data.kind_of?File) payload[:value] = create_file_with_file_name(prop.value) else payload[:value] = create_stream_with_file_name(prop.value) end else payload = prop.to_json end UU::OS::QoS::QoSHandler.auto_retry do res = svc.post('create', parent_node_uri, payload) return UU::OS::UESURI.new(res) end end |
- (UU::OS::UESURI) create_collection(parent_node_uri, collection = nil)
Creates a new property template collection on the specified Meta Artifact or in the specified property collection template. At the very least property template collection name has to be specified in this command.
271 272 273 274 275 276 277 278 279 |
# File 'uu_os-0.29.16/lib/uu/os/property_template.rb', line 271 def create_collection(parent_node_uri, collection = nil) svc = UU::OS::REST::RemoteClient.new(PropertyTemplate) payload = UU::OS::PropertyTemplate::PropertyTemplateCollectionCreate.new(collection).to_json UU::OS::QoS::QoSHandler.auto_retry do res = svc.post('createCollection', parent_node_uri, payload) return UU::OS::UESURI.new(res) end end |
- (Object) delete(template_uri)
Deletes the property template from the system.
216 217 218 219 220 221 |
# File 'uu_os-0.29.16/lib/uu/os/property_template.rb', line 216 def delete(template_uri) svc = UU::OS::REST::RemoteClient.new(PropertyTemplate) UU::OS::QoS::QoSHandler.auto_retry do svc.post('delete', template_uri) end end |
- (Object) delete_collection(collection_uri, collection = nil)
Deletes the specified property collection template. When recursive is set in options, all nested objects in property collection template are also removed.
375 376 377 378 379 380 381 382 |
# File 'uu_os-0.29.16/lib/uu/os/property_template.rb', line 375 def delete_collection(collection_uri, collection = nil) svc = UU::OS::REST::RemoteClient.new(PropertyTemplate) payload = UU::OS::PropertyTemplate::PropertyTemplateDeleteCollection.new(collection).to_json UU::OS::QoS::QoSHandler.auto_retry do svc.post('deleteCollection', collection_uri, payload) end end |
- (PropertyTemplateAttributes) get_attributes(template_uri)
Returns attributes representing the specified property template.
36 37 38 39 40 41 42 |
# File 'uu_os-0.29.16/lib/uu/os/property_template.rb', line 36 def get_attributes(template_uri) svc = UU::OS::REST::RemoteClient.new(PropertyTemplate) UU::OS::QoS::QoSHandler.auto_retry do res = svc.get('getAttributes', template_uri) return PropertyTemplate::PropertyTemplateAttributes.new(res) end end |
- (PropertyTemplateCollectionAttributes) get_collection_attributes(collection_uri)
Returns attributes of the specified property collection template.
290 291 292 293 294 295 296 |
# File 'uu_os-0.29.16/lib/uu/os/property_template.rb', line 290 def get_collection_attributes(collection_uri) svc = UU::OS::REST::RemoteClient.new(PropertyTemplate) UU::OS::QoS::QoSHandler.auto_retry do res = svc.get('getCollectionAttributes', collection_uri) return PropertyTemplate::PropertyTemplateCollectionAttributes.new(res) end end |
- (Array) get_entry_list(parent_node_uri, criteria = nil)
Returns a list of entries (property templates or property template collections) enlisted in the specified property template collection or on the specified Meta Artifact (property template entries from the Meta Artifact root property template collection are returned in that case). Command does not return all entries, only a sublist. The list of returned entries could be filtered by the name, code or type of an entry. The list is sorted by the name (and code in case are equal) of an entry by default, or it can be sorted arbitrarily by any of entry 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, entityTypeUri, valueType
138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'uu_os-0.29.16/lib/uu/os/property_template.rb', line 138 def get_entry_list(parent_node_uri, criteria = nil) svc = UU::OS::REST::RemoteClient.new(PropertyTemplate) dto = PropertyTemplate::PropertyTemplateGetEntryList.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('getEntryList', parent_node_uri) res = UU::OS::REST::ResultList.new(PropertyTemplate::PropertyTemplateGetEntryList, PropertyTemplate::PropertyTemplateEntryAttributes, res) return res end end |
- (Object) get_value(template_uri)
Returns the value of the given property template of the corresponding type. Null in case the value is not set.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'uu_os-0.29.16/lib/uu/os/property_template.rb', line 94 def get_value(template_uri) svc = UU::OS::REST::RemoteClient.new(PropertyTemplate) UU::OS::QoS::QoSHandler.auto_retry do raw = svc.raw_get_binary('getValue', template_uri) type = raw[2][:uu_property_value_type] value = svc.process_result(raw) result = deserialize_by_type(value,type) if (result.kind_of?UU::OS::REST::BinaryValue) if (raw[2][:content_disposition] != nil) disps = raw[2][:content_disposition].split(";") disps.each do |part| kv = part.lstrip.split("=") if kv[0]=="filename" result.name = kv[1] end end end end return result end end |
- (Object) move(template_uri, collection = nil)
Moves a property template to the new location (see UU::OS::PropertyTemplate::PropertyTemplateMove#parent_node_uri) on the same artifact. New location can be property template collection or Meta Artifact.
333 334 335 336 337 338 339 340 |
# File 'uu_os-0.29.16/lib/uu/os/property_template.rb', line 333 def move(template_uri, collection = nil) svc = UU::OS::REST::RemoteClient.new(PropertyTemplate) payload = UU::OS::PropertyTemplate::PropertyTemplateMove.new(collection).to_json UU::OS::QoS::QoSHandler.auto_retry do svc.post('move', template_uri, payload) end end |
- (Object) move_collection(collection_uri, collection = nil)
Moves a property template collection to the new location (see UU::OS::PropertyTemplate::PropertyTemplateMoveCollection#parent_node_uri) on the same Meta Artifact. This template collection can not be base template collection. New location can be property template collection or Meta Artifact, and it can not be child of or the same as property template collection which is about to be moved.
354 355 356 357 358 359 360 361 |
# File 'uu_os-0.29.16/lib/uu/os/property_template.rb', line 354 def move_collection(collection_uri, collection = nil) svc = UU::OS::REST::RemoteClient.new(PropertyTemplate) payload = UU::OS::PropertyTemplate::PropertyTemplateMoveCollection.new(collection).to_json UU::OS::QoS::QoSHandler.auto_retry do svc.post('moveCollection', collection_uri, payload) end end |
- (UU::OS::UESURI) set_attributes(template_uri, property_template = nil)
Sets basic attributes of the specified property template.
247 248 249 250 251 252 253 254 |
# File 'uu_os-0.29.16/lib/uu/os/property_template.rb', line 247 def set_attributes(template_uri, property_template = nil) svc = UU::OS::REST::RemoteClient.new(PropertyTemplate) payload = UU::OS::PropertyTemplate::PropertyTemplateSetAttributes.new(property_template).to_json UU::OS::QoS::QoSHandler.auto_retry do res = svc.post('setAttributes', template_uri, payload) return UU::OS::UESURI.new(res) end end |
- (UU::OS::UESURI) set_collection_attributes(collection_uri, collection = nil)
Modifies basic attributes of the property collection template specified in collTemplateUri.
312 313 314 315 316 317 318 319 320 |
# File 'uu_os-0.29.16/lib/uu/os/property_template.rb', line 312 def set_collection_attributes(collection_uri, collection = nil) svc = UU::OS::REST::RemoteClient.new(PropertyTemplate) payload = UU::OS::PropertyTemplate::PropertyTemplateSetCollectionAttributes.new(collection).to_json UU::OS::QoS::QoSHandler.auto_retry do res = svc.post('setCollectionAttributes', collection_uri, payload) return UU::OS::UESURI.new(res) end end |
- (Object) set_value(template_uri, value = nil)
Sets a new value on the specified property template. The data type of the value must match the data type of the specified property template.
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 |
# File 'uu_os-0.29.16/lib/uu/os/property_template.rb', line 58 def set_value(template_uri, value = nil) svc = UU::OS::REST::RemoteClient.new(PropertyTemplate) payload = {} if (value.kind_of?IO) value = UU::OS::REST::BinaryValue.new(value) end if ((value.kind_of?UU::OS::REST::BinaryValue) && (value.data.nil?) && (!value.name.nil? && !value.name.empty?)) payload[:defaultName] = value.name elsif (value.kind_of?UU::OS::REST::BinaryValue) && (!value.data.nil?) if (value.data.kind_of?File) && (File.basename(value.data.path) == value.name) payload[:defaultName] = value.name end if (value.data.kind_of?File) payload[:value] = create_file_with_file_name(value) else payload[:value] = create_stream_with_file_name(value) end else payload = value.to_json end UU::OS::QoS::QoSHandler.auto_retry do svc.post('setValue', template_uri, payload) end end |