aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/main
diff options
context:
space:
mode:
authorRob Daugherty <rd472p@att.com>2018-08-23 16:17:18 +0000
committerGerrit Code Review <gerrit@onap.org>2018-08-23 16:17:18 +0000
commit777c1269be6e6bb4b3457cf47e4ec87924cb8fc7 (patch)
treea8cf6a7887dcfb5a064fe97608bf71107bb1799e /bpmn/so-bpmn-tasks/src/main
parentf2afd9880e409317626f393ab6d0a414a80653de (diff)
parent4db25ff7b585c21f14e1acb306aec752bd362610 (diff)
Merge "write update status of BBs progress"
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
index ee6af61d0f..101a355c2f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -81,6 +81,45 @@ public class WorkflowActionBBTasks {
execution.setVariable(G_CURRENT_SEQUENCE, currentSequence);
}
}
+
+ public void updateFlowStatistics(DelegateExecution execution) {
+ int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
+ if(currentSequence > 1) {
+ InfraActiveRequests request = this.getUpdatedRequest(execution, currentSequence);
+ requestDbclient.updateInfraActiveRequests(request);
+ }
+ }
+
+ protected InfraActiveRequests getUpdatedRequest(DelegateExecution execution, int currentSequence) {
+ List<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) execution
+ .getVariable("flowsToExecute");
+ String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ ExecuteBuildingBlock completedBB = flowsToExecute.get(currentSequence - 2);
+ ExecuteBuildingBlock nextBB = flowsToExecute.get(currentSequence - 1);
+ int completedBBs = currentSequence - 1;
+ int totalBBs = flowsToExecute.size();
+ int remainingBBs = totalBBs - completedBBs;
+ String statusMessage = this.getStatusMessage(completedBB.getBuildingBlock().getBpmnFlowName(),
+ nextBB.getBuildingBlock().getBpmnFlowName(), completedBBs, remainingBBs);
+ Long percentProgress = this.getPercentProgress(completedBBs, totalBBs);
+ request.setStatusMessage(statusMessage);
+ request.setProgress(percentProgress);
+ request.setLastModifiedBy("CamundaBPMN");
+ return request;
+ }
+
+ protected Long getPercentProgress(int completedBBs, int totalBBs) {
+ double ratio = (completedBBs / (totalBBs * 1.0));
+ int percentProgress = (int) (ratio * 95);
+ return new Long(percentProgress + 5);
+ }
+
+ protected String getStatusMessage(String completedBB, String nextBB, int completedBBs, int remainingBBs) {
+ return "Execution of " + completedBB + " has completed successfully, next invoking " + nextBB
+ + " (Execution Path progress: BBs completed = " + completedBBs + "; BBs remaining = " + remainingBBs
+ + ").";
+ }
public void sendSyncAck(DelegateExecution execution) {
final String requestId = (String) execution.getVariable(G_REQUEST_ID);