Module: UU::OS::MetaGroup

Extended by:
MetaGroup
Included in:
MetaGroup
Defined in:
uu_os-0.29.16/lib/uu/os/meta_group.rb,
uu_os-0.29.16/lib/uu/os/meta_group/meta_group_copy.rb,
uu_os-0.29.16/lib/uu/os/meta_group/meta_group_export.rb,
uu_os-0.29.16/lib/uu/os/meta_group/meta_group_create.rb,
uu_os-0.29.16/lib/uu/os/meta_group/meta_group_attributes.rb,
uu_os-0.29.16/lib/uu/os/meta_group/meta_group_set_attributes.rb,
uu_os-0.29.16/lib/uu/os/meta_group/meta_group_get_export_data.rb,
uu_os-0.29.16/lib/uu/os/meta_group/meta_group_add_role_interface.rb,
uu_os-0.29.16/lib/uu/os/meta_group/meta_group_remove_role_interface.rb,
uu_os-0.29.16/lib/uu/os/meta_group/meta_group_get_role_interface_list.rb,
uu_os-0.29.16/lib/uu/os/meta_group/meta_group_get_role_interface_list_item.rb

Overview

Module Meta Group.

Defined Under Namespace

Classes: MetaGroupAddRoleInterface, MetaGroupAttributes, MetaGroupCopy, MetaGroupCreate, MetaGroupExport, MetaGroupGetExportData, MetaGroupGetRoleInterfaceList, MetaGroupGetRoleInterfaceListItem, MetaGroupRemoveRoleInterface, MetaGroupSetAttributes

Constant Summary

PATH =

Service path

'ues/core/role/UESMetaGroup'

Instance Method Summary (collapse)

Instance Method Details

- (Object) add_role_interface(meta_group_uri, role_interface = nil)

Creates new role interface connection to the specified meta group. The role interface has to be in an active state and must not be already added. The role interface can be added to meta group only provided that role interface is located in the same, child or parent meta model as meta group.

Examples:

# Connect another role interface to a meta group
UU::OS::MetaGroup.add_role_interface('ues:TERRITORY:META_GROUP', :role_interface_uri => 'ues:TERRITORY:ROLE_INTERFACE')

Parameters:

Options Hash (role_interface):

  • :role_interface_uri (String, UU::OS::UESURI)

    UESURI of the role interface that is to be connected to the specified meta group.



135
136
137
138
139
140
141
142
# File 'uu_os-0.29.16/lib/uu/os/meta_group.rb', line 135

def add_role_interface(meta_group_uri, role_interface = nil)
  svc = UU::OS::REST::RemoteClient.new(MetaGroup)
  payload = UU::OS::MetaGroup::MetaGroupAddRoleInterface.new(role_interface).to_json

  UU::OS::QoS::QoSHandler.auto_retry do
    svc.post('addRoleInterface', meta_group_uri, payload)
  end
end

- (UU::OS::UESURI) copy(source_meta_artifact_uri, meta_group = nil)

Copy a meta group. The command creates a new meta group according to specified source meta group in a specified location. At the very least location meta group and name must be specified in MetaGroupCopy DTO. Competent role for the new meta group copy will be selected as the most suitable according to specified container and meta group (executive/authorized role with connected interface), or can be also specified in MetaGroupCopy DTO.

Examples:

# Copy a meta group (including its sheets); change a few attributes
UU::OS::MetaGroup.copy('ues:TERRITORY:META_GROUP', :location_uri => 'ues:TERRITORY:APP_PACKAGE', :code => 'META_GROUP_COPY',
  :icon_uri => 'ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{ART_077}',
  :security_level => UU::OS::Artifact::SecurityLevel::INTERNAL_USE, :copy_sheets => true)

Parameters:

