Module: UU::OS::BasicGroup

Extended by:
BasicGroup
Included in:
BasicGroup
Defined in:
uu_os-0.29.16/lib/uu/os/basic_group.rb,
uu_os-0.29.16/lib/uu/os/basic_group/basic_group_type.rb,
uu_os-0.29.16/lib/uu/os/basic_group/basic_group_create.rb,
uu_os-0.29.16/lib/uu/os/basic_group/basic_group_attributes.rb,
uu_os-0.29.16/lib/uu/os/basic_group/basic_group_set_attributes.rb,
uu_os-0.29.16/lib/uu/os/basic_group/basic_group_get_basic_group_list.rb,
uu_os-0.29.16/lib/uu/os/basic_group/basic_group_add_artifact_interface.rb,
uu_os-0.29.16/lib/uu/os/basic_group/basic_group_remove_artifact_interface.rb,
uu_os-0.29.16/lib/uu/os/basic_group/basic_group_get_basic_group_list_item.rb,
uu_os-0.29.16/lib/uu/os/basic_group/basic_group_get_artifact_interface_list.rb,
uu_os-0.29.16/lib/uu/os/basic_group/basic_group_get_artifact_interface_list_item.rb

Overview

Basic group.

Defined Under Namespace

Classes: BasicGroupAddArtifactInterface, BasicGroupAttributes, BasicGroupCreate, BasicGroupGetArtifactInterfaceList, BasicGroupGetArtifactInterfaceListItem, BasicGroupGetBasicGroupList, BasicGroupGetBasicGroupListItem, BasicGroupRemoveArtifactInterface, BasicGroupSetAttributes, BasicGroupType

Constant Summary

PATH =

Service path

'ues/core/role/UESBasicGroup'

Instance Method Summary (collapse)

Instance Method Details

- (UU::OS::UESURI) add_artifact_interface(basic_group_uri, artifact_interface = nil)

Creates new artifact interface connection to the specified role.

Examples:

# Add an artifact interface
UU::OS::BasicGroup.add_artifact_interface('ues:TERRITORY:BASIC_GROUP',
   :artifact_interface_code => 'UU.OS/READ_WRITE'
)

Parameters:

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

    UESURI of the basic group where the artifact interface will be connected.

  • artifact_interface (BasicGroupAddArtifactInterface) (defaults to: nil)

    Object containing the changed attributes of the basic group.

Options Hash (artifact_interface):

  • :artifact_interface_code (String)

    Code of the artifact interface that is to be connected to the specified basic group. If nil is set, the command fails.

Returns:



138
139
140
141
142
143
144
145
# File 'uu_os-0.29.16/lib/uu/os/basic_group.rb', line 138

def add_artifact_interface(basic_group_uri, artifact_interface = nil)
  svc = UU::OS::REST::RemoteClient.new(BasicGroup)
  payload = UU::OS::BasicGroup::BasicGroupAddArtifactInterface.new(artifact_interface).to_json

  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('addArtifactInterface', basic_group_uri, payload)
  end
end

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

Creates a new basic group in a specified location. If the meta artifact is not selected in BasicGroupCreate object, the new basic group is created by Basic Group meta artifact from uuOS application. Competent role for the new basic group is always the same role as the competent role for the organizational unit of newly created basic group.

Examples:

# Create a basic group
UU::OS::BasicGroup.create('ues:TERRITORY:LOCATION',
   :basic_group_type => 'EXECUTIVES'
)

Parameters:

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

    UESURI of the folder / organizational unit / uuApp meta model where the basic group will be created.

  • basic_group (BasicGroupCreate) (defaults to: nil)

    Object containing the attributes of the basic group.

Options Hash (basic_group):

  • :basic_group_type (String, UU::OS::BasicGroup::BasicGroupType)

    Specifies the type of basic group. There can be only one basic group for each of the AUTHORITIES, AUDITORS, EXECUTIVES and READERS types in the organizational unit of newly created basic group. If nil or empty the create command fails. Selected basic group type cannot be changed after the basic group creation.

  • :name (String)

    Name of the new basic group. If nil or empty, name is generated according to the selected basic group type.

  • :code (String)

    Code of the new basic group. If nil or empty, code is generated according to the selected basic group type.

  • :description (String)

    Description of the new basic group. If nil is set, tDescription from meta artifact is used if set, otherwise no description is set on the new basic group.

  • :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 basic 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 basic 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}’.

  • :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 BasicGroup is component content. Default value is false.

Returns:



47
48
49
50
51
52
53
54
55
# File 'uu_os-0.29.16/lib/uu/os/basic_group.rb', line 47

def create(location_uri, basic_group = nil)
  svc = UU::OS::REST::RemoteClient.new(BasicGroup)
  payload = UU::OS::BasicGroup::BasicGroupCreate.new(basic_group).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(basic_group_uri)

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

Examples:

# Command that deletes basic group
UU::OS::BasicGroup.delete(basic_group_uri)

Parameters:

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

    UESURI of the basic group which is about to be deleted.



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

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

