Module: UU::OS::AppPackage

Extended by:
AppPackage
Included in:
AppPackage
Defined in:
uu_os-0.29.16/lib/uu/os/app_package/app_package_export.rb,
uu_os-0.29.16/lib/uu/os/app_package.rb,
uu_os-0.29.16/lib/uu/os/app_package/app_package_create.rb,
uu_os-0.29.16/lib/uu/os/app_package/app_package_attributes.rb,
uu_os-0.29.16/lib/uu/os/app_package/app_package_set_attributes.rb,
uu_os-0.29.16/lib/uu/os/app_package/app_package_get_entry_list.rb,
uu_os-0.29.16/lib/uu/os/app_package/app_package_get_export_data.rb,
uu_os-0.29.16/lib/uu/os/app_package/app_package_entry_attributes.rb

Overview

Module App Package.

Defined Under Namespace

Classes: AppPackageAttributes, AppPackageCreate, AppPackageEntryAttributes, AppPackageExport, AppPackageGetEntryList, AppPackageGetExportData, AppPackageSetAttributes

Constant Summary

PATH =

Service path

'uu/os/AppPackage'

Instance Method Summary (collapse)

Instance Method Details

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

Creates a new app package. The command creates a new app package in a specified location. At the very least meta artifact and name must be specified in AppPackageCreate Object. Competent role for the app package 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 AppPackageCreate Object.

Examples:

# Create a new app package.
UU::OS::AppPackage.create('ues:TERRITORY:ORGANIZATIONAL_UNIT', :code => 'NEW_APP_PACKAGE', :name => 'New App Package')

Parameters:

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

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

  • app_package (AppPackageCreate) (defaults to: nil)

    Object containing attributes of the new app package.

Options Hash (app_package):

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

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

  • :name (String)

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

  • :code (String)

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

  • :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 app package 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 default 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 app package’s icon. If nil is set, the app package uses icon from meta artifact. An example of icon URI: ‘ues:#{system}:#{ues_v5.core_v1.codetable_v1.base_v1.CodeTable_Icons}:#{ART_077}’.

Returns:



41
42
43
44
45
46
47
48
49
# File 'uu_os-0.29.16/lib/uu/os/app_package.rb', line 41

def create(location_uri, app_package = nil)
  svc = UU::OS::REST::RemoteClient.new(AppPackage)
  payload = UU::OS::AppPackage::AppPackageCreate.new(app_package).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(app_package_uri)

Deletes the specified app package from the system. The app package is deleted even if it contains a locked sheet or attachment. The app package cannot be deleted when:

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

Examples:

# Delete an app package with specified uri.
UU::OS::AppPackage.delete('ues:TERRITORY:APP_PACKAGE')

Parameters:

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

    UESURI of the app package which is about to be deleted.



109
110
111
112
113
114
# File 'uu_os-0.29.16/lib/uu/os/app_package.rb', line 109

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

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

Exports an app package 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 an app package.
process_uri = UU::OS::AppPackage.export('ues:TERRITORY:APP_PACKAGE')

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

Parameters:

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

    UESURI of the app package to export.

Returns:



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

def export(app_package_uri)
  svc = UU::OS::REST::RemoteClient.new(AppPackage)
  payload = UU::OS::AppPackage::AppPackageExport.new(nil).to_json

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

- (AppPackageAttributes) get_attributes(app_package_uri)

Returns attributes representing the app package specified by the app_package_uri parameter. The command does not change the state of the app package in the system.

Examples:

# Get attributes of the specified app package.
attributes = UU::OS::AppPackage.get_attributes('ues:TERRITORY:APP_PACKAGE')

Parameters:

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

    UESURI of an app package whose attributes are returned

Returns:



62
63
64
65
66
67
68
# File 'uu_os-0.29.16/lib/uu/os/app_package.rb', line 62

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

- (UU::OS::REST::ResultList<AppPackage::AppPackageGetEntryList, AppPackage::AppPackageEntryAttributes>) get_entry_list(app_package_uri, criteria = nil)

Returns a list of entries (artifacts, meta artifacts, meta interfaces, containers, app package dictionaries or shortcuts) enlisted in the specified app package dictionary. Command does not return all entries, only a sublist. The list of returned entries could be filtered by the name, code or entityTypeUri 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.

Examples:

# Get entries of an app package in descending order and even with entries of inner app packages - flag recursive is set to true.
entryList = UU::OS::AppPackage.get_entry_list('ues:TERRITORY:APP_PACKAGE', :query=>'ORDER BY name DESC', :recursive=>true)

Parameters:

Options Hash (criteria):

  • :query (String)

    The UES query string. It has to conform the ues query 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 and code as the second criteria.

  • :recursive (Boolean)

    Flag for recursive listing. It means that if the listed folder contains inner folders and the recursive flag is true, entries of the all inner folders are in result too. When the recursive flag is nil or false, only entries are returned exactly from the listed app package.

Returns:



134
135
136
137
138
139
140
141
142
143
144
145
# File 'uu_os-0.29.16/lib/uu/os/app_package.rb', line 134

def get_entry_list(app_package_uri, criteria = nil)
  svc = UU::OS::REST::RemoteClient.new(AppPackage)
  dto = AppPackage::AppPackageGetEntryList.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', app_package_uri)
    return UU::OS::REST::ResultList.new(AppPackage::AppPackageGetEntryList, AppPackage::AppPackageEntryAttributes, res)
  end
end

- (UU::OS::REST::BinaryValue) get_export_data(app_package_uri, app_package = nil)

Returns a XML file generated by the export command.

Examples:

# Start exporting an app package
process_uri = UU::OS::AppPackage.export('ues:TERRITORY:APP_PACKAGE')

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

Parameters:

Options Hash (app_package):

Returns:



187
188
189
190
191
192
193
194
195
196
# File 'uu_os-0.29.16/lib/uu/os/app_package.rb', line 187

def get_export_data(app_package_uri, app_package = nil)
  svc = UU::OS::REST::RemoteClient.new(AppPackage)
  dto = UU::OS::AppPackage::AppPackageGetExportData.new(app_package)
  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', app_package_uri)
  end
end

- (UU::OS::UESURI) set_attributes(app_package_uri, app_package = nil)

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

Examples:

# Set basic attributes of an app package.
UU::OS::AppPackage.set_attributes('ues:TERRITORY:APP_PACKAGE', :code=>'NEW_CODE', :name=>'App Package name', :description=>'Some sample description.')

Parameters:

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

    UESURI of the app package whose attributes are to be changed

  • app_package (AppPackageSetAttributes) (defaults to: nil)

    Object containing new attributes the app package

Options Hash (app_package):

  • :name (String)

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

  • :code (String)

    The new code of the app package. If nil is set, the code is not modified. When blank string is set, the code is generated automatically using the system sequence. The code must be unique in a given territory, otherwise the set_attributes command fails.

  • :description (String)

    The new description of the app package. If nil is set, the description is not modified.

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

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

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

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

Returns:



86
87
88
89
90
91
92
93
94
# File 'uu_os-0.29.16/lib/uu/os/app_package.rb', line 86

def set_attributes(app_package_uri, app_package = nil)
  svc = UU::OS::REST::RemoteClient.new(AppPackage)
  payload = UU::OS::AppPackage::AppPackageSetAttributes.new(app_package).to_json

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