class SDNCQueryTasks {

    public void queryVfModule(BuildingBlockExecution execution) throws BBObjectNotFoundException {
        ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
        VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
        String selfLink = "restconf/config/GENERIC-RESOURCE-API:services/service/"
                + serviceInstance.getServiceInstanceId() + "/service-data/vnfs/vnf/" + genericVnf.getVnfId()
                + "/vnf-data/vf-modules/vf-module/" + vfModule.getVfModuleId() + "/vf-module-data/vf-module-topology/";
        try {
            if (vfModule.getSelflink() == null
                    || (vfModule.getSelflink() != null && vfModule.getSelflink().isEmpty())) {
                vfModule.setSelflink(selfLink);
            }
            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 (BadResponseException ex) {
            logger.error("Exception occurred for BadResponse ", 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);
        }
    }

}