class SDNCQueryTasks {

    public void queryVfModuleForVolumeGroup(BuildingBlockExecution execution) {
        try {
            VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
            if (vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) {
                String response = sdncVfModuleResources.queryVfModule(vfModule);
                execution.setVariable(SDNCQUERY_RESPONSE + vfModule.getVfModuleId(), response);
            } else {
                throw new Exception("Vf Module " + vfModule.getVfModuleId()
                        + " exists in gBuildingBlock but does not have a selflink value");
            }
        } catch (BBObjectNotFoundException bbException) {
            logger.error("Error occurred if bb object not found in SDNCQueryTasks queryVfModuleForVolumeGroup ",
                    bbException);
            // If there is not a vf module in the general building block, we will not call
            // SDNC and proceed as normal
            // without throwing an error
            // If we see a bb object not found exception for something that is not a vf
            // module id, then we should throw
            // the error as normal
            if (!ResourceKey.VF_MODULE_ID.equals(bbException.getResourceKey())) {
                exceptionUtil.buildAndThrowWorkflowException(execution, 7000, bbException, ONAPComponents.SO);
            }
        } catch (BadResponseException ex) {
            logger.error("Error occurred for BadResponseException in SDNCQueryTasks queryVfModuleForVolumeGroup ", ex);
            if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) {
                exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SDNC);
            } else {
                exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
            }
        } catch (Exception ex) {
            logger.error("Exception occurred", ex);
            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
        }
    }

}