Module: UU::OS::Group

Extended by:
Group
Included in:
Group
Defined in:
uu_os-0.29.16/lib/uu/os/group/group_create.rb,
uu_os-0.29.16/lib/uu/os/group.rb,
uu_os-0.29.16/lib/uu/os/group/group_attributes.rb,
uu_os-0.29.16/lib/uu/os/group/group_set_attributes.rb,
uu_os-0.29.16/lib/uu/os/group/group_cancel_activities.rb,
uu_os-0.29.16/lib/uu/os/group/group_add_role_interface.rb,
uu_os-0.29.16/lib/uu/os/group/group_propagate_activities.rb,
uu_os-0.29.16/lib/uu/os/group/group_remove_role_interface.rb,
uu_os-0.29.16/lib/uu/os/group/group_get_role_interface_list.rb,
uu_os-0.29.16/lib/uu/os/group/group_get_role_interface_list_item.rb

Overview

Module Group.

Defined Under Namespace

Classes: GroupAddRoleInterface, GroupAttributes, GroupCancelActivities, GroupCreate, GroupGetRoleInterfaceList, GroupGetRoleInterfaceListItem, GroupPropagateActivities, GroupRemoveRoleInterface, GroupSetAttributes

Constant Summary

PATH =

Service path

'ues/core/role/UESGroup'

Instance Method Summary (collapse)

Instance Method Details

- (Object) add_role_interface(group_role_uri, group = nil)

Creates new role interface connection to the specified role. The role interface has to be in an active state and must not be already connected. The role interface has to be connected to the one of the authorized roles for this command, or the authorized role has to be casted to the default group of meta model where the role interface is located.

Examples:

# Add a role interface
UU::OS::Group.add_role_interface('ues:TERRITORY:GROUP',
      :role_interface_uri => 'ues:TERRITORY:ROLE_INTERFACE'
)

Parameters:

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

    UESURI of the group role where the role interface will be connected

  • group (GroupAddRoleInterface) (defaults to: nil)

    DTO containing role interface that to be connected

Options Hash (group):

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

    UESURI of the role interface that is to be connected to the specified group role. If nil is set, the command fails.



197
198
199
200
201
202
203
204
# File 'uu_os-0.29.16/lib/uu/os/group.rb', line 197

def add_role_interface(group_role_uri, group = nil)
  svc = UU::OS::REST::RemoteClient.new(Group)
  payload = UU::OS::Group::GroupAddRoleInterface.new(group).to_json

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

- (Object) cancel_activities(group_role_uri, group = nil)

Cancels activities which exist due to group roles for the specified roles.

Examples:

# Cancel activities of selected roles casted to GROUP
UU::OS::Group.cancel_activities('ues:TERRITORY:GROUP',
      :casted_roles_uris => ['ues:CMD-BT:ROLE1', 'ues:CMD-BT:ROLE2']
)

Parameters:

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

    UESURI of the group role with activities

  • group (GroupCancelActivities) (defaults to: nil)

    DTO containing attributes to cancel activities for casted roles

Options Hash (group):

  • :casted_roles_uris (Array)

    The casted roles to that the group role’s activities will be propagated. Cannot be nil or empty.



173
174
175
176
177
178
179
180
# File 'uu_os-0.29.16/lib/uu/os/group.rb', line 173

def cancel_activities(group_role_uri, group = nil)
  svc = UU::OS::REST::RemoteClient.new(Group)
  payload = UU::OS::Group::GroupCancelActivities.new(group).to_json

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

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

Creates a new group role. The command creates a new group in a specified location. At the very least meta artifact must be specified in GroupCreate DTO. 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 GroupCreate DTO.

Examples:

# Create a new group.
UU::OS::Group.create('ues:TERRITORY:FOLDER', :meta_artifact_uri => 'ues:TERRITORY:META_ARTIFACT', :code => 'NEW_GROUP', :name => 'New Group')

