Difference between revisions of "GetStatus"

From AgileApps Support Wiki
imported>Aeric
imported>Aeric
 
(4 intermediate revisions by the same user not shown)
Line 28: Line 28:
import com.platform.beans.*;
import com.platform.beans.*;
import static com.platform.api.CONSTANTS.*;
import static com.platform.api.CONSTANTS.*;
import static com.platform.api.Functions.*;
  ...
  ...
StatusBean sb = getStatus(STATUS.IMPORT, "974326842");
StatusBean sb = getStatus(CONSTANTS.STATUS.IMPORT, "974326842");
ImportStatusBean isb = (ImportStatusBean)sb.getObject();
ImportStatusBean isb = (ImportStatusBean)sb.getObject();
Logger.info("Status code for 974326842: " + isb.getStatusCode()  
Logger.info("Import status code: " + isb.getStatusCode()  
               + "; status: " +isb.getStatus(), "Import");
               + "; status: " +isb.getStatus(), "Import");
</syntaxhighlight>
</syntaxhighlight>
Line 40: Line 41:
This example returns the status for deployment job #870821896.
This example returns the status for deployment job #870821896.
:<syntaxhighlight lang="java" enclose="div">
:<syntaxhighlight lang="java" enclose="div">
import com.platform.api.*;
import com.platform.beans.*;
import com.platform.beans.*;
import static com.platform.api.CONSTANTS.*;
import static com.platform.api.CONSTANTS.*;
...
import static com.platform.api.Functions.*;
StatusBean sb = getStatus(STATUS.PACKAGE_DEPLOY, "870821896");
...
StatusBean sb = getStatus(CONSTANTS.STATUS.PACKAGE_DEPLOY, "870821896");
PackageDeployStatusBean pdsb = (PackageDeployStatusBean)sb.getObject();
PackageDeployStatusBean pdsb = (PackageDeployStatusBean)sb.getObject();
Logger.info("Status code for 870821896: " + pdsb.getStatusCode()  
Logger.info("Deployment status code: " + pdsb.getStatusCode()  
               + "; status: " + pdsb.getStatus(), "Deploy");
               + "; status: " + pdsb.getStatus(), "Deploy");
</syntaxhighlight>
</syntaxhighlight>


:''Learn more:'' [{{DOCHOST}}/javadocs/com/platform/beans/PackageDeployStatusBean.html PackageDeployStatusBean]
:''Learn more:'' [{{DOCHOST}}/javadocs/com/platform/beans/PackageDeployStatusBean.html PackageDeployStatusBean]
 
===Example: Get status for all package deployments===
===Example: Get status for all package deployments===
This example returns the status for all package deployments since the platform was installed.  
This example returns the status for all package deployments since the platform was installed.  

Latest revision as of 00:42, 22 February 2014

getStatus API

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

  • Data import
  • Package deployment
Syntax
StatusBean status = getStatus(String resourceName, String id);
Parameters
resourceName
A string that specifies the kind of job to be checked.
Possible values, defined in the 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.

import com.platform.api.*;
import com.platform.beans.*;
import static com.platform.api.CONSTANTS.*;
import static com.platform.api.Functions.*;
 ...
StatusBean sb = getStatus(CONSTANTS.STATUS.IMPORT, "974326842");
ImportStatusBean isb = (ImportStatusBean)sb.getObject();
Logger.info("Import status code: " + isb.getStatusCode() 
              + "; status: " +isb.getStatus(), "Import");
Learn more: ImportStatusBean

Example: Get status for a known deployment

This example returns the status for deployment job #870821896.

import com.platform.api.*;
import com.platform.beans.*;
import static com.platform.api.CONSTANTS.*;
import static com.platform.api.Functions.*;
 ...
StatusBean sb = getStatus(CONSTANTS.STATUS.PACKAGE_DEPLOY, "870821896");
PackageDeployStatusBean pdsb = (PackageDeployStatusBean)sb.getObject();
Logger.info("Deployment status code: " + pdsb.getStatusCode() 
              + "; status: " + pdsb.getStatus(), "Deploy");
Learn more: PackageDeployStatusBean

Example: Get status for all package deployments

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

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();
    Logger.info("Status code for: " + pdsb.getRecordId() 
                  + "; status:" + pdsb.getStatus(), "Deploy");
}