Module: UU::OS::RoleInterface

Extended by:
RoleInterface
Included in:
RoleInterface
Defined in:
uu_os-0.29.16/lib/uu/os/role_interface.rb,
uu_os-0.29.16/lib/uu/os/role_interface/role_interface_export.rb,
uu_os-0.29.16/lib/uu/os/role_interface/role_interface_create.rb,
uu_os-0.29.16/lib/uu/os/role_interface/role_interface_attributes.rb,
uu_os-0.29.16/lib/uu/os/role_interface/role_interface_get_role_list.rb,
uu_os-0.29.16/lib/uu/os/role_interface/role_interface_set_attributes.rb,
uu_os-0.29.16/lib/uu/os/role_interface/role_interface_get_export_data.rb,
uu_os-0.29.16/lib/uu/os/role_interface/role_interface_add_meta_artifact.rb,
uu_os-0.29.16/lib/uu/os/role_interface/role_interface_get_role_list_item.rb,
uu_os-0.29.16/lib/uu/os/role_interface/role_interface_remove_meta_artifact.rb,
uu_os-0.29.16/lib/uu/os/role_interface/role_interface_get_meta_artifact_list.rb,
uu_os-0.29.16/lib/uu/os/role_interface/role_interface_get_meta_artifact_list_item.rb

Overview

Module Role Interface.

Defined Under Namespace

Classes: RoleInterfaceAddMetaArtifact, RoleInterfaceAttributes, RoleInterfaceCreate, RoleInterfaceExport, RoleInterfaceGetExportData, RoleInterfaceGetMetaArtifactList, RoleInterfaceGetMetaArtifactListItem, RoleInterfaceGetRoleList, RoleInterfaceGetRoleListItem, RoleInterfaceRemoveMetaArtifact, RoleInterfaceSetAttributes

Constant Summary

PATH =

Service path

'ues/core/role/UESRoleInterface'

Instance Method Summary (collapse)

Instance Method Details

- (Object) add_meta_artifact(role_interface_uri, role_interface = nil)

Creates new meta artifact connection to the specified role interface.

Examples:

# Connect a meta artifact to a role interface
UU::OS::RoleInterface.add_meta_artifact('ues:TERRITORY:ROLE_INTERFACE',
      :meta_artifact_uri => 'ues:TERRITORY:META_ARTIFACT'
)

Parameters:

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

    UESURI of the role interface where the meta artifacts will be connected

  • role_interface (RoleInterfaceAddMetaArtifact) (defaults to: nil)

    Object containing meta artifact that is to be connected

Options Hash (role_interface):

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

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



141
142
143
144
145
146
147
148
# File 'uu_os-0.29.16/lib/uu/os/role_interface.rb', line 141

def add_meta_artifact(role_interface_uri, role_interface = nil)
  svc = UU::OS::REST::RemoteClient.new(RoleInterface)
  payload = UU::OS::RoleInterface::RoleInterfaceAddMetaArtifact.new(role_interface).to_json

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

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

Creates a new role interface. The command creates a new role interface in a specified meta model dictionary. At the very least meta artifact, name and code must be specified in RoleInterfaceCreate Object. Competent role for the new group will be selected as the most suitable according to specified container and meta artifact (executive/authorized role with connected interface), or can be also specified in RoleInterfaceCreate Object.

Examples:

# Create a new role interface.
UU::OS::RoleInterface.create('ues:TERRITORY:ROLE_INTERFACE', :code => 'NEW_ROLE_INTERFACE', :name => 'New Role Interface')

Parameters:

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

    UESURI of the meta model dictionary where the role interface will be created.

  • role_interface (RoleInterfaceCreate) (defaults to: nil)

    Object containing attributes of the new role interface.

Options Hash (role_interface):

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

    UESURI of the meta artifact. Only a meta artifact with the template class of role interface can be used. If the rights does not permit to create a new role interface from the meta artifact in the specified location, the create command fails.

  • :name (String)

    Name of the new role interface. If nil is set, template name from meta artifact is used if set, otherwise the create command fails.

  • :code (String)

    Code of the new role interface. If nil is set, the code is generated automatically using the system sequence. The code must be unique in the given territory, otherwise the create command fails.

  • :description (String)

    Description of the new role interface. If nil is set, from meta artifact is used if set, otherwise no description is set on the new role interface.

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

    UESURI of the competent role. If nil is set, the executive role from authorization is used. If no role is authorized to create the new role interface into specified container, the create command fails. If the selected role doesn’t have connected the role interface with the selected meta artifact, the create command fails.

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

    Security level. If nil is set, security level is taken from the meta artifact template security level. If the meta artifact template security level is higher than the user’s security clearance, the create command fails.

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

    URI of the role interface’s icon. If nil is set, the meta model uses icon from meta artifact. An example of icon URI: ‘ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{ART_077}’.

  • :component_content (Boolean)

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

