This section provides examples that show how to use the Metrics Web Service to gather workflow metrics. The examples assume that you have obtained a stub, as shown in Section 21.1.6, Obtaining the Remote Interface, and potentially wrapped it in an object that handles the potential error conditions, as described in Section 21.1.7, Metrics Configuration Settings.
This example uses the KEY_APPROVAL_STATUS filter to compare the decision outcomes for a provisioning request type. This could be used to generate a pie chart for example.
FilterConstants constants=new FilterConstants(); Map<MetricsFilter, Object> map = new HashMap<MetricsFilter, Object>(); map.put(MetricsFilter.KEY_APPROVAL_STATUS,constants.getApprovalStatusApproved()); double accepted=stubWrapper.getFlowCount(processId,processVersion,map); map.put(MetricsFilter.KEY_APPROVAL_STATUS,constants.getApprovalStatusDenied()); double denied=stubWrapper.getFlowCount(processId,processVersion,map); map.put(MetricsFilter.KEY_APPROVAL_STATUS,constants.getApprovalStatusError()); double error=stubWrapper.getFlowCount(processId,processVersion,map); map.put(MetricsFilter.KEY_APPROVAL_STATUS,constants.getApprovalStatusRetract()); double retracted=stubWrapper.getFlowCount(processId,processVersion,map); map.put(MetricsFilter.KEY_APPROVAL_STATUS, constants.getApprovalStatusRefused()); double refused = stubWrapper.getFlowCount(processId, processVersion, map);
Additional filters may be specified by adding appropriate entries to the filter map. The following examples illustrate how you might add various types of filters.
To add a start date filter (01/01/2006 < date < 02/01/2006):
Calendar startDate=Calendar.getInstance(); startDate.set(2006,0,1); Calendar endDate=Calendar.getInstance(); endDate.set(2006,1,1); map.put(MetricsFilter.KEY_L_START_TIME,startDate); map.put(MetricsFilter.KEY_S_START_TIME,endDate)
To add a completion date filter (02/01/2005 < date <03/01/2005)
Calendar startDate=Calendar.getInstance(); startDate.set(2006,0,1); Calendar endDate=Calendar.getInstance(); endDate.set(2006,1,1); map.put(MetricsFilter.KEY_L_COMPLETION_TIME,startDate); map.put(MetricsFilter.KEY_S_COMPLETION_TIME,endDate)
To narrow down counted requests to a specific initiator
map.put(MetricsFilter.KEY_INITIATOR,"cn=admin,ou=idmsample,o=novell");
To narrow down counted requests to a specific recipient
map.put(MetricsFilter.KEY_RECIPIENT,"cn=admin,ou=idmsample,o=novell");
The following examples illustrate the use of various methods for retrieving workflow counts.
This example describes how to retrieve the various decision outcomes of a team. The team's DN is required and can be obtained by using the getTeams() method:
FilterConstants constants=new FilterConstants(); Map<MetricsFilter, Object> map = new HashMap<MetricsFilter, Object>(); map.put(MetricsFilter.KEY_ACTIVITY_END, constants.getActivityApproved()); double accepted = stubWrapper.getTeamDecisionCount(processId, processVersion, teamDN, map); map.put(MetricsFilter.KEY_ACTIVITY_END, constants.getActivityDenied()); double denied = stubWrapper.getTeamDecisionCount(processId, processVersion, teamDN, map); map.put(MetricsFilter.KEY_ACTIVITY_END, constants.getActivityReassigned()); double reassigned = stubWrapper.getTeamDecisionCount(processId, processVersion, teamDN, map); map.put(MetricsFilter.KEY_ACTIVITY_END, constants.getActivityRefused()); double refused = stubWrapper.getTeamDecisionCount(processId, processVersion, teamDN, map);
This example describes how to retrieve the various decisions outcomes for requests for which members of the team act as recipients
FilterConstants constants = new FilterConstants(); Map<MetricsFilter, Object> map = new HashMap<MetricsFilter, Object>(); map.put(MetricsFilter.KEY_APPROVAL_STATUS, constants.getActivityApproved()); double accepted = stubWrapper.getTeamRecipientCount(processId, processVersion, teamDN, map); map.put(MetricsFilter.KEY_APPROVAL_STATUS, constants.getApprovalStatusDenied()); double denied = stubWrapper.getTeamRecipientCount(processId, processVersion, teamDN, map); map.put(MetricsFilter.KEY_APPROVAL_STATUS, constants.getApprovalStatusError()); double error = stubWrapper.getTeamRecipientCount(processId, processVersion, teamDN, map); map.put(MetricsFilter.KEY_APPROVAL_STATUS, constants.getApprovalStatusError()); double retracted = stubWrapper.getTeamRecipientCount(processId, processVersion, teamDN, map); map.put(MetricsFilter.KEY_APPROVAL_STATUS, constants.getApprovalStatusRefused()); double refused = stubWrapper.getTeamRecipientCount(processId, processVersion, teamDN, map);
This example describes how to retrieve the requests started after 03/01/2006 that have been claimed but not acted upon.
Map<MetricsFilter, Object> map = new HashMap<MetricsFilter, Object>(); Calendar startDate=Calendar.getInstance(); startDate.set(2006,2,1); map.put(MetricsFilter.KEY_L_START_TIME,startDate); MetricsResultset rset = stubWrapper.getLongestClaimed(processId, processVersion, map);
This example describes how to retrieve the longest running requests that have been started by initiator "cn=admin,ou=idmsample,o=novell";
Map<MetricsFilter, Object> map = new HashMap<MetricsFilter, Object>(); map.put(MetricsFilter.KEY_INITIATOR,""cn=admin,ou=idmsample,o=novell"); MetricsResultset rset = stubWrapper.getLongestRunning(processId, processVersion, map);
This example describes the average inventory for users handling decision with activity id "managerApproval" between 01/01/2006 and 02/01/2006
Map<MetricsFilter, Object> map = new HashMap<MetricsFilter, Object>(); Calendar startDate=Calendar.getInstance(); startDate.set(2006,0,1); Calendar endDate=Calendar.getInstance(); endDate.set(2006,1,1); MetricsResultset rset = stubWrapper.getActivityInventory(processId, processVersion,"managerApproval", startDate, endDate, map );
This example describes the team's throughput and inventory over the time interval between 01/01/2006 and 02/01/2006
Map<MetricsFilter, Object> map = new HashMap<MetricsFilter, Object>(); Calendar startDate=Calendar.getInstance(); startDate.set(2006,0,1); Calendar endDate=Calendar.getInstance(); endDate.set(2006,1,1); double throughput = stubWrapper.getClaimedThroughputCalendarDays(processId, processVersion, startDate, endDate,teamDN, map); double inventory = stubWrapper.getClaimedInventory(processId, processVersion, startDate, endDate, teamDN, map)