class BBInputSetup implements JavaDelegate {

    protected ServiceInstance getServiceInstanceHelper(RequestDetails requestDetails, Customer customer,
            Project project, OwningEntity owningEntity, Map<ResourceKey, String> lookupKeyMap, String serviceInstanceId,
            boolean aLaCarte, Service service, String bbName) throws Exception {
        if (requestDetails.getRequestInfo().getInstanceName() == null && aLaCarte
                && bbName.equalsIgnoreCase(AssignFlows.SERVICE_INSTANCE.toString())) {
            throw new Exception("Request invalid missing: RequestInfo:InstanceName");
        } else {
            org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI;
            serviceInstanceAAI = getServiceInstanceAAI(requestDetails, customer, serviceInstanceId, aLaCarte, bbName);
            if (serviceInstanceAAI != null) {
                lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstanceId);
                return this.getExistingServiceInstance(serviceInstanceAAI);
            } else {
                return createServiceInstance(requestDetails, project, owningEntity, lookupKeyMap, serviceInstanceId);
            }
        }
    }

}