# Verifying that a new group can be created.
UU::OS::Group.create('ues:TERRITORY:FOLDER', :meta_artifact_uri => 'ues:TERRITORY:META_ARTIFACT',:code => 'NEW_GROUP', :name => 'New Group', :dry_run => true)

Parameters:

Options Hash (group):

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

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

  • :name (String)

    Name of the new group. If nil is set, tName from meta artifact is used if set, otherwise the create command fails.

  • :code (String)

    Code of the new group. 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 group. If nil is set, tDescription from meta artifact is used if set, otherwise no description is set on the new group.

  • :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 group 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. If the selected role doesn’t belong to the same organizational unit as the new group role or if it doesn’t belong to one of superior organizational units, 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 tSecurityLevel. If the meta artifact tSecurityLevel is higher than the user’s security clearance, the create command fails.

  • :searchable_in_territory (Boolean)

    Specifies if it is possible to search the new group in its territory. If nil is set, tSearchableInTerritory from meta artifact is used if set, otherwise the create command fails.

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

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

  • :grant_all_from_organizational_unit (Boolean)

    Deprecated. Specifies if the group will be included among All roles from organizational unit. If true or nil is set, the role will be included, otherwise it will not be included among All roles from organizational unit.

  • :dry_run (Boolean)

    Specifies whether this is only a test run to verify that the object can be created. The default value is false.

  • :component_content (Boolean)

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

Returns:



53
54
55
56
57
58
59
60
61
62
63
64
# File 'uu_os-0.29.16/lib/uu/os/group.rb', line 53

def create(location_uri, group = nil)
  svc = UU::OS::REST::RemoteClient.new(Group)
  payload = UU::OS::Group::GroupCreate.new(group).to_json

  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('create', location_uri, payload)
    # res is nil if dry_run was set to true. In that case, return nil (do nothing)
    if !(res.nil? || res.empty?)
      return UU::OS::UESURI.new(res)
    end
  end
end

- (Object) delete(group_uri)

Deletes the specified group role from the system. The group is deleted even if it contains a locked sheet or attachment. The group cannot be deleted if: the group is not in an active cast, the group's workflow is not created, a property contains a reference to this group, a time sheet exists with a reference to this group, an activity exists with this role as competent role.

Examples:

# Delete group specified by UESURI.
UU::OS::Group.delete('ues:TERRITORY:GROUP')

Parameters:

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

    UESURI of the group which is about to be deleted.



133
134
135
136
137
138
# File 'uu_os-0.29.16/lib/uu/os/group.rb', line 133

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

- (GroupAttributes) get_attributes(group_uri)

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

Examples:

# Get group attributes
UU::OS::Group.get_attributes('ues:TERRITORY:GROUP')

Parameters:

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

    UESURI of a group whose attributes are returned

Returns:



77
78
79
80
81
82
83
# File 'uu_os-0.29.16/lib/uu/os/group.rb', line 77

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

- (UU::OS::REST::ResultList<Group::GroupGetRoleInterfaceList, Group::GroupGetRoleInterfaceListItem>) get_role_interface_list(group_role_uri, criteria = nil)

Returns list of the role interfaces that are connected to the specified group 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 by code in case are equal) of an interface by default.

Examples:

# List all role interfaces
UU::OS::Group.get_role_interface_list('ues:TERRITORY:GROUP')

# List role interfaces whose codes start with "IFC" prefix
UU::OS::Group.get_role_interface_list('ues:TERRITORY:GROUP',
      :query => 'code="IFC%"'
)

Parameters:

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

    UESURI of the access role for which the connected role interfaces are to be listed

  • criteria (GroupGetRoleInterfaceList) (defaults to: nil)

    DTO containing criteria for listing access role interfaces. 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:



248
249
250
251
252
253
254
255
256
257
258
# File 'uu_os-0.29.16/lib/uu/os/group.rb', line 248

