0

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

4

1 回答 1

0

我在 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
于 2018-05-16T21:47:17.057 回答