Created
April 11, 2020 10:26
-
-
Save 0001vrn/4234aaaa559ad9772cadc7f1dc3b55c9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CassandraDbChgRequestRepository implements ChgRequestRepository { | |
private final SpringDataCassandraChgRequestRepository chgRequestRepository; | |
@Autowired | |
public CassandraDbChgRequestRepository(SpringDataCassandraChgRequestRepository chgRequestRepository) { | |
this.chgRequestRepository = chgRequestRepository; | |
} | |
@Override | |
public List<ChgRequest> findAll() { | |
return chgRequestRepository.findAll() | |
.stream() | |
.map(ChgRequestEntity::toChgRequest) | |
.collect(Collectors.toList()); | |
} | |
@Override | |
public Optional<ChgRequest> findById(UUID id) { | |
var maybeChgRequestEntity = chgRequestRepository.findById(id); | |
return maybeChgRequestEntity.map(ChgRequestEntity::toChgRequest); | |
} | |
@Override | |
public void save(ChgRequest chgRequest) { | |
chgRequestRepository.save(new ChgRequestEntity(chgRequest)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment