AgileApps Support Wiki Pre Release

getStatus

From AgileApps Support Wiki
Revision as of 00:33, 15 January 2011 by imported>Aeric
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

getStatus API

Returns the status of jobs submitted to the scheduler by these operations:

  • Data import
  • Package deployment
Syntax
<syntaxhighlight lang="java" enclose="div">

StatusBean status = getStatus(String resourceName, String id); </syntaxhighlight>

Parameters
resourceName
A string that specifies the kind of job to be checked.
Possible values, defined in the Template:Constants class, are:
STATUS.PACKAGE_DEPLOY
STATUS.IMPORT
id
The ID of the job.
Returns
StatusBean object

Example: Get status for an import

This example returns the status for import job #974326842, where the import job ID is returned by the REST bulk upload resource or the Java importData API.

<syntaxhighlight lang="java" enclose="div">

import com.platform.api.beans.*; import static com.platform.api.CONSTANTS.*;

...

StatusBean sb = getStatus(STATUS.IMPORT, "974326842"); ImportStatusBean isb = (ImportStatusBean)sb.getObject(); Functions.debug("Status code for 974326842: " + i.getStatusCode()

             + "; status: " +i.getStatus());

</syntaxhighlight>

Learn more: ImportStatusBean

Example: Get status for a known deployment

This example returns the status for deployment job #870821896.

<syntaxhighlight lang="java" enclose="div">

import com.platform.api.beans.*; import static com.platform.api.CONSTANTS.*; ... StatusBean sb = getStatus(STATUS.PACKAGE_DEPLOY, "870821896"); PackageDeployStatusBean pdsb = (PackageDeployStatusBean)sb.getObject(); Functions.debug("Status code for 870821896: " + pdsb.getStatusCode()

             + "; status: " + pdsb.getStatus());

</syntaxhighlight>

Learn more: PackageDeployStatusBean

Example: Get status for all package deployments

This example returns the status for all package deployments since the platform was installed.

<syntaxhighlight lang="java" enclose="div">

CollectionBean cb = searchStatus(STATUS.PACKAGE_DEPLOY, "id, status", ""); List list = (List)cb.getObject(); for(Object statusBean : list ) {

   StatusBean status = (StatusBean)statusBean;
   PackageDeployStatusBean pdsb = (PackageDeployStatusBean)status.getObject();
   Functions.debug("Status code for: " + pdsb.getRecordId() 
                 + "; status:" + pdsb.getStatus());

} </syntaxhighlight>