// And reload services
String newUuid = values.get(SettingManager.SYSTEM_SITE_SITE_ID_PATH);
if (newUuid != null && !currentUuid.equals(newUuid)) {
final MetadataRepository metadataRepository = context.getBean(MetadataRepository.class);
final SourceRepository sourceRepository = context.getBean(SourceRepository.class);
final Source source = sourceRepository.findOne(currentUuid);
Source newSource = new Source(newUuid, source.getName(), source.isLocal());
sourceRepository.save(newSource);
PathSpec<Metadata, String> servicesPath = new PathSpec<Metadata, String>() {
@Override
public Path<String> getPath(Root<Metadata> root) {
return root.get(Metadata_.sourceInfo).get(MetadataSourceInfo_.sourceId);
}
};
metadataRepository.createBatchUpdateQuery(servicesPath, newUuid, MetadataSpecs.isHarvested(false));
sourceRepository.delete(source);
}
SettingInfo info = context.getBean(SettingInfo.class);
ServerBeanPropertyUpdater.updateURL(info.getSiteUrl(true) + context.getBaseUrl(), context.getApplicationContext());