Total Complexity | 4 |
Total Lines | 23 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | package com.hltech.judged.server.infrastructure.environment; |
||
10 | @Repository |
||
11 | public class JPAEnvironmentRepository implements EnvironmentRepository { |
||
12 | |||
13 | private SpringDataEnvironmentRepository springDataEnvironmentRepository; |
||
14 | |||
15 | @Autowired |
||
16 | public JPAEnvironmentRepository(SpringDataEnvironmentRepository springDataEnvironmentRepository) { |
||
17 | this.springDataEnvironmentRepository = springDataEnvironmentRepository; |
||
18 | } |
||
19 | |||
20 | @Override |
||
21 | public EnvironmentAggregate persist(EnvironmentAggregate environment) { |
||
22 | return springDataEnvironmentRepository.saveAndFlush(environment); |
||
23 | } |
||
24 | |||
25 | @Override |
||
26 | public Set<String> getNames() { |
||
27 | return springDataEnvironmentRepository.getNames(); |
||
28 | } |
||
29 | |||
30 | @Override |
||
31 | public EnvironmentAggregate get(String name) { |
||
32 | return springDataEnvironmentRepository.findById(name).orElse(EnvironmentAggregate.empty(name)); |
||
33 | } |
||
35 |