Michael_Lowry

Java method to return task status & status text based on status code

Discussion created by Michael_Lowry on Nov 13, 2017
Latest reply on Mar 6, 2018 by Michael_Lowry

I have written a Java method that takes a task status code as input and returns the corresponding task status and task status text (in a two-element String array). I based this on table of status codes in the documentation of the AbstractTask API class. (The AWA documentation also includes a similar list of task statuses and their associated codes.) Enjoy!

 

public static String[] getTaskStatus(int statusCode) {
    String taskStatus = "";
    String taskStatusText = "";
    switch (statusCode) {
        case 1005:
            taskStatus = "state_waiting";
            taskStatusText = "Actually running";
            break;
        case 1006:
            taskStatus = "state_waiting";
            taskStatusText = "Checked";
            break;
        case 1008:
            taskStatus = "state_waiting";
            taskStatusText = "Aborted";
            break;
        case 1009:
            taskStatus = "state_waiting";
            taskStatusText = "Done";
            break;
        case 1300:
            taskStatus = "state_waiting";
            taskStatusText = "Preparing";
            break;
        case 1301:
            taskStatus = "state_waiting_others";
            taskStatusText = "Waiting for user input";
            break;
        case 1310:
            taskStatus = "state_waiting";
            taskStatusText = "operation not initialized";
            break;
        case 1510:
            taskStatus = "state_running";
            taskStatusText = "Transferred";
            break;
        case 1520:
            taskStatus = "state_running";
            taskStatusText = "Ready for transfer (before Connect)";
            break;
        case 1521:
            taskStatus = "state_running";
            taskStatusText = "Ready to be transferred";
            break;
        case 1529:
            taskStatus = "state_running";
            taskStatusText = "Ready for generation";
            break;
        case 1530:
            taskStatus = "state_running";
            taskStatusText = "Ready for start";
            break;
        case 1531:
            taskStatus = "state_running";
            taskStatusText = "To be called";
            break;
        case 1540:
            taskStatus = "state_running";
            taskStatusText = "Start initiated";
            break;
        case 1541:
            taskStatus = "state_running";
            taskStatusText = "Checking";
            break;
        case 1542:
            taskStatus = "state_running";
            taskStatusText = "Calling";
            break;
        case 1543:
            taskStatus = "state_waiting_others";
            taskStatusText = "Unknown";
            break;
        case 1544:
            taskStatus = "state_inconsistent";
            taskStatusText = "Inconsistent";
            break;
        case 1545:
            taskStatus = "state_running";
            taskStatusText = "Started";
            break;
        case 1546:
            taskStatus = "state_running";
            taskStatusText = "Connecting";
            break;
        case 1547:
            taskStatus = "state_inconsistent";
            taskStatusText = "Inconsistent RemoteTaskManager";
            break;
        case 1550:
            taskStatus = "state_running";
            taskStatusText = "Active";
            break;
        case 1551:
            taskStatus = "state_running";
            taskStatusText = "Transferring";
            break;
        case 1552:
            taskStatus = "state_waiting_others";
            taskStatusText = "Called";
            break;
        case 1553:
            taskStatus = "state_waiting_others";
            taskStatusText = "Accepted";
            break;
        case 1554:
            taskStatus = "state_running";
            taskStatusText = "Sampling files";
            break;
        case 1556:
            taskStatus = "state_waiting_others";
            taskStatusText = "Escalated";
            break;
        case 1557:
            taskStatus = "state_backup";
            taskStatusText = "Custom Backup";
            break;
        case 1558:
            taskStatus = "state_backup";
            taskStatusText = "File Backup";
            break;
        case 1560:
            taskStatus = "state_jp_blocking";
            taskStatusText = "Workflow is blocked";
            break;
        case 1561:
            taskStatus = "state_stopped_sys";
            taskStatusText = "STOP - Client-wide stop of automatic processing";
            break;
        case 1562:
            taskStatus = "state_holded";
            taskStatusText = "HELD - Manual stop has been set";
            break;
        case 1563:
            taskStatus = "state_stopped_man";
            taskStatusText = "STOP - Automatic processing has been stopped.";
            break;
        case 1564:
            taskStatus = "state_stopped_queue";
            taskStatusText = "STOP - Queue processing has been stopped.";
            break;
        case 1565:
            taskStatus = "state_running";
            taskStatusText = "Finished sending task";
            break;
        case 1566:
            taskStatus = "state_running";
            taskStatusText = "Skipping - Timeout";
            break;
        case 1567:
            taskStatus = "state_running";
            taskStatusText = "Skipping - Conditions";
            break;
        case 1568:
            taskStatus = "state_running";
            taskStatusText = "Skipping - manually inactive";
            break;
        case 1569:
            taskStatus = "state_running";
            taskStatusText = "Skipping Sync";
            break;
        case 1570:
            taskStatus = "state_running";
            taskStatusText = "Skipping";
            break;
        case 1571:
            taskStatus = "state_running";
            taskStatusText = "Canceling";
            break;
        case 1572:
            taskStatus = "state_running";
            taskStatusText = "Generating";
            break;
        case 1573:
            taskStatus = "state_running";
            taskStatusText = "Generated";
            break;
        case 1574:
            taskStatus = "state_running";
            taskStatusText = "Post processing";
            break;
        case 1575:
            taskStatus = "state_ending";
            taskStatusText = "Ending";
            break;
        case 1576:
            taskStatus = "state_running";
            taskStatusText = "Regenerating";
            break;
        case 1578:
            taskStatus = "state_running";
            taskStatusText = "Scanning Files";
            break;
        case 1579:
            taskStatus = "state_running";
            taskStatusText = "Scanning reports";
            break;
        case 1580:
            taskStatus = "state_running";
            taskStatusText = "Resolving variables";
            break;
        case 1581:
            taskStatus = "state_running";
            taskStatusText = "Checking Postconditions";
            break;
        case 1582:
            taskStatus = "state_running";
            taskStatusText = "Checking prompt values";
            break;
        case 1583:
            taskStatus = "state_running";
            taskStatusText = "LOOPING";
            break;
        case 1584:
            taskStatus = "state_running";
            taskStatusText = "Calculating ERT";
            break;
        case 1590:
            taskStatus = "state_rollback";
            taskStatusText = "Custom Rollback";
            break;
        case 1591:
            taskStatus = "state_rollback";
            taskStatusText = "File Rollback";
            break;
        case 1592:
            taskStatus = "state_rollback";
            taskStatusText = "AgentGroup Rollback";
            break;
        case 1593:
            taskStatus = "state_rollback";
            taskStatusText = "Workflow Rollback";
            break;
        case 1599:
            taskStatus = "state_waiting";
            taskStatusText = "Alive user view";
            break;
        case 1600:
            taskStatus = "state_waiting";
            taskStatusText = "Internal checking";
            break;
        case 1655:
            taskStatus = "state_waiting_rollback";
            taskStatusText = "Waiting for rollback";
            break;
        case 1665:
            taskStatus = "state_waiting_others";
            taskStatusText = "Waiting for externally resolved parameters";
            break;
        case 1681:
            taskStatus = "state_waiting_others";
            taskStatusText = "Waiting for User";
            break;
        case 1682:
            taskStatus = "state_waiting_others";
            taskStatusText = "Waiting for continuation of variable resolving";
            break;
        case 1684:
            taskStatus = "state_waiting_queue";
            taskStatusText = "Waiting for Queue slot";
            break;
        case 1685:
            taskStatus = "state_waiting_host";
            taskStatusText = "Waiting for post processing host";
            break;
        case 1686:
            taskStatus = "state_waiting_others";
            taskStatusText = "Waiting for start of AgentGroup container.";
            break;
        case 1687:
            taskStatus = "state_waiting_others";
            taskStatusText = "Waiting for end of parallel host-group tasks";
            break;
        case 1688:
            taskStatus = "state_waiting_host";
            taskStatusText = "Waiting for the host of an AgentGroup.";
            break;
        case 1689:
            taskStatus = "state_waiting_resource";
            taskStatusText = "Waiting for resource (max. FileTransfers exceeded)";
            break;
        case 1690:
            taskStatus = "state_waiting_ext";
            taskStatusText = "Waiting for external dependency";
            break;
        case 1691:
            taskStatus = "state_waiting";
            taskStatusText = "Waiting for remote system";
            break;
        case 1692:
            taskStatus = "state_waiting";
            taskStatusText = "Waiting for remote SYNC";
            break;
        case 1693:
            taskStatus = "state_waiting_mrel";
            taskStatusText = "Waiting for manual release";
            break;
        case 1694:
            taskStatus = "state_waiting_resource";
            taskStatusText = "Waiting for resource (max. Jobs exceeded)";
            break;
        case 1695:
            taskStatus = "state_waiting";
            taskStatusText = "Waiting for restart time";
            break;
        case 1696:
            taskStatus = "state_waiting_host";
            taskStatusText = "Waiting for host";
            break;
        case 1697:
            taskStatus = "state_waiting_sync";
            taskStatusText = "Waiting for SYNC";
            break;
        case 1698:
            taskStatus = "state_waiting_time";
            taskStatusText = "Waiting for start time";
            break;
        case 1699:
            taskStatus = "state_waiting";
            taskStatusText = "Alive";
            break;
        case 1700:
            taskStatus = "state_waiting";
            taskStatusText = "Waiting for predecessor";
            break;
        case 1701:
            taskStatus = "state_sleeping";
            taskStatusText = "Sleeping";
            break;
        case 1702:
            taskStatus = "state_waiting";
            taskStatusText = "Not yet called";
            break;
        case 1703:
            taskStatus = "state_waiting_precond";
            taskStatusText = "Waiting for Preconditions";
            break;
        case 1704:
            taskStatus = "state_running";
            taskStatusText = "Checking Preconditions";
            break;
        case 1705:
            taskStatus = "state_running";
            taskStatusText = "CHANGING_LOG";
            break;
        case 1709:
            taskStatus = "state_waiting_parallel_task";
            taskStatusText = "Waiting for end of parallel task(s)";
            break;
        case 1710:
            taskStatus = "state_registered";
            taskStatusText = "Registered";
            break;
        case 1711:
            taskStatus = "state_waiting_others";
            taskStatusText = "Queued";
            break;
        case 1799:
            taskStatus = "state_abended";
            taskStatusText = "Dead";
            break;
        case 1800:
            taskStatus = "state_abended";
            taskStatusText = "ENDED_NOT_OK - aborted";
            break;
        case 1801:
            taskStatus = "state_abended";
            taskStatusText = "ENDED_NOT_OK - aborted because of SYNC condition";
            break;
        case 1802:
            taskStatus = "state_abended";
            taskStatusText = "ENDED_JP_ABEND - not executed due to abnormal Workflow end.";
            break;
        case 1810:
            taskStatus = "state_abended";
            taskStatusText = "ENDED_VANISHED - disappeared";
            break;
        case 1815:
            taskStatus = "state_abended";
            taskStatusText = "ENDED_LOST - ended undefined (host terminated prematurely).";
            break;
        case 1820:
            taskStatus = "state_abended";
            taskStatusText = "FAULT_OTHER - Start impossible. Other error.";
            break;
        case 1821:
            taskStatus = "state_abended";
            taskStatusText = "FAULT_NO_HOST - Start impossible. Cannot reach host.";
            break;
        case 1822:
            taskStatus = "state_abended";
            taskStatusText = "FAULT_ALREADY_RUNNING - task is already running.";
            break;
        case 1823:
            taskStatus = "state_abended";
            taskStatusText = "FAULT_POST_PROCESSING - error in post processing.";
            break;
        case 1824:
            taskStatus = "state_abended";
            taskStatusText = "FAULT_POST_CONDITION - Error in Postcondition.";
            break;
        case 1825:
            taskStatus = "state_fault_backup";
            taskStatusText = "FAULT_CUSTOM_BACKUP - Error in custom backup";
            break;
        case 1826:
            taskStatus = "state_fault_backup";
            taskStatusText = "FAULT_FILE_BACKUP - Error in file backup";
            break;
        case 1827:
            taskStatus = "state_fault_rollback";
            taskStatusText = "FAULT_CUSTOM_ROLLBACK - Error in custom rollback";
            break;
        case 1828:
            taskStatus = "state_fault_rollback";
            taskStatusText = "FAULT_FILE_ROLLBACK - Error in file rollback";
            break;
        case 1829:
            taskStatus = "state_abended";
            taskStatusText = "FAULT_HOSTGROUP_ROLLBACK - Error in AgentGroup rollback";
            break;
        case 1830:
            taskStatus = "state_abended";
            taskStatusText = "FAULT_ROLLBACK - General error in rollback";
            break;
        case 1850:
            taskStatus = "state_abended";
            taskStatusText = "ENDED_CANCEL - manually canceled";
            break;
        case 1851:
            taskStatus = "state_abended";
            taskStatusText = "ENDED_JP_CANCEL - Workflow canceled manually.";
            break;
        case 1852:
            taskStatus = "state_abended";
            taskStatusText = "Rejected";
            break;
        case 1853:
            taskStatus = "state_abended";
            taskStatusText = "ENDED_QUEUE_CANCEL";
            break;
        case 1854:
            taskStatus = "state_abended";
            taskStatusText = "ENDED_CONTAINER_CANCEL";
            break;
        case 1856:
            taskStatus = "state_abended";
            taskStatusText = "ENDED_ESCALATED - aborted due to escalation";
            break;
        case 1860:
            taskStatus = "state_abended";
            taskStatusText = "Notification failed";
            break;
        case 1898:
            taskStatus = "state_blocking";
            taskStatusText = "Blocked";
            break;
        case 1899:
            taskStatus = "state_abended";
            taskStatusText = "Status blocked manually removed";
            break;
        case 1900:
            taskStatus = "state_ended";
            taskStatusText = "ENDED_OK - ended normally";
            break;
        case 1901:
            taskStatus = "state_inactive";
            taskStatusText = "Confirmed";
            break;
        case 1902:
            taskStatus = "state_inactive";
            taskStatusText = "ENDED_QUEUE_END";
            break;
        case 1903:
            taskStatus = "state_inactive";
            taskStatusText = "ENDED_CONTAINER_END";
            break;
        case 1904:
            taskStatus = "state_ended_rollbacked";
            taskStatusText = "ENDED_ROLLBACKED - Task was rolled back successfully.";
            break;
        case 1905:
            taskStatus = "state_inactive";
            taskStatusText = "ENDED_WF_ROLLBACKED";
            break;
        case 1910:
            taskStatus = "state_inactive";
            taskStatusText = "ENDED_EMPTY - task is empty (STOP NOMSG).";
            break;
        case 1911:
            taskStatus = "state_inactive";
            taskStatusText = "ENDED_TRUNCATE - Transfer incomplete due to line limit.";
            break;
        case 1912:
            taskStatus = "state_inactive";
            taskStatusText = "ENDED_EMPTY - nothing found.";
            break;
        case 1913:
            taskStatus = "state_rollback_empty";
            taskStatusText = "ENDED_ROLLBACK_EMPTY - No rollback defined";
            break;
        case 1919:
            taskStatus = "state_inactive";
            taskStatusText = "ENDED_INACTIVE - inactive due to logical date condition of external dependency.";
            break;
        case 1920:
            taskStatus = "state_inactive_cale";
            taskStatusText = "ENDED_INACTIVE - Inactive today because of Calendar.";
            break;
        case 1921:
            taskStatus = "state_inactive_def";
            taskStatusText = "ENDED_INACTIVE - task not active due to definition";
            break;
        case 1922:
            taskStatus = "state_inactive_man";
            taskStatusText = "ENDED_INACTIVE - Task was manually set inactive.";
            break;
        case 1923:
            taskStatus = "state_inactive";
            taskStatusText = "Deleted";
            break;
        case 1924:
            taskStatus = "state_inactive";
            taskStatusText = "UNPROCESSED";
            break;
        case 1925:
            taskStatus = "state_inactive_object";
            taskStatusText = "ENDED_INACTIVE_OBJECT - Object is inactive due to definition.";
            break;
        case 1930:
            taskStatus = "state_inactive";
            taskStatusText = "ENDED_SKIPPED - Skipped because of WHEN clause";
            break;
        case 1931:
            taskStatus = "state_inactive";
            taskStatusText = "ENDED_SKIPPED - Skipped because of SYNC condition.";
            break;
        case 1932:
            taskStatus = "state_inactive";
            taskStatusText = "ENDED_SKIPPED - Schedule ended prematurely";
            break;
        case 1933:
            taskStatus = "state_inactive";
            taskStatusText = "ENDED_SKIPPED - Skipped because of conditions.";
            break;
        case 1940:
            taskStatus = "state_inactive";
            taskStatusText = "ENDED_TIMEOUT - Not executed because of timeout (WHEN clause).";
            break;
        case 1941:
            taskStatus = "state_inactive";
            taskStatusText = "ENDED_TIMEOUT - Start time exceeded.";
            break;
        case 1942:
            taskStatus = "state_inactive";
            taskStatusText = "ENDED_TIMEOUT - ended untimely.";
            break;
        case 1944:
            taskStatus = "state_inactive";
            taskStatusText = "ENDED_TIMEOUT - period stopped";
            break;
        case 1960:
            taskStatus = "state_inactive";
            taskStatusText = "Notification successful";
            break;
        case 1970:
            taskStatus = "state_inactive";
            taskStatusText = "Operation successful";
            break;
        case 1999:
            taskStatus = "state_inactive";
            taskStatusText = "SYNC check passed";
            break;
        default:
            taskStatus = "unknown";
            taskStatusText = "Unknown";
            break;
    }
    String taskStatusArray[];
    taskStatusArray = new String[] {taskStatus,taskStatusText};
    return taskStatusArray;
}

Outcomes