public void updateProvider(Provider provider) { Long id = provider.getId(); if (id == null) { throw new IllegalStateException("no provider id"); } URL oldProvider = findProviderUrl(id); if (oldProvider == null) { throw new IllegalStateException("Provider was changed!"); } URL newProvider = provider.toUrl(); registryService.unregister(oldProvider); registryService.register(newProvider); }
public void create(Provider provider) { URL url = provider.toUrl(); registryService.register(url); }