class ActivateVnfStatusOperationalEnvironment {

    public JSONObject callSDClientForRetry(OperationalEnvDistributionStatus queryDistributionDbResponse,
            OperationalEnvServiceModelStatus queryServiceModelResponse, Distribution sdcStatus) throws ApiException {

        JSONObject jsonResponse = null;

        String operEnvironmentId = queryDistributionDbResponse.getOperationalEnvId();
        String serviceModelVersionId = queryDistributionDbResponse.getServiceModelVersionId();
        String originalRequestId = queryServiceModelResponse.getRequestId();
        int retryCount = queryServiceModelResponse.getRetryCount();
        String workloadContext = queryServiceModelResponse.getWorkloadContext();


        jsonResponse = sdcClientHelper.postActivateOperationalEnvironment(serviceModelVersionId, operEnvironmentId,
                workloadContext);
        String statusCode = jsonResponse.get("statusCode").toString();
        if (statusCode.equals(String.valueOf(Response.Status.ACCEPTED.getStatusCode()))) {
            String newDistributionId = jsonResponse.get("distributionId").toString();
            // should insert 1 row, NEW distributionId for replacement of the serviceModelServiceId record
            OperationalEnvDistributionStatus insertNewDistributionId =
                    dbHelper.insertRecordToOperationalEnvDistributionStatus(newDistributionId, operEnvironmentId,
                            serviceModelVersionId, originalRequestId, DISTRIBUTION_STATUS_SENT, "");
            client.save(insertNewDistributionId);

            // update retryCount (less 1) for the serviceModelServiceId
            retryCount = retryCount - 1;
            // should update 1 row, original insert
            OperationalEnvServiceModelStatus updateRetryCountAndStatus =
                    dbHelper.updateRetryCountAndStatusInOperationalEnvServiceModelStatus(queryServiceModelResponse,
                            DISTRIBUTION_STATUS_SENT, retryCount);
            client.save(updateRetryCountAndStatus);

            // should update 1 row, OLD distributionId set to status error (ie, old distributionId is DONE!).
            OperationalEnvDistributionStatus updateStatus = dbHelper.updateStatusInOperationalEnvDistributionStatus(
                    queryDistributionDbResponse, DISTRIBUTION_STATUS_ERROR, sdcStatus.getErrorReason());
            client.save(updateStatus);
        } else {
            String dbErrorMessage = "Failure calling SDC: statusCode: " + statusCode + "; messageId: "
                    + jsonResponse.get("messageId") + "; message: " + jsonResponse.get("message");
            ErrorLoggerInfo errorLoggerInfo =
                    new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcessError)
                            .build();
            ValidateException validateException =
                    new ValidateException.Builder(dbErrorMessage, HttpStatus.SC_BAD_REQUEST,
                            ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
            requestDb.updateInfraFailureCompletion(dbErrorMessage, this.origRequestId, operEnvironmentId);
            throw validateException;
        }

        return jsonResponse;

    }

}