- (UU::OS::REST::ResultList<BasicGroup::BasicGroupGetArtifactInterfaceList, BasicGroup::BasicGroupGetArtifactInterfaceListItem>) get_artifact_interface_list(basic_group_uri)

Returns sorted list of the codes of artifact interfaces that are connected to the specified basic group.

Parameters:

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

    UESURI of the basic group for which the codes of connected artifact interfaces are to be listed.

Returns:



175
176
177
178
179
180
181
182
# File 'uu_os-0.29.16/lib/uu/os/basic_group.rb', line 175

def get_artifact_interface_list(basic_group_uri)
  svc = UU::OS::REST::RemoteClient.new(BasicGroup)

  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.get('getArtifactInterfaceList', basic_group_uri)
    return UU::OS::REST::ResultList.new(BasicGroup::BasicGroupGetArtifactInterfaceList, BasicGroup::BasicGroupGetArtifactInterfaceListItem, res)
  end
end

- (BasicGroupAttributes) get_attributes(basic_group_uri)

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

Parameters:

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

    UESURI of the basic group whose attributes will be returned.

Returns:



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

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

- (UU::OS::REST::ResultList<BasicGroup::GetBasicGroupList, BasicGroup::GetBasicGroupListItem>) get_basic_group_list(artifact_uri, criteria = nil)

Returns list of the basic groups which are located in the organizational unit of specified artifact. The list of the returned basic groups can be filtered and ordered arbitrarily. The parameters available for customized filtering and ordering are the following: name, code, basic_group_type. The list is sorted by name of the basic group by default.

Parameters:

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

    UESURI of an existing artifact. Basic groups from the organizational unit where the artifact is located will be returned.

  • criteria (BasicGroupGetBasicGroupList) (defaults to: nil)

    DTO containing criteria for listing access role interfaces.

Options Hash (criteria):

  • :query (String)

    The UES query string. It has to conform the UESQuery syntax (see UESQuery 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:

  • (UU::OS::REST::ResultList<BasicGroup::GetBasicGroupList, BasicGroup::GetBasicGroupListItem>)

    Returns the list of basic groups which are located in the same organizational unit as specified artifact.



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

def get_basic_group_list(artifact_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(BasicGroup)
  dto = BasicGroup::BasicGroupGetBasicGroupList.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('getBasicGroupList', artifact_uri)
    return UU::OS::REST::ResultList.new(BasicGroup::BasicGroupGetBasicGroupList, BasicGroup::BasicGroupGetBasicGroupListItem, res)
  end
end

- (Object) remove_artifact_interface(basic_group_uri, artifact_interface = nil)

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

Examples:

# Remove an artifact interface
UU::OS::BasicGroup.remove_artifact_interface('ues:TERRITORY:BASIC_GROUP',
   :artifact_interface_code => 'UU.OS/READ_WRITE'
)

Parameters:

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

    UESURI of the basic group where the artifact interface will be disconnected.

  • artifact_interface (BasicGroupRemoveArtifactInterface) (defaults to: nil)

    Object containing the artifact interface code that is to be disconnected.

Options Hash (artifact_interface):

  • :artifact_interface_code (String)

    Code of the artifact interface that is to be disconnected from the specified basic group. If nil is set, the command fails.



160
161
162
163
164
165
166
167
# File 'uu_os-0.29.16/lib/uu/os/basic_group.rb', line 160

def remove_artifact_interface(basic_group_uri, artifact_interface = nil)
  svc = UU::OS::REST::RemoteClient.new(BasicGroup)
  payload = UU::OS::BasicGroup::BasicGroupRemoveArtifactInterface.new(artifact_interface).to_json

  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.post('removeArtifactInterface', basic_group_uri, payload)
  end
end

- (UU::OS::UESURI) set_attributes(basic_group_uri, basic_group = nil)

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

Examples:

# Set basic group attributes
UU::OS::BasicGroup.set_attributes('ues:TERRITORY:BASIC_GROUP',
   :name => 'New Name',
   :code => 'NEW_CODE',
   :description => 'Some sample description',
   :searchable_in_territory => false
)

Parameters:

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

    UESURI of the basic group whose attributes will be modified.

  • basic_group (BasicGroupSetAttributes) (defaults to: nil)

    Object containing the changed attributes of the basic group.

Options Hash (basic_group):

  • :name (String)

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

  • :code (String)

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

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

    The new security level of the basic group. If nil is set, the security level is not modified. If the given security level is higher than the user’s security clearance, the create command fails.

  • :searchable_in_territory (Boolean)

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

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

    URI of the basic 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:#UU::OS::BasicGroup.ues_v5ues_v5.core_v1ues_v5.core_v1.codetable_v1ues_v5.core_v1.codetable_v1.base_v1ues_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}’.

  • :component_content (Boolean)

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

Returns:



98
99
100
101
102
103
104
105
106
# File 'uu_os-0.29.16/lib/uu/os/basic_group.rb', line 98

def set_attributes(basic_group_uri, basic_group = nil)
  svc = UU::OS::REST::RemoteClient.new(BasicGroup)
  payload = UU::OS::BasicGroup::BasicGroupSetAttributes.new(basic_group).to_json

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