Options Hash (meta_group):

  • :location_uri (String, UU::OS::UESURI)

    UESURI of the meta model dictionary where to the meta group will be copied.

  • :name (String)

    Name of the new meta group copy. The value must not be blank.

  • :code (String)

    Code of the new meta group copy.

  • :description (String)

    Description of the new meta group copy.

  • :competent_role_uri (String, UU::OS::UESURI)

    UESURI of the competent role.

  • :security_level (String, UU::OS::Artifact::SecurityLevel)

    Security level.

  • :icon_uri (String, UU::OS::UESURI)

    URI of the new meta group’s icon. Allowed format of icon URI: ‘ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{CODE_OF_ICON}’.

  • :copy_sheets (Boolean)

    Specifies whether to copy content from the source meta group to the new copy. Default value is false.

  • :copy_lifecycle (Boolean)

    Specifies whether to copy workflow from the source meta group to the new copy. Default value is false.

  • :copy_attachments (Boolean)

    Specifies whether to copy attachments from the source meta group to the new copy. Default value is false.

  • :copy_sheet_templates (Boolean)

    Specifies whether to copy sheet templates from the source meta group to the new copy. Default value is false.

  • :default_name (String)

    Specifies default name of the created role according to new meta group copy.

  • :default_code (String)

    Specifies default code of the created role according to new meta group copy.

  • :default_security_level (String, UU::OS::Artifact::SecurityLevel)

    Specifies default security level of the created role according to new meta group copy.

  • :default_icon_uri (String, UU::OS::UESURI)

    Specifies default icon of the created role according to new meta group copy. Allowed format of icon URI: ‘ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{CODE_OF_ICON}’.

  • :default_searchable_in_territory (String)

    Specifies if it is possible to search for the role created according to the meta group in its territory.

  • :component_content (Boolean)

    Defines whether the primarily displayed content of the created Meta group is component content. Default value is false.

  • :default_component_content (Boolean)

    Defines whether the primarily displayed content of a role created according to the new meta role copy is component content. When nil is set, the default component content setting is copied from the source meta artifact.

Returns:



112
113
114
115
116
117
118
119
120
121
# File 'uu_os-0.29.16/lib/uu/os/meta_group.rb', line 112

def copy(source_meta_artifact_uri, meta_group = nil)
  svc = UU::OS::REST::RemoteClient.new(MetaGroup)
  svc.timeout = 120 # may take longer than default 60 seconds
  payload = UU::OS::MetaGroup::MetaGroupCopy.new(meta_group).to_json

  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('copy', source_meta_artifact_uri, payload)
    return UU::OS::UESURI.new(res)
  end
end

- (UU::OS::UESURI) create(location_uri, meta_group = nil)

Deprecated.

The uuCommand MetaGroup.create is used for creating meta group from the XML file temporarily. This feature will be removed in a future version and replaced by the specific uuCommands for creating template objects.

Creates a meta group from an exported XML file in the specified location. Source meta group must be derived (at least indirectly) from a meta group which is a part of UU.OS uuApp. Creation of meta group is divided into synchronous and asynchronous part. During the synchronous part, the meta group is created. During the asynchronous part, the template objects are created. If the asynchronous process fails and the Problem state is set on meta group, it is possible to solve the problem (e.g. add reference_map) and run the command again.

Examples:

# Get exported data from an existing meta group.
exported_data = UU::OS::MetaGroup.get_export_data('ues:TERRITORY:META_GROUP', :requested_mime_type => 'application/xml')

# Create a new meta group according to exported one without creating sheets and attachments specified in the XML. Also set different code and name.
UU::OS::MetaGroup.create('ues:TERRITORY:APP_PACKAGE', :code => 'NEW_META_GROUP', :name => 'New Meta Group', :data => exported_data.data, :import_sheets => false, :import_attachments => false)

# Create a new meta group and set new objects to the references.
UU::OS::MetaGroup.create('ues:TERRITORY:APP_PACKAGE', :data => exported_data.data, :reference_map => '[{"ues:OLD_TERRITORY:OLD_ARTIFACT1":"ues:TERRITORY:ARTIFACT1"},{"ues:OLD_TERRITORY:OLD_ARTIFACT2:OLD_OBJECT":"ues:TERRITORY:ARTIFACT2:OBJECT"}]')

Parameters:

