Module: UU::OS::MetaAccessRole

Extended by:
MetaAccessRole
Included in:
MetaAccessRole
Defined in:
uu_os_client-0.10.6/lib/uu/os/meta_access_role.rb,
uu_os_client-0.10.6/lib/uu/os/meta_access_role/meta_access_role_copy.rb,
uu_os_client-0.10.6/lib/uu/os/meta_access_role/meta_access_role_create.rb,
uu_os_client-0.10.6/lib/uu/os/meta_access_role/meta_access_role_export.rb,
uu_os_client-0.10.6/lib/uu/os/meta_access_role/meta_access_role_attributes.rb,
uu_os_client-0.10.6/lib/uu/os/meta_access_role/meta_access_role_set_attributes.rb,
uu_os_client-0.10.6/lib/uu/os/meta_access_role/meta_access_role_get_export_data.rb,
uu_os_client-0.10.6/lib/uu/os/meta_access_role/meta_access_role_add_role_interface.rb,
uu_os_client-0.10.6/lib/uu/os/meta_access_role/meta_access_role_remove_role_interface.rb,
uu_os_client-0.10.6/lib/uu/os/meta_access_role/meta_access_role_get_role_interface_list.rb,
uu_os_client-0.10.6/lib/uu/os/meta_access_role/meta_access_role_get_role_interface_list_item.rb

Overview

Module Meta Access Role.

Defined Under Namespace

Classes: MetaAccessRoleAddRoleInterface, MetaAccessRoleAttributes, MetaAccessRoleCopy, MetaAccessRoleCreate, MetaAccessRoleExport, MetaAccessRoleGetExportData, MetaAccessRoleGetRoleInterfaceList, MetaAccessRoleGetRoleInterfaceListItem, MetaAccessRoleRemoveRoleInterface, MetaAccessRoleSetAttributes

Constant Summary

PATH =

Service path

'ues/core/role/UESMetaAccessRole'

Instance Method Summary (collapse)

Instance Method Details

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

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

Examples:

# Connect another role interface to a meta access role
UU::OS::MetaAccessRole.add_role_interface('ues:TERRITORY:META_ACCESS_ROLE', :role_interface_uri => 'ues:TERRITORY:ROLE_INTERFACE')

Parameters:

Options Hash (role_interface):

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

    UES URI of the role interface that is to be connected to the specified meta access role.



132
133
134
135
136
137
138
139
# File 'uu_os_client-0.10.6/lib/uu/os/meta_access_role.rb', line 132

def add_role_interface(meta_access_role_uri, role_interface = nil)
  svc = UU::OS::REST::RemoteClient.new(MetaAccessRole)
  payload = UU::OS::MetaAccessRole::MetaAccessRoleAddRoleInterface.new(role_interface).to_json

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

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

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

Examples:

# Copy a meta access role (including its sheets); change a few attributes
UU::OS::MetaAccessRole.copy('ues:TERRITORY:META_ACCESS_ROLE', :location_uri => 'ues:TERRITORY:APP_PACKAGE', :code => 'META_ACCESS_ROLE_COPY',
  :iconUri => '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_access_role):

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

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

  • :name (String)

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

  • :code (String)

    Code of the new meta access role copy.

  • :description (String)

    Description of the new meta access role copy.

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

    UESURI of the competent role.

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

    Security level.

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

    URI of the new meta access role’s icon.

  • :copy_sheets (Boolean)

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

  • :copy_lifecycle (Boolean)

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

  • :copy_attachments (Boolean)

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

  • :copy_sheet_templates (Boolean)

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

  • :default_name (String)

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

  • :default_code (String)

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

  • :default_artifact_type (UU::OS::Artifact::ArtifactType)

    Specifies default artifact type of the created artifact according to new meta access role copy.

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

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

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

    Specifies default icon of the created role according to new meta access role copy.

  • :default_searchable_in_territory (String)

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

Returns:



109
110
111
112
113
114
115
116
117
118
# File 'uu_os_client-0.10.6/lib/uu/os/meta_access_role.rb', line 109

def copy(source_meta_artifact_uri, meta_access_role = nil)
  svc = UU::OS::REST::RemoteClient.new(MetaAccessRole)
  svc.timeout = 120 # may take longer than default 60 seconds
  payload = UU::OS::MetaAccessRole::MetaAccessRoleCopy.new(meta_access_role).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_access_role = nil)

Deprecated.

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

