Application

The Application object represents either a Base Application, an Application Version, or a Release. In DeployHub Pro there is always an Application on the stack representing the Application/Release being deployedreferenced by $Application. You can also retrieve an Application using the getApplication Function or push an Application onto the Stack via using Application.


NOTE: A Release is a DeployHub Pro Object. It is of the type Application. The release property indicates if the object represents a Release.


The following properties can be accessed for an Application object:


Property

Type

Description

id

Integer

Application id, as used in the database.

name

String

Application name.

fqdomain

String

Fully qualified domain name.

summary

String

Summary text.

domain

Object

Domain in which the Application is contained.

owner

Object

User or UserGroup that owns the Application.

parent

Object

The Base Application.

predecessor

Object

Predecessor Application Version (the version on which this version is based).

release

Boolean

true if object is a Release, false otherwise.

Applications

Array

Array of Application objects if the object is a Release – a list of the consituent Applications.  If the object is not a Release, this returns null.

Components

Array

Array of Component objects (keyed by Component name) which make up this Application.

approvals

Array

Array of strings (approved/rejected) keyed by domain name for which the Application is approved/rejected.

requests

Array

Array of Change Request objects – the change requests associated with this Application.

creator

User

User Object representing the user who created this Application.

modifier

User

User Object representing the user who last modified this Application.

ctime

Date

Date Object representing the date/time the Application was created.

mtime

Date

Date Object representing the date/time the Application was last modified.

attributes

Array

Array of Strings, keyed by Attribute Name



The following methods can be called on the Application object:


Method

Return Type

Description

children(all)

Array

Returns an array of Application objects representing the descendants of this Application. If the parameter all is passed as true then the returned array includes all the descendants of the immediate descendants recursively. If the parameter all is omitted or passed as false then the return array only includes the immedate descendants.

versions(all)

Array

Synonym for children. Works identically.

getatt(attname)

String

Returns the value of the specified attribute held against the Application. Parameter is the attribute name.

requests(onlyForApp)

Array

Returns an Array of Change Request objects. If onlyForApp is not specifed or passed as false then this is identical to accessing the requests attribute. If onlyForApp is specfied as true then only the change request records associated with the Application itself are returned – no change request which is only associated with a consituent Component is returned. This allows you to differentiate between change requests associated with the Application and any of its Components.

latest(branchname)

Object

Returns the latest Application Version of this Application. If branchname is specified then the returned Application Object is the latest version on the specified branch.


Attributes such as owner and parent return Objects. These objects have their own attributes. So, for example, one can get the owner name of an Application by writing:


set owner = ${Application.owner};

echo ${owner.name};


or, more simply:

echo ${Application.owner.name};


Get Application Approval Status:


set approvals = ${Application.approvals};

foreach(a: $approvals) {

echo "$a : ${approvals[$a]}";

}

// e.g.:

// Test : approved

// Prod : rejected


Since the array is keyed on the domain name, you can easily check if the app is approved for a particular domain:


set approvals = ${Application.approvals};

if (${approvals["Test"]} = "approved") {

       // Application is approved for Test Domain

}


Or you can use dot notation (assuming the target domain name does not contain spaces):


set approvals = ${Application.approvals};

if (${approvals.Test} = "approved") {

// Application is approved for Test Domain

}


To iterate through the Components that make up the Application:


set Components = ${Application.Components};

echo "This Application has ${Components.length()} Components";

iterate(c: $Components) {

echo "Component ${c.name} (id ${c.id})";

}