使用 java api 获取工作流故障异常

get workflow malfunction exception with java api

有谁知道如何使用 java pe api 获取工作流程故障错误消息?我是 运行 IBM 提供的 QueueSample java 代码,我不清楚如何执行此操作。如有任何帮助,我们将不胜感激!

我在 VWParticipantHistory.getLogFields() 数组中找到了我的工作流程的故障错误消息。我修改了使用 IBM FileNet P8 API 红皮书开发应用程序中的示例代码:

// Create session object and log onto Process Engine
...
// Get the specific work item
...
// Get VWProcess object from work object
VWProcess process = stepElement.fetchProcess();
// Get workflow definitions from the VWProcess
VWWorkflowDefinition workflowDefinition =
process.fetchWorkflowDefinition(false);
// Get maps for each workflow definition
VWMapDefinition[] workflowMaps = workflowDefinition.getMaps();

// Iterate through each map in the workflow Definition
for (int i = 0; i < workflowMaps.length; i++) {
    // Get map ID and map name for each map definition
    int mapID = workflowMaps[i].getMapId();
    String mapName = workflowMaps[i].getName();
    // Get workflow history information for each map
    VWWorkflowHistory workflowHistory = process.fetchWorkflowHistory(mapID);
    String workflowOriginator = workflowHistory.getOriginator();

    // Iterate through each item in the Workflow History
    while (workflowHistory.hasNext()) {
        // Get step history objects for each workflow history
        VWStepHistory stepHistory = workflowHistory.next();
        String stepName = stepHistory.getStepName();
        System.out.println("step history name = " + stepName);
        // Iterate through each item in the Step History
        while (stepHistory.hasNext()) {
            // Get step occurrence history
            // objects for each step history object
            VWStepOccurrenceHistory stepOccurenceHistory = stepHistory.next();
            Date stepOcurrenceDateReceived = stepOccurenceHistory.getDateReceived();
            Date stepOcurrenceDateCompleted = stepOccurenceHistory.getCompletionDate();

            while (stepOccurenceHistory.hasNext()) {
                // Get step work object information
                // for each step occurrence
                VWStepWorkObjectHistory stepWorkObjectHistory = stepOccurenceHistory.next();
                stepWorkObjectHistory.resetFetch();
                // Get participant information for each work object
                while (stepWorkObjectHistory.hasNext()) {
                    VWParticipantHistory participantHistory = stepWorkObjectHistory.next();

                    String opName = participantHistory.getOperationName();
                    System.out.println("operation name = " + opName);
                    Date participantDateReceived = participantHistory.getDateReceived();
                    String participantComments = participantHistory.getComments();
                    String participantUser = participantHistory.getUserName();
                    String participantName = participantHistory.getParticipantName();

                    VWDataField[] logFields = participantHistory.getLogFields();
                    System.out.println("** start get log fields **");
                    for (int index=0; index<logFields.length; index++){
                        VWDataField dataField = logFields[index];  
                        String name = dataField.getName();
                        String val = dataField.getStringValue();
                        System.out.println("name = " + name + " , value = " + val);
                    }
                    System.out.println("** end get log fields **");
                } // while stepWorkObjectHistory
            } // while stepOccurenceHistory
        } // while stepHistory
    } // while workflowHistory
} // for workflow maps