The uuCommand creates a meta access role from an exported XML file in the specified location. Source meta access role must be derived (at least indirectly) from a meta artifact which is a part of UU.OS uuApp.

Examples:

# Get exported data from an existing meta access role.
exported_data = UU::OS::MetaAccessRole.get_export_data('ues:TERRITORY:META_ACCESS_ROLE', :requested_mime_type=>'application/xml')

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

# Create a new meta access role and set new objects to the references.
UU::OS::MetaAccessRole.create('ues:TERRITORY:APP_PACKAGE', :reference_map => '{"ues:TERRITORY:OLD_ARTIFACT1":"ues:TERRITORY:ARTIFACT1","ues:TERRITORY:OLD_ARTIFACT2:OLD_OBJECT":"ues:TERRITORY:ARTIFACT2:OBJECT"}')

Parameters:

Options Hash (meta_access_role):

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

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

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

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

  • :name (String)

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

  • :code (String)

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

  • :description (String)

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

  • :security_level (String)

    Security level of the new meta access role. When nil is set, the attribute from the XML (entered in :data option) is used. All possible security levels may be found as constants in Artifact::SecurityLevel class.

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

    UESURI of the new meta access role icon. When nil is set, the attribute from the XML (entered in :data option) is used.

  • :default_name (String)

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

  • :default_code (String)

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

  • :default_artifact_type (String)

    Default artifact type of the new meta access role. When nil is set, the attribute from the XML (entered in :data option) is used. All possible artifact types may be found as constants in Artifact::ArtifactType class.

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

    UESURI of the access role icon that will be created according to the new meta access role. When nil is set, the attribute from the XML (entered in :data option) is used.

  • :default_security_level (String)

    Default security level of the new meta access role. When nil is set, the attribute from the XML (entered in :data option) is used. All possible security levels may be found as constants in Artifact::SecurityLevel class.

  • :default_searchable_in_territory (Boolean)

    Flag indicating whether a role that will be created according to the new meta access role is searcheable 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. …).

Returns:



288
289
290
291
292
293
294
295
296
# File 'uu_os_client-0.10.6/lib/uu/os/meta_access_role.rb', line 288

def create(location_uri, meta_access_role = nil)
  svc = UU::OS::REST::RemoteClient.new(MetaAccessRole)
  payload = UU::OS::MetaAccessRole::MetaAccessRoleCreate.new(meta_access_role).to_json

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

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

The uuCommand exports a meta access role 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 Env::Process and in REST::Future.
To get exported data from the storage use #get_export_data.

Examples:

# Start exporting a meta access role.
process_uri = UU::OS::MetaAccessRole.export('ues:TERRITORY:META_ACCESS_ROLE')

# 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::MetaAccessRole.get_export_data(export_uri)

Parameters:

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

    UESURI of the meta access role to export.

Returns:



208
209
210
211
212
213
214
215
216
# File 'uu_os_client-0.10.6/lib/uu/os/meta_access_role.rb', line 208

def export(meta_access_role_uri)
  svc = UU::OS::REST::RemoteClient.new(MetaAccessRole)
  payload = UU::OS::MetaAccessRole::MetaAccessRoleExport.new(nil).to_json

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

- (UU::OS::MetaAccessRole::MetaAccessRoleAttributes) get_attributes(meta_access_role_uri)

This command returns attributes representing the meta access role specified by the metaRoleUri parameter. The command does not change the state of the meta access role in the system.

Examples:

# Get attributes of a meta access role
UU::OS::MetaAccessRole.get_attributes('ues:TERRITORY:META_ACCESS_ROLE')

Parameters:

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

    UESURI of a meta access role whose attributes are returned

Returns:



35
36
37
38
39
40
41
# File 'uu_os_client-0.10.6/lib/uu/os/meta_access_role.rb', line 35

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

- (UU::OS::UESURI) get_export_data(meta_access_role_uri, meta_access_role = nil)

The uuCommand returns a XML file generated by the export command.

Examples:

# Start exporting a meta access role.
process_uri = UU::OS::MetaAccessRole.export('ues:TERRITORY:META_ACCESS_ROLE')

# 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::MetaAccessRole.get_export_data(export_uri)

Parameters:

Options Hash (meta_access_role):

  • :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:

  • (UU::OS::UESURI)

    Data file of an exported meta artifact (XML or ZIP containing XML).



235
236
237
238
239
240
241
242
243
244
245
# File 'uu_os_client-0.10.6/lib/uu/os/meta_access_role.rb', line 235

