Skip to content

Application

Purpose

Applications service interaction in a P6 Core instance.

Methods

Binding name: p6.application


list

Return the list of applications that are not under development.

Syntax

List<ApplicationDetail> p6.application.list()
ApplicationDetail
Field Type Description
name String The name
installed boolean Is the application installed
version String The application version
Example
p6.application.list().each { app ->
    println "${app.name} (installed: ${app.installed}) - ${app.version}"
}

withAppUpgrade

Warning

Used exclusively in application upgrade scripts

Deploy the new version of the service item.

Syntax

void p6.application.withAppUpgrade(Closure<Boolean> itemNotify)

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

Example
p6.application.withAppUpgrade() { serviceId, itemId ->
    true
}

applyAppRollback

Warning

Used exclusively in application rollback scripts.

Syntax

void p6.application.applyAppRollback()

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.

Example
p6.application.applyAppRollback()

getServiceItem

Retrieve the service item as a JSON encoded

Syntax

String p6.application.getServiceItem(String serviceId, String ItemId)

Note

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
Example
def item = p6.application.getServiceItem("scripts", "myApp.scriptId")

storeAppState

Store a String value.

Syntax

String p6.application.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.

Example
p6.application.storeAppState("installed", "true")

getAppState

Retrieve a saved String

Syntax

String p6.application.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

Example
def installed = p6.application.getAppState("installed")