Module: UU::OS::AppPackage

Extended by:
AppPackage
Included in:
AppPackage
Defined in:
uu_os_client-0.10.6/lib/uu/os/app_package/app_package_export.rb,
uu_os_client-0.10.6/lib/uu/os/app_package.rb,
uu_os_client-0.10.6/lib/uu/os/app_package/app_package_create.rb,
uu_os_client-0.10.6/lib/uu/os/app_package/app_package_attributes.rb,
uu_os_client-0.10.6/lib/uu/os/app_package/app_package_set_attributes.rb,
uu_os_client-0.10.6/lib/uu/os/app_package/app_package_get_entry_list.rb,
uu_os_client-0.10.6/lib/uu/os/app_package/app_package_get_export_data.rb,
uu_os_client-0.10.6/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.

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.

Returns:



30
31
32
33
34
35
36
37
38
# File 'uu_os_client-0.10.6/lib/uu/os/app_package.rb', line 30

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)

This command 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

Parameters:

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

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



81
82
83
84
85
86
# File 'uu_os_client-0.10.6/lib/uu/os/app_package.rb', line 81

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 Env::Process and in REST::Future.

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(proces).get(:timeout=>600)

Parameters:

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

    UESURI of the app package to export.

Returns:



130
131
132
133
134
135
136
137
138
# File 'uu_os_client-0.10.6/lib/uu/os/app_package.rb', line 130

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)

This command returns attributes representing the app package specified by the appPackageUri parameter. The command does not change the state of the app package in the system.

Parameters:

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

    UESURI of an app package whose attributes are returned

Returns:



47
48
49
50
51
52
53
# File 'uu_os_client-0.10.6/lib/uu/os/app_package.rb', line 47

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)

This command 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.

name, code and entityTypeUri.

See UESQuery Documentation.

Parameters:

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

    UESURI of the app package dictionary from where entries are listed.

  • criteria (AppPackageGetEntryList) (defaults to: nil)

    Object containing criteria. Available parameters are:

Returns:



104
105
106
107
108
109
110
111
112
113
114
115
# File 'uu_os_client-0.10.6/lib/uu/os/app_package.rb', line 104

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::UESURI) get_export_data(app_package_uri, app_package = nil)

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

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):

  • :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 app package (XML or ZIP containing XML).



157
158
159
160
161
162
163
164
165
166
167
# File 'uu_os_client-0.10.6/lib/uu/os/app_package.rb', line 157

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
    res = svc.get('getExportData', app_package_uri)
    return UU::OS::REST::BinaryValue.new(res, true)
  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.

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

Returns:



62
63
64
65
66
67
68
69
70
# File 'uu_os_client-0.10.6/lib/uu/os/app_package.rb', line 62

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