def get_export_data(meta_access_role_uri, meta_access_role = nil)
  svc = UU::OS::REST::RemoteClient.new(MetaAccessRole)
  dto = UU::OS::MetaAccessRole::MetaAccessRoleGetExportData.new(meta_access_role)
  if dto.requested_mime_type
    svc.add_parameter('requestedMimeType', dto.requested_mime_type)
  end
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.get('getExportData', meta_access_role_uri)
    return UU::OS::REST::BinaryValue.new(res, true)
  end
end

- (UU::OS::REST::ResultList<MetaAccessRole::MetaAccessRoleGetRoleInterfaceList, MetaAccessRole::MetaAccessRoleGetRoleInterfaceListItem>) get_role_interface_list(meta_access_role_uri, criteria = nil)

Returns list of the role interfaces that are added to the specified meta access role. 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 access role
UU::OS::MetaAccessRole.get_role_interface_list('ues:TERRITORY:META_ACCESS_ROLE')

# Get a list of role interfaces with name that starts with string John.
UU::OS::MetaAccessRole.get_role_interface_list('ues:TERRITORY:META_ACCESS_ROLE', :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:



160
161
162
163
164
165
166
167
168
169
170
# File 'uu_os_client-0.10.6/lib/uu/os/meta_access_role.rb', line 160

def get_role_interface_list(meta_access_role_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(MetaAccessRole)
  dto = MetaAccessRole::MetaAccessRoleGetRoleInterfaceList.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_access_role_uri)
    return UU::OS::REST::ResultList.new(MetaAccessRole::MetaAccessRoleGetRoleInterfaceList, MetaAccessRole::MetaAccessRoleGetRoleInterfaceListItem, res)
  end
end

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

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

Examples:

# Remove a connected role interface from a meta access role
UU::OS::MetaAccessRole.remove_role_interface('ues:TERRITORY:META_ACCESS_ROLE', :role_interface_uri => 'ues:TERRITORY:ROLE_INTERFACE')

Parameters:

Options Hash (role_interface):

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

    UES URI of the role interface that to be removed from the specified meta access role.



182
183
184
185
186
187
188
189
# File 'uu_os_client-0.10.6/lib/uu/os/meta_access_role.rb', line 182

def remove_role_interface(meta_access_role_uri, role_interface = nil)
  svc = UU::OS::REST::RemoteClient.new(MetaAccessRole)
  payload = UU::OS::MetaAccessRole::MetaAccessRoleRemoveRoleInterface.new(role_interface).to_json

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

- (UU::OS::UESURI) set_attributes(meta_access_role_uri, meta_access_role = nil)

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

Examples:

# Set attributes of a meta access role
UU::OS::MetaAccessRole.set_attributes('ues:TERRITORY:META_ACCESS_ROLE', :name => 'New Meta Access Role', :code => 'NEW_META_ACCESS_ROLE',
  :description => 'Meta Access Role designated for testing purposes', :artifact_type=> UU::OS::Artifact::ArtifactType::META, :default_searchable_in_territory => true)

Parameters:

Options Hash (meta_access_role):

  • :name (String)

    The new name of the meta access role. When nil is set, the name is not modified.

  • :code (String)

    The new code of the meta access role. When 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 access role. When nil is set, the description is not modified.

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

    The new security level of the meta access role. When nil is set, the security level is not modified.

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

    UESURI of the new meta access role’s icon. When nil is set, the icon is not modified. When NULL_URI value is set, the meta access role icon is removed and the meta access role uses icon from it’s source meta artifact.

  • :default_name (String)

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

  • :default_code (String)

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

  • :default_artifact_type (UU::OS::Artifact::ArtifactType)

    Specifies new default artifact type of the created role according to meta access role. When nil is set, the default artifact type is not modified.

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

    Specifies new default security level of the created role according to meta access role. When 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 access role (specified in metaRoleUri). When nil is set, the default icon is not modified.

  • :default_searchable_in_territory (Boolean)

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

Returns:



66
67
68
69
70
71
72
73
74
# File 'uu_os_client-0.10.6/lib/uu/os/meta_access_role.rb', line 66

def set_attributes(meta_access_role_uri, meta_access_role = nil)
  svc = UU::OS::REST::RemoteClient.new(MetaAccessRole)
  payload = UU::OS::MetaAccessRole::MetaAccessRoleSetAttributes.new(meta_access_role).to_json

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