modified to consider the topic information

This commit is contained in:
Miriam Baglioni 2020-09-24 15:20:56 +02:00
parent 609ff17cfc
commit 15af1f527e
1 changed files with 16 additions and 0 deletions

View File

@ -97,10 +97,26 @@ public class PrepareProjects {
if (csvProject.isPresent()) { if (csvProject.isPresent()) {
String[] programme = csvProject.get().getProgramme().split(";"); String[] programme = csvProject.get().getProgramme().split(";");
String topic = csvProject.get().getTopics();
String topicdescription = Optional
.ofNullable(csvProject.get().getTopics())
.map(topics -> {
if (topic.equalsIgnoreCase(value._1().getTopiccode())) {
return value._1().getTopicdescription();
}
return null;
})
.orElse(null);
Arrays Arrays
.stream(programme) .stream(programme)
.forEach(p -> { .forEach(p -> {
CSVProject proj = new CSVProject(); CSVProject proj = new CSVProject();
proj.setTopics(topic);
if (topicdescription != null) {
proj.setTopicdescription(topicdescription);
}
proj.setProgramme(p); proj.setProgramme(p);
proj.setId(csvProject.get().getId()); proj.setId(csvProject.get().getId());
csvProjectList.add(proj); csvProjectList.add(proj);