Returns:



50
51
52
53
54
55
56
57
58
# File 'uu_os-0.29.16/lib/uu/os/role_interface.rb', line 50

def create(location_uri, role_interface = nil)
  svc = UU::OS::REST::RemoteClient.new(RoleInterface)
  payload = UU::OS::RoleInterface::RoleInterfaceCreate.new(role_interface).to_json

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

- (Object) delete(role_interface_uri)

Deletes the specified role interface from the system. The role interface is deleted even if it contains a locked sheet or attachment. The role interface cannot be deleted if: the role interface's workflow is not created, a property contains a reference to this role interface, a time sheet exists with a reference to this role interface.

Examples:

# Delete a role interface
UU::OS::RoleInterface.delete('ues:TERRITORY:ROLE_INTERFACE')

Parameters:

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

    UESURI of the role interface which is about to be deleted.



123
124
125
126
127
128
# File 'uu_os-0.29.16/lib/uu/os/role_interface.rb', line 123

def delete(role_interface_uri)
  svc = UU::OS::REST::RemoteClient.new(RoleInterface)
  UU::OS::QoS::QoSHandler.auto_retry do
    svc.post('delete', role_interface_uri)
  end
end

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

Exports a role interface 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.

Examples:

# Start exporting a role interface.
process_uri = UU::OS::RoleInterface.export('ues:TERRITORY:ROLE_INTERFACE')

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

Parameters:

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

    UESURI of the role interface to export.

Returns:



218
219
220
221
222
223
224
225
226
# File 'uu_os-0.29.16/lib/uu/os/role_interface.rb', line 218

def export(role_interface_uri)
  svc = UU::OS::REST::RemoteClient.new(RoleInterface)
  payload = UU::OS::RoleInterface::RoleInterfaceExport.new(nil).to_json

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

- (RoleInterfaceAttributes) get_attributes(role_interface_uri)

Returns attributes representing the role interface specified by the role_interface_uri parameter. The command does not change the state of the role interface in the system.

Examples:

# Get attributes of a role interface
UU::OS::RoleInterface.get_attributes('ues:TERRITORY:ROLE_INTERFACE')

Parameters:

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

    UESURI of a role interface whose attributes are returned

Returns:



71
72
73
74
75
76
77
# File 'uu_os-0.29.16/lib/uu/os/role_interface.rb', line 71

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

- (UU::OS::REST::BinaryValue) get_export_data(role_interface_uri, role_interface = nil)

Returns a XML file generated by the export command.

Examples:

# Start exporting a role interface
process_uri = UU::OS::RoleInterface.export('ues:TERRITORY:ROLE_INTERFACE')

# 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::RoleInterface.get_export_data(export_uri, :requested_mime_type => 'application/xml')

Parameters:

Options Hash (role_interface):

Returns:



245
246
247
248
249
250
251
252
253
254
# File 'uu_os-0.29.16/lib/uu/os/role_interface.rb', line 245

def get_export_data(role_interface_uri, role_interface = nil)
  svc = UU::OS::REST::RemoteClient.new(RoleInterface)
  dto = UU::OS::RoleInterface::RoleInterfaceGetExportData.new(role_interface)
  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', role_interface_uri)
  end
end

- (UU::OS::REST::ResultList<RoleInterface::RoleInterfaceGetMetaArtifactList, RoleInterface::RoleInterfaceGetMetaArtifactListItem>) get_meta_artifact_list(role_interface_uri, criteria = nil)

Returns list of the meta artifacts that are connected to the specified role interface. Returned list does not contain any objects filtered out by executed UESQuery. The list of returned meta artifacts could be filtered by the name or code. The list is sorted by the name (and codes in case are equal). See the UES query documentation for more information.

Examples:

# List all connected meta artifacts
UU::OS::RoleInterface.get_meta_artifact_list('ues:TERRITORY:ROLE_INTERFACE')

# List connected meta artifacts whose codes start with "META" prefix
UU::OS::RoleInterface.get_meta_artifact_list('ues:TERRITORY:ROLE_INTERFACE',
      :query => 'code="META%"'
)

Parameters:

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

    UESURI of the role interface for which the connected meta artifacts are to be listed

  • criteria (RoleInterfaceGetMetaArtifactList) (defaults to: nil)

    Object containing criteria for listing connected meta artifacts. Available parameters are: name and code

Options Hash (criteria):

  • :query (String)

    The UES query string. It has to conform the UESQuery syntax (see documentation for more info). Filtering and order of the result list can be specified there. If nil is set, no filtering is applied and entries are ordered by name of casted subjects (and code as the second criteria).

