Module: UU::OS::Folder

Extended by:
Folder
Included in:
Folder
Defined in:
uu_os_client-0.10.6/lib/uu/os/folder/folder_create.rb,
uu_os_client-0.10.6/lib/uu/os/folder.rb,
uu_os_client-0.10.6/lib/uu/os/folder/folder_export.rb,
uu_os_client-0.10.6/lib/uu/os/folder/folder_entry_type.rb,
uu_os_client-0.10.6/lib/uu/os/folder/folder_attributes.rb,
uu_os_client-0.10.6/lib/uu/os/folder/folder_set_attributes.rb,
uu_os_client-0.10.6/lib/uu/os/folder/folder_get_entry_list.rb,
uu_os_client-0.10.6/lib/uu/os/folder/folder_get_export_data.rb,
uu_os_client-0.10.6/lib/uu/os/folder/folder_entry_attributes.rb

Overview

Module Folder.

Defined Under Namespace

Classes: FolderAttributes, FolderCreate, FolderEntryAttributes, FolderEntryType, FolderExport, FolderGetEntryList, FolderGetExportData, FolderSetAttributes

Constant Summary

PATH =

Service path

'ues/core/container/UESFolder'

Instance Method Summary (collapse)

Instance Method Details

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

Creates a folder of class Folder. Command creates new folder in specified container. At the very least meta artifact must be specified in ArtifactCreate Object. Competent role for artifact 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 ArtifactCreate Object.

Examples:

# Create new folder.
UU::OS::Folder.create('ues:TERRITORY:ORGANIZATIONAL_UNIT', :code => 'NEW_FOLDER', :name => 'New Folder')

# Verifying that new folder can be created.
UU::OS::Folder.create('ues:TERRITORY:ORGANIZATIONAL_UNIT', :code => 'NEW_FOLDER', :name => 'New Folder', :dryRun => true)      

Parameters:

Options Hash (folder):

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

    UESURI of the meta artifact. Only meta artifact with template class of Folder (not descendants of Folder) can be used. If meta artifact is not allowed to be created in container specified in first parameter of command UESFolder.create(UESURI, UESFolderCreate), create command will fail.

  • :code (String)

    Code of the new folder. When null is set, the code will be 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 folder. When null is set, meta artifact’s tName will be used if set, otherwise the create command will fail.

  • :description (String)

    Description of the folder. When null is set, meta artifact’s tDescription will be used if set, otherwise no description will be set on the created folder.

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

    UESURI of the competent role. When null is set, competent role will be taken from authorization. Executive role for creating artifact into container specified in first parameter of command UESFolder#create(UESURI, UESFolderCreate), will be used. If no role is authorized to create artifact into specified container, create command will fail. If selected role has not connected role interface with selected meta artifact, create command will fail.

  • :security_level (String)

    Security level. When null is set, security level will be taken from meta artifact tSecurityLevel. If meta artifact tSecurityLevel is higher than user’s security clearance, the create command will fail. If security level is higher than users security clearance, create command will fail.

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

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

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



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

def create(location_uri, folder = nil)
  svc = UU::OS::REST::RemoteClient.new(Folder)
  payload = UU::OS::Folder::FolderCreate.new(folder).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(folder_uri)

This command deletes the specified folder from the system. The folder is deleted even if it contains a locked sheet or attachment. The folder cannot be deleted when:

the folder is not empty.
the folder's workflow is not created 
a property contains a reference to this folder 
a time sheet exists with a reference to this folder

Parameters:

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

    UESURI of the folder which is about to be deleted.



106
107
108
109
110
111
# File 'uu_os_client-0.10.6/lib/uu/os/folder.rb', line 106

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

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

Exports a folder 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.

Examples:

# Start exporting a folder.
process_uri = UU::OS::Folder.export('ues:TERRITORY:FOLDER')

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

Parameters:

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

    UESURI of the folder to export.

Returns:



143
144
145
146
147
148
149
150
151
# File 'uu_os_client-0.10.6/lib/uu/os/folder.rb', line 143

def export(folder_uri)
  svc = UU::OS::REST::RemoteClient.new(Folder)
  payload = UU::OS::Folder::FolderExport.new(nil).to_json

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

- (FolderAttributes) get_attributes(folder_uri)

Reads folder specified by the folderUri attribute and returns its attributes.

Parameters:

Returns:



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

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

- (UU::OS::REST::ResultList<Folder::FolderGetEntryList, Folder::FolderEntryAttributes>) get_entry_list(folder_uri, criteria = nil)

This command returns a list of entries (artifacts or shortcuts) enlisted in the specified folder (entity type of main entity of the command could be a Folder, Organizational Unit, Territory or Meta Model Dictionary). 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.

be a Folder, Organizational Unit, Territory or Meta Model Dictionary. are: name, code and type : FolderEntryType.

See UESQuery Documentation.

Parameters:

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

    UESURI of the folder from where entries (artifacts or shortcuts) are listed. It could

  • criteria (FolderGetEntryList) (defaults to: nil)

    Object containing criteria for listing shortcuts. Available parameters

Returns:



85
86
87
88
89
90
91
92
93
94
95
96
# File 'uu_os_client-0.10.6/lib/uu/os/folder.rb', line 85

def get_entry_list(folder_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(Folder)
  dto = Folder::FolderGetEntryList.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', folder_uri)
    return UU::OS::REST::ResultList.new(Folder::FolderGetEntryList, Folder::FolderEntryAttributes, res)
  end
end

- (UU::OS::UESURI) get_export_data(folder_uri, folder = nil)

Returns a XML file generated by the export command Folder#export.

Examples:

# Start exporting a folder
process_uri = UU::OS::Folder.export('ues:TERRITORY:FOLDER')

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

Parameters:

Options Hash (folder):

  • :requested_mime_type (String)

    MIME type of the returned value. All possible MIME types can be found as constants in UU::OS::Artifact::ExportMimeType class. ZIP is returned by default.

Returns:

  • (UU::OS::UESURI)

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



170
171
172
173
174
175
176
177
178
179
180
# File 'uu_os_client-0.10.6/lib/uu/os/folder.rb', line 170

def get_export_data(folder_uri, folder = nil)
  svc = UU::OS::REST::RemoteClient.new(Folder)
  dto = UU::OS::Folder::FolderGetExportData.new(folder)
  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', folder_uri)
    return UU::OS::REST::BinaryValue.new(res, true)
  end
end

- (UU::OS::UESURI) set_attributes(folder_uri, folder = nil)

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

Parameters:

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

    UESURI of the folder whose attributes are to be changed.

  • folder (FolderSetAttributes) (defaults to: nil)

    Object containing new attributes the folder.

Returns:

  • (UU::OS::UESURI)

    UESURI of the folder whose attributes are to be changed.



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

def set_attributes(folder_uri, folder = nil)
  svc = UU::OS::REST::RemoteClient.new(Folder)
  payload = UU::OS::Folder::FolderSetAttributes.new(folder).to_json

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