Application
Purpose¶
Applications service interaction in a P6 Core instance.
Methods¶
Binding name: p6.application
Method: List<ApplicationDetail> list()
Return the list of applications that are not under development.
An ApplicationDetail contains the following fields:
Field | Type | Description |
---|---|---|
name | String | The name |
installed | boolean | Is the application installed |
version | String | The application version |
Method: withAppUpgrade(Closure<Boolean> itemNotify)
Used exclusively in application upgrade scripts. The supplied Closure will be called with:
- Service Id
- Item Id
The Closure returns a Boolean indicating the acceptance or rejection of the upgrade service/item
Method: applyAppRollback()
Used exclusively in application rollback scripts.
Warning
Must be called to reinstate all previously stored service items prior to the last upgrade. Failure to call will result in a damaged installation state.
Method: getServiceItem(String serviceId, String ItemId)
A helper method to optionally use in upgrade/rollback scripts. This method retrieves the service item as a JSON encoded String given the parameters:
- Service Id
- Item Id
Method: storeAppState(String key, String value)
A helper method to optionally use in upgrade/rollback scripts. This method allows any String value to be stored using a supplied key.
Any stored state value will be available during the execution of a rollback script.
Method: getAppState(String key)
A helper method to optionally use in rollback scripts. This method allows any String value stored in an upgrade script to be retrieved using the given key
Examples¶
p6.application.list().each { app ->
println "${app.name} (installed: ${app.installed}) - ${app.version}"
}
p6.application.withAppUpgrade() { serviceId, itemId ->
true
}
p6.application.storeAppState("v1_client_id", "098798679-8768758-7654")
println p6.application.getAppState("v1_client_id")