Skip to content

Instantly share code, notes, and snippets.

@0001vrn
Created April 11, 2020 10:26
Show Gist options
  • Save 0001vrn/4234aaaa559ad9772cadc7f1dc3b55c9 to your computer and use it in GitHub Desktop.
Save 0001vrn/4234aaaa559ad9772cadc7f1dc3b55c9 to your computer and use it in GitHub Desktop.
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