content: package com.example.demo.service.impl;
  
  import com.example.demo.domain.Country;
  import com.example.demo.repository.CountryRepository;
  import com.example.demo.service.CountryService;
  import java.util.List;
  import java.util.Optional;
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  import org.springframework.stereotype.Service;
  import org.springframework.transaction.annotation.Transactional;
  
  /**
   * Service Implementation for managing {@link Country}.
   */
  @Service
  @Transactional
  public class CountryServiceImpl implements CountryService {
  
      private final Logger log = LoggerFactory.getLogger(CountryServiceImpl.class);
  
      private final CountryRepository countryRepository;
  
      public CountryServiceImpl(CountryRepository countryRepository) {
          this.countryRepository = countryRepository;
      }
  
      @Override
      public Country save(Country country) {
          log.debug("Request to save Country : {}", country);
          return countryRepository.save(country);
      }
  
      @Override
      public Optional<Country> partialUpdate(Country country) {
          log.debug("Request to partially update Country : {}", country);
  
          return countryRepository
              .findById(country.getId())
              .map(existingCountry -> {
                  if (country.getCountryName() != null) {
                      existingCountry.setCountryName(country.getCountryName());
                  }
  
                  return existingCountry;
              })
              .map(countryRepository::save);
      }
  
      @Override
      @Transactional(readOnly = true)
      public List<Country> findAll() {
          log.debug("Request to get all Countries");
          return countryRepository.findAll();
      }
  
      @Override
      @Transactional(readOnly = true)
      public Optional<Country> findOne(Long id) {
          log.debug("Request to get Country : {}", id);
          return countryRepository.findById(id);
      }
  
      @Override
      public void delete(Long id) {
          log.debug("Request to delete Country : {}", id);
          countryRepository.deleteById(id);
      }
  }
  