-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDataProcessingContextMapperDto.java
More file actions
35 lines (29 loc) · 1.45 KB
/
DataProcessingContextMapperDto.java
File metadata and controls
35 lines (29 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package fr.insee.genesis.controller.mappers;
import fr.insee.genesis.controller.dto.ScheduleDto;
import fr.insee.genesis.domain.model.context.DataProcessingContextModel;
import java.util.ArrayList;
import java.util.List;
public class DataProcessingContextMapperDto {
public ScheduleDto dataProcessingContextToScheduleDto(DataProcessingContextModel dataProcessingContext){
return ScheduleDto.builder()
.surveyName(dataProcessingContext.getPartitionId())
.lastExecution(dataProcessingContext.getLastExecution())
.kraftwerkExecutionScheduleList(dataProcessingContext.getKraftwerkExecutionScheduleList())
.build();
}
public List<ScheduleDto> dataProcessingContextListToScheduleDtoList(List<DataProcessingContextModel> contexts){
List<ScheduleDto> dtos = new ArrayList<>();
for(DataProcessingContextModel context : contexts){
dtos.add(dataProcessingContextToScheduleDto(context));
}
return dtos;
}
public DataProcessingContextModel scheduleDtoToDataProcessingContext (ScheduleDto schedule){
return DataProcessingContextModel.builder()
.partitionId(schedule.surveyName())
.collectionInstrumentId(schedule.collectionInstrumentId())
.lastExecution(schedule.lastExecution())
.kraftwerkExecutionScheduleList(schedule.kraftwerkExecutionScheduleList())
.build();
}
}