diff --git a/components/workflow-extensions/src/main/java/com/wso2telco/hub/workflow/extensions/ApplicationCreationRestWorkflowExecutor.java b/components/workflow-extensions/src/main/java/com/wso2telco/hub/workflow/extensions/ApplicationCreationRestWorkflowExecutor.java index 76d41ce42..6c252571f 100644 --- a/components/workflow-extensions/src/main/java/com/wso2telco/hub/workflow/extensions/ApplicationCreationRestWorkflowExecutor.java +++ b/components/workflow-extensions/src/main/java/com/wso2telco/hub/workflow/extensions/ApplicationCreationRestWorkflowExecutor.java @@ -263,10 +263,25 @@ public WorkflowResponse complete(WorkflowDTO workFlowDTO) throws WorkflowExcepti throw new WorkflowException(msg, e); } - String msgOnCompletion = "Application Creation approval process completed. Workflow ID : " + workFlowDTO - .getExternalWorkflowReference() + " Workflow State : " + workFlowDTO.getStatus(); - log.info(msgOnCompletion); - auditLog.info(msgOnCompletion); + /** + * Log improvement : Application Approval details + */ + try { + Application application = dao.getApplicationById(Integer.parseInt(workFlowDTO.getWorkflowReference())); + + String msgOnCompletion = + " Application Creation approval process completed. Workflow ID : " + workFlowDTO.getExternalWorkflowReference() + + " | Workflow State : " + workFlowDTO.getStatus() + + " | Application name : " + application.getName() + + " | UUID : " + application.getUUID() + + " | Subscriber : " + application.getSubscriber().getName() + + " | Owner : " + application.getOwner() + + " | Approved Tier : " + application.getTier(); + log.info(msgOnCompletion); + auditLog.info(msgOnCompletion); + } catch (APIManagementException e) { + e.printStackTrace(); + } return new GeneralWorkflowResponse(); } diff --git a/components/workflow-extensions/src/main/java/com/wso2telco/hub/workflow/extensions/SubscriptionCreationRestWorkflowExecutor.java b/components/workflow-extensions/src/main/java/com/wso2telco/hub/workflow/extensions/SubscriptionCreationRestWorkflowExecutor.java index 3476f86b8..5f6c55d6a 100644 --- a/components/workflow-extensions/src/main/java/com/wso2telco/hub/workflow/extensions/SubscriptionCreationRestWorkflowExecutor.java +++ b/components/workflow-extensions/src/main/java/com/wso2telco/hub/workflow/extensions/SubscriptionCreationRestWorkflowExecutor.java @@ -306,11 +306,28 @@ public WorkflowResponse execute(WorkflowDTO workflowDTO) throws WorkflowExceptio @Override public WorkflowResponse complete(WorkflowDTO workFlowDTO) throws WorkflowException { workFlowDTO.setUpdatedTime(System.currentTimeMillis()); + ApiMgtDAO dao = ApiMgtDAO.getInstance(); super.complete(workFlowDTO); - String logm = "Subscription Creation [Complete] Workflow Invoked. Workflow ID : " + - workFlowDTO.getExternalWorkflowReference() + "Workflow State : " + workFlowDTO.getStatus(); - log.info(logm); - auditLog.info(logm); + + /** + * Log improvement : Subscription Approval details + */ + try { + SubscribedAPI subscription = dao.getSubscriptionById(Integer.parseInt(workFlowDTO.getExternalWorkflowReference())); + String logm = + "Subscription Creation [Complete] Workflow Invoked. Workflow ID : " + workFlowDTO.getExternalWorkflowReference() + + " | Workflow State : " + workFlowDTO.getStatus() + + " | API ID : " + subscription.getApiId() + + " | UUID : " + subscription.getUUID() + + " | Subscriber : " + subscription.getSubscriber().getName() + + " | Application : " + subscription.getApplication() + + " | Approved Tier : " + subscription.getTier(); + log.info(logm); + auditLog.info(logm); + } catch (APIManagementException e) { + e.printStackTrace(); + } + if (WorkflowStatus.APPROVED.equals(workFlowDTO.getStatus()) || WorkflowStatus.REJECTED.equals(workFlowDTO.getStatus())) {