def get_role_interface_list(group_role_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(Group)
  dto = Group::GroupGetRoleInterfaceList.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', group_role_uri)
    return UU::OS::REST::ResultList.new(Group::GroupGetRoleInterfaceList, Group::GroupGetRoleInterfaceListItem, res)
  end
end

- (Object) propagate_activities(group_uri, group = nil)

Propagates activities of the group to its casted roles or casted groups. Only the active activities are propagated, it means that they have a state and the state must not be final.

Examples:

# Propagate activities to selected roles casted to GROUP
UU::OS::Group.propagate_activities('ues:TERRITORY:GROUP',
      :casted_roles_uris => ['ues:CMD-BT:ROLE1', 'ues:CMD-BT:ROLE2']
)

Parameters:

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

    UESURI of the group whose activities will be propagated

  • group (GroupPropagateActivities) (defaults to: nil)

    UESURIs of the roles which must be casted into group with group_uri and into which the activities will be propagated.

Options Hash (group):

  • :casted_roles_uris (Array)

    The casted roles to that the group role’s activities will be propagated. Cannot be nil or empty.



153
154
155
156
157
158
159
160
# File 'uu_os-0.29.16/lib/uu/os/group.rb', line 153

def propagate_activities(group_uri, group = nil)
  svc = UU::OS::REST::RemoteClient.new(Group)
  payload = UU::OS::Group::GroupPropagateActivities.new(group).to_json

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

- (Object) remove_role_interface(group_role_uri, group = nil)

Removes role interface connection from the specified group role. Only connected interfaces can be disconnected from the group role.

Examples:

# Remove a role interface
UU::OS::Group.remove_role_interface('ues:TERRITORY:GROUP',
      :role_interface_uri => 'ues:TERRITORY:ROLE_INTERFACE'
)

Parameters:

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

    UESURI of the group role where the role interface will be disconnected

  • group (GroupRemoveRoleInterface) (defaults to: nil)

    DTO containing role interface that is to be disconnected

Options Hash (group):

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

    UESURI of the role interface that is to be disconnected from the specified group role. If nil is set, the command fails.



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

def remove_role_interface(group_role_uri, group = nil)
  svc = UU::OS::REST::RemoteClient.new(Group)
  payload = UU::OS::Group::GroupRemoveRoleInterface.new(group).to_json

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

- (UU::OS::UESURI) set_attributes(group_uri, group = nil)

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

Examples:

# Set attributes of a group - make it non searchable in territory.
UU::OS::Group.set_attributes('ues:TERRITORY:GROUP',
      :name => 'John',
      :surname => 'Doe',
      :code => 'NEWCODE',
      :description => 'Some sample description',
      :searchable_in_territory => false
)

Parameters:

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

    UESURI of the group whose attributes are to be changed

  • group (GroupSetAttributes) (defaults to: nil)

    DTO containing new attributes the group

Options Hash (group):

  • :name (String)

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

  • :code (String)

    The new code of the group. 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 group. If nil is set, the description is not modified.

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

    The new security level of the group. If nil is set, the security level is not modified. If the meta artifact tSecurityLevel is higher than the user’s security clearance, the set_attributes command fails.

  • :searchable_in_territory (Boolean)

    Specifies if it is possible to search the group in its territory. If nil is set, this attribute on the group is not modified.

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

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

  • :grant_all_from_organizational_unit (Boolean)

    Deprecated. Specifies if the group will be included among All roles from organizational unit. If true or nil is set, the role will be included, otherwise it will not be included among All roles from organizational unit.

  • :component_content (Boolean)

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

Returns:



110
111
112
113
114
115
116
117
118
# File 'uu_os-0.29.16/lib/uu/os/group.rb', line 110

def set_attributes(group_uri, group = nil)
  svc = UU::OS::REST::RemoteClient.new(Group)
  payload = UU::OS::Group::GroupSetAttributes.new(group).to_json

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