content: package com.konsol.beatstream.service.impl;
  
  import com.konsol.beatstream.domain.Artist;
  import com.konsol.beatstream.repository.ArtistRepository;
  import com.konsol.beatstream.service.ArtistService;
  import com.konsol.beatstream.service.dto.ArtistDTO;
  import com.konsol.beatstream.service.mapper.ArtistMapper;
  import java.util.Optional;
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  import org.springframework.data.domain.Page;
  import org.springframework.data.domain.Pageable;
  import org.springframework.stereotype.Service;
  
  /**
   * Service Implementation for managing {@link com.konsol.beatstream.domain.Artist}.
   */
  @Service
  public class ArtistServiceImpl implements ArtistService {
  
      private static final Logger LOG = LoggerFactory.getLogger(ArtistServiceImpl.class);
  
      private final ArtistRepository artistRepository;
  
      private final ArtistMapper artistMapper;
  
      public ArtistServiceImpl(ArtistRepository artistRepository, ArtistMapper artistMapper) {
          this.artistRepository = artistRepository;
          this.artistMapper = artistMapper;
      }
  
      @Override
      public ArtistDTO save(ArtistDTO artistDTO) {
          LOG.debug("Request to save Artist : {}", artistDTO);
          Artist artist = artistMapper.toEntity(artistDTO);
          artist = artistRepository.save(artist);
          return artistMapper.toDto(artist);
      }
  
      @Override
      public ArtistDTO update(ArtistDTO artistDTO) {
          LOG.debug("Request to update Artist : {}", artistDTO);
          Artist artist = artistMapper.toEntity(artistDTO);
          artist = artistRepository.save(artist);
          return artistMapper.toDto(artist);
      }
  
      @Override
      public Optional<ArtistDTO> partialUpdate(ArtistDTO artistDTO) {
          LOG.debug("Request to partially update Artist : {}", artistDTO);
  
          return artistRepository
              .findById(artistDTO.getId())
              .map(existingArtist -> {
                  artistMapper.partialUpdate(existingArtist, artistDTO);
  
                  return existingArtist;
              })
              .map(artistRepository::save)
              .map(artistMapper::toDto);
      }
  
      @Override
      public Page<ArtistDTO> findAll(Pageable pageable) {
          LOG.debug("Request to get all Artists");
          return artistRepository.findAll(pageable).map(artistMapper::toDto);
      }
  
      @Override
      public Optional<ArtistDTO> findOne(String id) {
          LOG.debug("Request to get Artist : {}", id);
          return artistRepository.findById(id).map(artistMapper::toDto);
      }
  
      @Override
      public void delete(String id) {
          LOG.debug("Request to delete Artist : {}", id);
          artistRepository.deleteById(id);
      }
  }
  