Options Hash (meta_group):

  • :data (String, File, UU::OS::REST::BinaryValue)

    XML or zip compressed XML containing informations about meta group (e.g. exported with export)

  • :competent_role_uri (String, UU::OS::UESURI)

    UESURI of the role that will be competent for the new meta group. If nil is set, the attribute from the XML (entered in :data option) is used.

  • :name (String)

    Name of the new meta group. If nil is set, the attribute from the XML (entered in :data option) is used.

  • :code (String)

    Code of the new meta group. If nil is set, the attribute from the XML (entered in :data option) is used.

  • :description (String)

    Description of the new meta group. If nil is set, the attribute from the XML (entered in :data option) is used.

  • :security_level (String, UU::OS::Artifact::SecurityLevel)

    Security level of the new meta group. If nil is set, the attribute from the XML (entered in :data option) is used.

  • :icon_uri (String, UU::OS::UESURI)

    UESURI of the new meta group icon. If nil is set, the attribute from the XML (entered in :data option) is used. An example of icon URI: ‘ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{ART_077}’.

  • :default_name (String)

    Default name of a group that will be created according to the new meta group. If nil is set, the attribute from the XML (entered in :data option) is used.

  • :default_code (String)

    Default code of a group that will be created according to the new meta group. If nil is set, the attribute from the XML (entered in :data option) is used.

  • :default_icon_uri (String, UU::OS::UESURI)

    UESURI of the artifact icon that will be created according to the new meta group. If nil is set, the attribute from the XML (entered in :data option) is used. An example of icon URI: ‘ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{ART_077}’.

  • :default_security_level (String, UU::OS::Artifact::SecurityLevel)

    Default security level of the new meta group. If nil is set, the attribute from the XML (entered in :data option) is used.

  • :default_searchable_in_territory (Boolean)

    Flag indicating whether a role that will be created according to the new meta group is searchable in the territory.

  • :import_life_cycle_template (Boolean)

    Flag indicating whether the life cycle template will be created according to specification in the entered XML. Default value is true.

  • :import_property_templates (Boolean)

    Flag indicating whether the property templates will be created according to specification in the entered XML. Default value is true.

  • :import_sheet_templates (Boolean)

    Flag indicating whether the sheet templates will be created according to specification in the entered XML. Default value is true.

  • :import_properties (Boolean)

    Flag indicating whether the properties will be created according to specification in the entered XML. Default value is true.

  • :import_sheets (Boolean)

    Flag indicating whether the sheets will be created according to specification in the entered XML. Default value is true.

  • :import_attachments (Boolean)

    Flag indicating whether the attachments will be created according to specification in the entered XML. Default value is true.

  • :import_meta_permissions (Boolean)

    Flag indicating whether the meta permissions will be created according to specification in the entered XML. Default value is true.

  • :import_permissions (Boolean)

    Flag indicating whether the permissions will be created according to specification in the entered XML. Default value is true.

  • :import_use_cases (Boolean)

    Flag indicating whether the use cases will be created according to specification in the entered XML. Default value is true.

  • :import_masks (Boolean)

    Flag indicating whether the permission masks will be created according to specification in the entered XML. Default value is true.

  • :reference_map (String)

    JSON describing the linkage of references specified in XML to another objects (e.g. references in properties, activity related artifacts. …).

  • :component_content (Boolean)

    Defines whether the primarily displayed content of the created Meta group is component content. Default value is false.

  • :default_component_content (Boolean)

    Defines whether the primarily displayed content of a group created according to the new meta group is component content. When nil is set, the attribute from the XML (entered in :data option) is used.

Returns:



291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
# File 'uu_os-0.29.16/lib/uu/os/meta_group.rb', line 291

def create(location_uri, meta_group = nil)
  svc = UU::OS::REST::RemoteClient.new(MetaGroup)
  dto = UU::OS::MetaGroup::MetaGroupCreate.new(meta_group)
  payload = dto.to_hash
  payload.delete(:data)
  tmpfile = Tempfile.new("MetaGroupCreate")
  begin
    if (!dto.data.data.respond_to?(:read))
      tmpfile.write(dto.data.data)
      payload[:data] = tmpfile
    elsif (dto.data.data.respond_to?(:read) && !dto.data.data.respond_to?(:path))
      tmpfile.binmode
      dto.data.data.rewind
      tmpfile.write(dto.data.data.read)
      payload[:data] = tmpfile
    else
      payload[:data] = dto.data.to_hash(false)
    end
    tmpfile.flush
    tmpfile.rewind
        
    UU::OS::QoS::QoSHandler.auto_retry do
      res = svc.post('create', location_uri, payload)
      return UU::OS::UESURI.new(res)
    end
  ensure
    tmpfile.close
    tmpfile.unlink
  end
end

- (UU::OS::UESURI) export(meta_group_uri)

Exports a meta group to the XML file, which is saved to the export storage. The export is an asynchronous process.
It is possible to wait for the end of the process. More information in Process and in Future.
To get exported data from the storage use get_export_data.

