Module: UU::OS::OrganizationalUnit

Extended by:
OrganizationalUnit
Included in:
OrganizationalUnit
Defined in:
uu_os_client-0.10.6/lib/uu/os/organizational_unit/organizational_unit_create.rb,
uu_os_client-0.10.6/lib/uu/os/organizational_unit.rb,
uu_os_client-0.10.6/lib/uu/os/organizational_unit/organizational_unit_attributes.rb,
uu_os_client-0.10.6/lib/uu/os/organizational_unit/organizational_unit_entry_type.rb,
uu_os_client-0.10.6/lib/uu/os/organizational_unit/organizational_unit_get_entry_list.rb,
uu_os_client-0.10.6/lib/uu/os/organizational_unit/organizational_unit_set_attributes.rb,
uu_os_client-0.10.6/lib/uu/os/organizational_unit/organizational_unit_entry_attributes.rb

Overview

Module Organizational Unit.

Defined Under Namespace

Classes: OrganizationalUnitAttributes, OrganizationalUnitCreate, OrganizationalUnitEntryAttributes, OrganizationalUnitEntryType, OrganizationalUnitGetEntryList, OrganizationalUnitSetAttributes

Constant Summary

PATH =

Service path

'ues/core/container/UESOrganizationalUnit'

Instance Method Summary (collapse)

Instance Method Details

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

Creates a new organizational unit. The command creates a new organizational unit in a specified location. At the very least meta artifact must be specified in UESOrganizationalUnitCreate DTO. Competent role for the organizational unit 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 OrganizationalUnitCreate DTO.

Examples:

# Create new  organizational unit.
UU::OS::OrganizationalUnit.create('ues:TERRITORY:ORGANIZATIONAL_UNIT', :code => 'NEW_ORGANIZATIONAL_UNIT', :name => 'New Organizational Unit')

# Verifying that new organizational unit can be created.
UU::OS::OrganizationalUnit.create('ues:TERRITORY:ORGANIZATIONAL_UNIT', :code => 'NEW_ORGANIZATIONAL_UNIT', :name => 'New Organizational Unit', :dryRun => true)

Parameters:

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

    UESURI of the folder/org. unit/meta model where organizational unit will be created.

  • [UU::OS::OrganizationalUnit::OrganizationalUnitCreate] ([UU::OS::OrganizationalUnit::OrganizationalUnitCreate] organizational_unit Specific options.)

    organizational_unit Specific options.

  • organizational_unit (Hash) (defaults to: nil)

    a customizable set of options

Options Hash (organizational_unit):

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

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

  • :code (String)

    Code of the new organizational unit. When null 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.

  • :name (String)

    Name of the new organizational unit. When null is set, tName from meta artifact is used if set, otherwise the create command fails.

  • :description (String)

    Description of the new organizational unit. When null is set, tDescription from meta artifact is used if set, otherwise no description is set on the new organizational unit.

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

    UESURI of the competent role. When null is set, the executive role from authorization is used. If no role is authorized to create the new organizational unit 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 one of superior organizational units, the create command fails.

  • :security_level (String)

    Security level. When null 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.

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

    URI of the organizational unit’s icon. When null is set, the organizational unit uses icon from meta artifact.

    Allowed format URI of icon: ues:#system:#UU::OS::OrganizationalUnit.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

    For example: ues:#system:#UU::OS::OrganizationalUnit.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:#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.

Returns:



43
44
45
46
47
48
49
50
51
# File 'uu_os_client-0.10.6/lib/uu/os/organizational_unit.rb', line 43

def create(location_uri, organizational_unit = nil)
  svc = UU::OS::REST::RemoteClient.new(OrganizationalUnit)
  payload = UU::OS::OrganizationalUnit::OrganizationalUnitCreate.new(organizational_unit).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(org_unit_uri)

This command deletes the specified organizational unit from the system. The organizational unit is deleted even if it contains a locked sheet or attachment. The organizational unit cannot be deleted when: the org. unit is not empty, the org. unit's workflow is not created, a property contains a reference to this org. unit, a time sheet exists with a reference to this org. unit.

Parameters:

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

    UESURI of the organizational unit which is about to be deleted.



94
95
96
97
98
99
# File 'uu_os_client-0.10.6/lib/uu/os/organizational_unit.rb', line 94

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

- (OrganizationalUnitAttributes) get_attributes(organizational_unit_uri)

This command returns attributes representing the organizational unit specified by the organizationalUnitUri parameter. The command does not change the state of the organizational unit in the system.

Parameters:

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

    UESURI of an organizational unit whose attributes are returned

Returns:



60
61
62
63
64
65
66
# File 'uu_os_client-0.10.6/lib/uu/os/organizational_unit.rb', line 60

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

- (UU::OS::REST::ResultList<OrganizationalUnit::OrganizationalUnitGetEntryList, OrganizationalUnit::OrganizationalUnitEntryAttributes>) get_entry_list(organizational_unit_uri, criteria = nil)

This command returns a list of entries (artifacts or shortcuts) enlisted in the specified organizational unit. Only entries listed exactly in the specified organizational units are considered (so subordinate organizational units are not considered). The command does not return all entries, only a sublist. The list of returned entries could be filtered by the name, code or type of an entry. The list is sorted by the name (and codes in case are equal) of a entry by default, or it can be sorted arbitrarily by any of entry attributes usable for the filtering or these attributes combinations. See the UES query documentation for more information.

name, code and type : OrganizationalUnitEntryType.

See UESQuery Documentation.

Parameters:

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

    UESURI of the organizational unit from where entries (artifacts or shortcuts) are listed.

  • criteria (OrganizationalUnitGetEntryList) (defaults to: nil)

    DTO containing criteria for listing entries Available parameters are:

Returns:



118
119
120
121
122
123
124
125
126
127
128
129
# File 'uu_os_client-0.10.6/lib/uu/os/organizational_unit.rb', line 118

def get_entry_list(organizational_unit_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(OrganizationalUnit)
  dto = OrganizationalUnit::OrganizationalUnitGetEntryList.new(criteria)
  svc.add_parameter('pageIndex', dto.page_index)
  svc.add_parameter('pageSize', dto.page_size)
  svc.add_parameter('query', dto.query)
  svc.add_parameter('recursive', dto.recursive)
  UU::OS::QoS::QoSHandler.auto_retry do
    res = svc.get('getEntryList', organizational_unit_uri)
    return UU::OS::REST::ResultList.new(OrganizationalUnit::OrganizationalUnitGetEntryList, OrganizationalUnit::OrganizationalUnitEntryAttributes, res)
  end
end

- (UU::OS::UESURI) set_attributes(organizational_unit_uri, organizational_unit = nil)

Command for setting attributes of an organizational unit. The command can't modify references to objects like location, competent role and so on.

Parameters:

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

    UESURI of the organizational unit whose attributes are to be changed

  • organizational_unit (OrganizationalUnitSetAttributes) (defaults to: nil)

    DTO containing new attributes the organizational unit

Returns:



75
76
77
78
79
80
81
82
83
# File 'uu_os_client-0.10.6/lib/uu/os/organizational_unit.rb', line 75

def set_attributes(organizational_unit_uri, organizational_unit = nil)
  svc = UU::OS::REST::RemoteClient.new(OrganizationalUnit)
  payload = UU::OS::OrganizationalUnit::OrganizationalUnitSetAttributes.new(organizational_unit).to_json

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