Skip to content

Commit

Permalink
Business/Data objects export - add missing landscape columns
Browse files Browse the repository at this point in the history
Fix #154
  • Loading branch information
mauvaisetroupe committed Apr 21, 2024
1 parent afd397c commit a7e91f7
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.mauvaisetroupe.eadesignit.domain.BusinessObject;
import com.mauvaisetroupe.eadesignit.domain.DataObject;
import com.mauvaisetroupe.eadesignit.domain.LandscapeView;
import com.mauvaisetroupe.eadesignit.repository.BusinessObjectRepository;
import com.mauvaisetroupe.eadesignit.repository.DataObjectRepository;
import com.mauvaisetroupe.eadesignit.service.importfile.util.ExcelUtils;
Expand Down Expand Up @@ -54,6 +55,11 @@ protected void writeDatObjects(Sheet sheet) {
headerRow.createCell(column++).setCellValue(DataObjectImportService.DATA_OBJECT_APPLICATION);

List<DataObject> dataObjects = dataObjectRepository.findAllWithAllChildrens();
int maxNbLandscape = dataObjects.stream().map(dob -> dob.getLandscapes().size()).mapToInt(v -> v).max().orElse(0);
for (int i = 1; i < maxNbLandscape + 1; i++) {
headerRow.createCell(column++).setCellValue(DataObjectImportService.LANDSCAPE_NAME_PREFIX + i);
}

for (DataObject datObject : dataObjects) {
column = 0;
Row row = sheet.createRow(rownb++);
Expand All @@ -75,9 +81,14 @@ protected void writeDatObjects(Sheet sheet) {
}
column++;
if (datObject.getApplication() != null) {
row.createCell(column++).setCellValue(datObject.getApplication().getName());
row.createCell(column).setCellValue(datObject.getApplication().getName());
}
column++;
if (datObject.getLandscapes() != null) {
for (LandscapeView landscape : datObject.getLandscapes()) {
row.createCell(column++).setCellValue(landscape.getDiagramName());
}
}
}

List<BusinessObject> orphanBusinessObjects = businessObjectRepository
Expand Down

0 comments on commit a7e91f7

Please sign in to comment.