Examples:

# Start exporting a meta group.
process_uri = UU::OS::MetaGroup.export('ues:TERRITORY:META_GROUP')

# Wait for the end of the process.
export_uri = UU::OS::REST::Future.new(process_uri).get(nil, 600)

# Get exported XML file.
exported_data = UU::OS::MetaGroup.get_export_data(export_uri)

Parameters:

  • meta_group_uri (String, UU::OS::UESURI)

    UESURI of the meta group to export.

Returns:



211
212
213
214
215
216
217
218
219
# File 'uu_os-0.29.16/lib/uu/os/meta_group.rb', line 211

def export(meta_group_uri)
  svc = UU::OS::REST::RemoteClient.new(MetaGroup)
  payload = UU::OS::MetaGroup::MetaGroupExport.new(nil).to_json

  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('export', meta_group_uri, payload)
    return UU::OS::UESURI.new(res)
  end
end

- (UU::OS::MetaGroup::MetaGroupAttributes) get_attributes(meta_group_uri)

Returns attributes representing the meta group specified by the meta_group_uri parameter. The command does not change the state of the meta group in the system.

Examples:

# Get attributes of a meta group
attributes = UU::OS::MetaGroup.get_attributes('ues:TERRITORY:META_GROUP')

Parameters:

  • meta_group_uri (String, UU::OS::UESURI)

    UESURI of a meta group whose attributes are returned

Returns:



36
37
38
39
40
41
42
# File 'uu_os-0.29.16/lib/uu/os/meta_group.rb', line 36

def get_attributes(meta_group_uri)
  svc = UU::OS::REST::RemoteClient.new(MetaGroup)
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.get('getAttributes', meta_group_uri)
    return MetaGroup::MetaGroupAttributes.new(res)
  end
end

- (UU::OS::REST::BinaryValue) get_export_data(meta_group_uri, meta_group = nil)

Returns a XML file generated by the export command.

Examples:

# Start exporting a meta group.
process_uri = UU::OS::MetaGroup.export('ues:TERRITORY:META_GROUP')

# Wait for the end of the process.
export_uri = UU::OS::REST::Future.new(process_uri).get(nil, 600)

# Get exported XML file.
exported_data = UU::OS::MetaGroup.get_export_data(export_uri)

Parameters:

Options Hash (meta_group):

  • :requested_mime_type (String)

    MIME type of the returned value. Possible values are ‘application/xml’ for XML and ‘application/zip’ for ZIP. ZIP is returned by default.

Returns:



238
239
240
241
242
243
244
245
246
247
# File 'uu_os-0.29.16/lib/uu/os/meta_group.rb', line 238

def get_export_data(meta_group_uri, meta_group = nil)
  svc = UU::OS::REST::RemoteClient.new(MetaGroup)
  dto = UU::OS::MetaGroup::MetaGroupGetExportData.new(meta_group)
  if dto.requested_mime_type
    svc.add_parameter('requestedMimeType', dto.requested_mime_type)
  end
  UU::OS::QoS::QoSHandler.auto_retry do
    return svc.get_binary('getExportData', meta_group_uri)
  end
end

- (UU::OS::REST::ResultList<MetaGroup::MetaGroupGetRoleInterfaceList, MetaGroup::MetaGroupGetRoleInterfaceListItem>) get_role_interface_list(meta_group_uri, criteria = nil)

Returns list of the role interfaces that are added to the specified meta group. The list of returned interfaces could be filtered by the name or code. Returned list does not contain any objects filtered out by executed UESQuery. The list is sorted by the name (and codes in case are equal) of an interface by default.

See UESQuery Documentation.

Examples:

# Get a list of all role interfaces which are connected to the specified meta group
UU::OS::MetaGroup.get_role_interface_list('ues:TERRITORY:META_GROUP')

# Get a list of role interfaces with name that starts with string John.
UU::OS::MetaGroup.get_role_interface_list('ues:TERRITORY:META_GROUP', :query => "name='John%'")

Parameters:

Options Hash (criteria):

  • :query (String)

    Query for filtering and ordering of the result list (more information in uuQuery - Guideline). It is possible to filter the result list by the name or code.

Returns:



163
164
165
166
167
168
169
170
171
172
173
# File 'uu_os-0.29.16/lib/uu/os/meta_group.rb', line 163

