class BBInputSetup implements JavaDelegate {

    protected Customer getCustomerAndServiceSubscription(RequestDetails requestDetails, String resourceId) {
        Customer customer;
        if (requestDetails.getSubscriberInfo() != null) {
            customer = this.getCustomerFromRequest(requestDetails);
        } else {
            customer = this.getCustomerFromURI(resourceId);
        }
        if (customer != null) {
            ServiceSubscription serviceSubscription = null;
            serviceSubscription = getServiceSubscription(requestDetails, customer);
            if (serviceSubscription == null) {
                serviceSubscription = getServiceSubscriptionFromURI(resourceId, customer);
            }
            customer.setServiceSubscription(serviceSubscription);
            return customer;
        } else {
            return null;
        }
    }

}