Skip to content

Commit

Permalink
Export DataObject and BusinessObject in full export feature (UI)
Browse files Browse the repository at this point in the history
Fix #145
  • Loading branch information
mauvaisetroupe committed Apr 21, 2024
1 parent 27aea10 commit c3e16c6
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,11 @@ public ByteArrayOutputStream getallData(
) throws IOException {
Workbook workbook = new XSSFWorkbook();
Sheet summarySheet = workbook.createSheet(SummaryImporterService.SUMMARY_SHEET);
Sheet appliSheet = workbook.createSheet(ApplicationImportService.APPLICATION_SHEET_NAME);
Sheet componentSheet = workbook.createSheet(ComponentImportService.COMPONENT_SHEET_NAME);
Sheet ownerSheet = workbook.createSheet(ApplicationImportService.OWNER_SHEET_NAME);
Sheet externalSystemSheet = workbook.createSheet(ExternalSystemImportService.SHEET_NAME);
Sheet capabilitiesSheet = workbook.createSheet(CapabilityImportService.CAPABILITY_SHEET_NAME);
Sheet businessObjectsSheet = workbook.createSheet(DataObjectImportService.DATA_OBJECT_SHEET_NAME);

Sheet appliSheet = null;
Sheet componentSheet = null;
Sheet ownerSheet = null;
Sheet externalSystemSheet = null;

int lineNb = 0;
int nbcolumn = 0;
Expand All @@ -83,36 +82,32 @@ public ByteArrayOutputStream getallData(

// External Systems
if (exportExternalSystem) {
externalSystemSheet = workbook.createSheet(ExternalSystemImportService.SHEET_NAME);
externalSystemExportService.writeExternalSytemSheet(externalSystemSheet, workbook);
ExcelUtils.autoSizeAllColumns(externalSystemSheet);
ExcelUtils.addHeaderColorAndFilte(workbook, externalSystemSheet);
}

// Application, ApplicationComponent, Owner & ExternalSystem
if (exportApplications) {
appliSheet = workbook.createSheet(ApplicationImportService.APPLICATION_SHEET_NAME);
applicationExportService.writeApplication(appliSheet);
ExcelUtils.autoSizeAllColumns(appliSheet);
ExcelUtils.addHeaderColorAndFilte(workbook, appliSheet);
}
if (exportComponents) {
componentSheet = workbook.createSheet(ComponentImportService.COMPONENT_SHEET_NAME);
applicationExportService.writeComponent(componentSheet);
ExcelUtils.autoSizeAllColumns(componentSheet);
ExcelUtils.addHeaderColorAndFilte(workbook, componentSheet);
}
if (exportOwner) {
ownerSheet = workbook.createSheet(ApplicationImportService.OWNER_SHEET_NAME);
applicationExportService.writeOwner(ownerSheet);
ExcelUtils.autoSizeAllColumns(ownerSheet);
ExcelUtils.addHeaderColorAndFilte(workbook, ownerSheet);
}
addApplicationSummary(
workbook,
summarySheet,
appliSheet.getSheetName(),
componentSheet.getSheetName(),
ownerSheet.getSheetName(),
externalSystemSheet.getSheetName(),
lineNb
);
addApplicationSummary(workbook, summarySheet, appliSheet, componentSheet, ownerSheet, externalSystemSheet, lineNb);
lineNb += 4;

// Landcsacpes
Expand Down Expand Up @@ -147,6 +142,7 @@ public ByteArrayOutputStream getallData(

// Capabilities
if (exportCapabilities) {
Sheet capabilitiesSheet = workbook.createSheet(CapabilityImportService.CAPABILITY_SHEET_NAME);
capabilityExportService.writeCapabilities(capabilitiesSheet, workbook);
ExcelUtils.autoSizeAllColumns(capabilitiesSheet);
ExcelUtils.addHeaderColorAndFilte(workbook, capabilitiesSheet);
Expand All @@ -164,6 +160,7 @@ public ByteArrayOutputStream getallData(

// Business and Data Objects
if (businessAndDataObjects) {
Sheet businessObjectsSheet = workbook.createSheet(DataObjectImportService.DATA_OBJECT_SHEET_NAME);
addBusinessAndDataObjectsSummary(workbook, summarySheet, businessObjectsSheet.getSheetName(), lineNb);
businessAndDataObjectExportService.writeDatObjects(businessObjectsSheet);
ExcelUtils.autoSizeAllColumns(businessObjectsSheet);
Expand All @@ -185,35 +182,43 @@ public ByteArrayOutputStream getallData(
private void addApplicationSummary(
Workbook workbook,
Sheet summarySheet,
String appSheet,
String componentSheet,
String ownerSheet,
String externalSystemSheet,
Sheet appSheet,
Sheet componentSheet,
Sheet ownerSheet,
Sheet externalSystemSheet,
int lineNb
) {
Row row = summarySheet.createRow(lineNb++);
int columnNb = 0;
row.createCell(columnNb++).setCellValue("Application");
Cell cell = row.createCell(columnNb++);
createHyperlink(workbook, appSheet, cell);

row = summarySheet.createRow(lineNb++);
columnNb = 0;
row.createCell(columnNb++).setCellValue("Application Component");
cell = row.createCell(columnNb++);
createHyperlink(workbook, componentSheet, cell);

row = summarySheet.createRow(lineNb++);
columnNb = 0;
row.createCell(columnNb++).setCellValue("Owner");
cell = row.createCell(columnNb++);
createHyperlink(workbook, ownerSheet, cell);

row = summarySheet.createRow(lineNb++);
columnNb = 0;
row.createCell(columnNb++).setCellValue("ExternalSystem");
cell = row.createCell(columnNb++);
createHyperlink(workbook, externalSystemSheet, cell);
if (appSheet != null) {
Row row = summarySheet.createRow(lineNb++);
row.createCell(columnNb++).setCellValue("Application");
Cell cell = row.createCell(columnNb++);
createHyperlink(workbook, appSheet.getSheetName(), cell);
}

if (componentSheet != null) {
Row row = summarySheet.createRow(lineNb++);
columnNb = 0;
row.createCell(columnNb++).setCellValue("Application Component");
Cell cell = row.createCell(columnNb++);
createHyperlink(workbook, componentSheet.getSheetName(), cell);
}

if (ownerSheet != null) {
Row row = summarySheet.createRow(lineNb++);
columnNb = 0;
row.createCell(columnNb++).setCellValue("Owner");
Cell cell = row.createCell(columnNb++);
createHyperlink(workbook, ownerSheet.getSheetName(), cell);
}

if (externalSystemSheet != null) {
Row row = summarySheet.createRow(lineNb++);
columnNb = 0;
row.createCell(columnNb++).setCellValue("ExternalSystem");
Cell cell = row.createCell(columnNb++);
createHyperlink(workbook, externalSystemSheet.getSheetName(), cell);
}
}

private void addSummryFlow(Workbook workbook, Sheet summarySheet, LandscapeView landscape, String flowSheetName, int lineNb) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export default defineComponent({
const capabilitiesMappingWithNoLandscape = ref(true);
const functionalFlowsWhithNoLandscape = ref(true);
const submited = ref(false);
const businessAndDataObjects = ref(true);

onMounted(async () => {
await retrieveAllLandscapeViews();
Expand Down Expand Up @@ -93,6 +94,7 @@ export default defineComponent({
checkedCapabilitiesMapping.value.map(l => l.id),
capabilitiesMappingWithNoLandscape.value,
functionalFlowsWhithNoLandscape.value,
businessAndDataObjects.value,
)
.then(
response => {
Expand Down Expand Up @@ -137,6 +139,7 @@ export default defineComponent({
selectNoMapping,
checkCapa,
exportExcel,
businessAndDataObjects,
};
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default class FullExportService {
capabilitiesMapping: number[],
capabilitiesMappingWithNoLandscape: boolean,
functionalFlowsWhithNoLandscape: boolean,
businessAndDataObjects: boolean,
): Promise<any> {
return new Promise<any>((resolve, reject) => {
axios
Expand All @@ -29,6 +30,7 @@ export default class FullExportService {
capabilitiesMapping: capabilitiesMapping,
capabilitiesMappingWithNoLandscape: capabilitiesMappingWithNoLandscape,
functionalFlowsWhithNoLandscape: functionalFlowsWhithNoLandscape,
businessAndDataObjects: businessAndDataObjects,
},
})
.then(res => {
Expand Down
7 changes: 7 additions & 0 deletions src/main/webapp/app/eadesignit/full-export/full-export.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@
<label>Capabilities</label>
</div>
</div>
<h3>Business & Data Objects</h3>
<div class="row m-3">
<div class="col-4">
<input type="checkbox" v-model="businessAndDataObjects" />
<label>Business & Data Objects</label>
</div>
</div>
<div>
<h3>Capabilities In Landscape</h3>
[<a @click="selectAllMapping">Select All</a>] [<a @click="selectNoMapping">Select None</a>]
Expand Down

0 comments on commit c3e16c6

Please sign in to comment.