def get_role_interface_list(meta_group_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(MetaGroup)
  dto = MetaGroup::MetaGroupGetRoleInterfaceList.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('getRoleInterfaceList', meta_group_uri)
    return UU::OS::REST::ResultList.new(MetaGroup::MetaGroupGetRoleInterfaceList, MetaGroup::MetaGroupGetRoleInterfaceListItem, res)
  end
end

- (Object) remove_role_interface(meta_group_uri, role_interface = nil)

The command removes role interface connection from the specified meta group. Only added interfaces can be removed from meta group.

Examples:

# Remove a connected role interface from a meta group
UU::OS::MetaGroup.remove_role_interface('ues:TERRITORY:META_GROUP', :role_interface_uri => 'ues:TERRITORY:ROLE_INTERFACE')

Parameters:

Options Hash (role_interface):

  • :role_interface_uri (String, UU::OS::UESURI)

    UESURI of the role interface that to be removed from the specified meta group.



185
186
187
188
189
190
191
192
# File 'uu_os-0.29.16/lib/uu/os/meta_group.rb', line 185

def remove_role_interface(meta_group_uri, role_interface = nil)
  svc = UU::OS::REST::RemoteClient.new(MetaGroup)
  payload = UU::OS::MetaGroup::MetaGroupRemoveRoleInterface.new(role_interface).to_json

  UU::OS::QoS::QoSHandler.auto_retry do
    svc.post('removeRoleInterface', meta_group_uri, payload)
  end
end

- (UU::OS::UESURI) set_attributes(meta_group_uri, meta_group = nil)

Command for setting attributes of a meta group. The command cannot modify references to objects like location, competent role and so on.

Examples:

# Set attributes of a meta role
UU::OS::MetaGroup.set_attributes('ues:TERRITORY:META_GROUP', :name => 'New Meta Group', :code => 'NEW_META_GROUP',
  :description => 'Meta Group designated for testing purposes', :default_searchable_in_territory => true)

Parameters:

Options Hash (meta_group):

  • :name (String)

    The new name of the meta group. If nil is set, the name is not modified.

  • :code (String)

    The new code of the meta group. If nil is set, the code is not modified. The code must be unique in a given territory.

  • :description (String)

    The new description of the meta group. If nil is set, the description is not modified.

  • :security_level (String, UU::OS::Artifact::SecurityLevel)

    The new security level of the meta group. If nil is set, the security level is not modified.

  • :icon_uri (String, UU::OS::UESURI)

    UESURI of the new meta group’s icon. If nil is set, the icon is not modified. If nil UESURI (“ues:[-1]:[-1]:”) is set, the meta group icon is removed and the meta group uses icon from it’s source meta artifact. An example of icon URI: ‘ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{ART_077}’.

  • :default_name (String)

    Specifies new default name of the created role according to meta group. If nil is set, the default name is not modified.

  • :default_code (String)

    Specifies new default code of the created role according to meta group. If nil is set, the default code is not modified.

  • :default_security_level (String, UU::OS::Artifact::SecurityLevel)

    Specifies new default security level of the created role according to meta group. If nil is set, the default security is not modified.

  • :default_icon_uri (String, UU::OS::UESURI)

    Specifies new default icon of the created role according to meta group (specified in meta_group_uri). If nil is set, the default icon is not modified. An example of icon URI: ‘ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{ART_077}’.

  • :default_searchable_in_territory (Boolean)

    Specifies if it is possible to search for the role created according to the meta group in its territory. If nil is set, the attribute is not modified.

  • :component_content (Boolean)

    Defines whether the primarily displayed content of the created Meta group is component content. Default value is false.

  • :default_component_content (Boolean)

    Defines whether the primarily displayed content of a group created according to the meta group (specified in source_meta_artifact_uri) is component content. When nil is set, the default component content setting is not modified.

Returns:



68
69
70
71
72
73
74
75
76
# File 'uu_os-0.29.16/lib/uu/os/meta_group.rb', line 68

def set_attributes(meta_group_uri, meta_group = nil)
  svc = UU::OS::REST::RemoteClient.new(MetaGroup)
  payload = UU::OS::MetaGroup::MetaGroupSetAttributes.new(meta_group).to_json

  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('setAttributes', meta_group_uri, payload)
    return UU::OS::UESURI.new(res)
  end
end