Returns:

See Also:



193
194
195
196
197
198
199
200
201
202
203
# File 'uu_os-0.29.16/lib/uu/os/role_interface.rb', line 193

def get_meta_artifact_list(role_interface_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(RoleInterface)
  dto = RoleInterface::RoleInterfaceGetMetaArtifactList.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('getMetaArtifactList', role_interface_uri)
    return UU::OS::REST::ResultList.new(RoleInterface::RoleInterfaceGetMetaArtifactList, RoleInterface::RoleInterfaceGetMetaArtifactListItem, res)
  end
end

- (UU::OS::REST::ResultList<RoleInterface::RoleInterfaceGetRoleList, RoleInterface::RoleInterfaceGetRoleListItem>) get_role_list(role_interface_uri, criteria = nil)

Returns list of roles, which the specified role interface is connected to.

Examples:

# Retrieve all roles, which an interface is connected to
roles = UU::OS::RoleInterface.get_role_list('ues:TERRITORY:ROLE_INTERFACE')

Parameters:

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

    URI of the role interface to retrieve the roles it is connected to.

  • criteria (RoleInterfaceGetRoleList) (defaults to: nil)

    Object containing paging criteria.

Returns:



266
267
268
269
270
271
272
273
274
275
276
# File 'uu_os-0.29.16/lib/uu/os/role_interface.rb', line 266

def get_role_list(role_interface_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(RoleInterface)
  dto = RoleInterfaceGetRoleList.new(criteria)
  svc.add_parameter('pageIndex', dto.page_index)
  svc.add_parameter('pageSize', dto.page_size)

  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.get('getRoleList', role_interface_uri)
    return UU::OS::REST::ResultList.new(RoleInterface::RoleInterfaceGetRoleList, RoleInterface::RoleInterfaceGetRoleListItem, res)
  end
end

- (Object) remove_meta_artifact(role_interface_uri, role_interface = nil)

Removes meta artifact connection from the specified role interface. Only connected meta artifacts can be disconnected from the role interface.

Examples:

# Disconnect a meta artifact from a role interface
UU::OS::RoleInterface.remove_meta_artifact('ues:TERRITORY:ROLE_INTERFACE',
      :meta_artifact_uri => 'ues:TERRITORY:META_ARTIFACT'
)

Parameters:

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

    UESURI of the role interface where the meta artifacts will be disconnected.

  • role_interface (RoleInterfaceRemoveMetaArtifact) (defaults to: nil)

    Object containing meta artifact that to be disconnected

Options Hash (role_interface):

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

    UESURI of the meta artifact that is to be disconnected from the specified role interface. If the meta artifact is not connected, the disconnect command fails.



162
163
164
165
166
167
168
169
# File 'uu_os-0.29.16/lib/uu/os/role_interface.rb', line 162

def remove_meta_artifact(role_interface_uri, role_interface = nil)
  svc = UU::OS::REST::RemoteClient.new(RoleInterface)
  payload = UU::OS::RoleInterface::RoleInterfaceRemoveMetaArtifact.new(role_interface).to_json

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

- (UU::OS::UESURI) set_attributes(role_interface_uri, role_interface = nil)

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

Examples:

# Change most of attributes of a role interface
UU::OS::RoleInterface.set_attributes('ues:TERRITORY:ROLE_INTERFACE',
      :name => 'New Role Interface Name',
      :code => 'NEW_ROLE_INTERFACE_CODE',
      :description => 'Some sample description',
      :security_level => UU::OS::Artifact::SecurityLevel::INTERNAL_USE
)

Parameters:

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

    UESURI of the role interface whose attributes are to be changed

  • role_interface (RoleInterfaceSetAttributes) (defaults to: nil)

    Object containing new attributes the role interface

Options Hash (role_interface):

  • :name (String)

    The new name of the role interface. If nil is set, the name is not modified.

  • :code (String)

    The new code of the role interface. If nil is set, the code is not modified. The code must be unique in a given territory, otherwise the set_attributes command fails.

  • :description (String)

    The new description of the role interface. If nil is set, the description is not modified.

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

    The new security level of the role interface. If nil is set, the security level is not modified. If the role interface security level is higher than the user’s security clearance, the set_attributes command fails.

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

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

  • :component_content (Boolean)

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

Returns:



101
102
103
104
105
106
107
108
109
# File 'uu_os-0.29.16/lib/uu/os/role_interface.rb', line 101

def set_attributes(role_interface_uri, role_interface = nil)
  svc = UU::OS::REST::RemoteClient.new(RoleInterface)
  payload = UU::OS::RoleInterface::RoleInterfaceSetAttributes.new(role_interface).to_json

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