use of org.apache.isis.applib.annotation.CollectionLayout in project estatio by estatio.
the class ChargeImportManager method importBlob.
// region > importBlob (action)
@Action(publishing = Publishing.DISABLED, semantics = SemanticsOf.IDEMPOTENT)
@CollectionLayout(paged = -1)
public List<ChargeImport> importBlob(@Parameter(fileAccept = ".xlsx") @ParameterLayout(named = "Excel spreadsheet") final Blob spreadsheet) {
List<ChargeImport> lineItems = excelService.fromExcel(spreadsheet, ChargeImport.class, ChargeImport.class.getSimpleName());
ChargeImport previous = null;
for (ChargeImport lineItem : lineItems) {
lineItem.importData(previous);
previous = lineItem;
}
return lineItems;
}
use of org.apache.isis.applib.annotation.CollectionLayout in project estatio by estatio.
the class BudgetImportExportManager method importBudget.
@Action(publishing = Publishing.DISABLED, semantics = SemanticsOf.IDEMPOTENT)
@ActionLayout()
@CollectionLayout()
public Budget importBudget(@Parameter(fileAccept = ".xlsx") @ParameterLayout(named = "Excel spreadsheet") final Blob spreadsheet) {
WorksheetSpec spec1 = new WorksheetSpec(BudgetImportExport.class, "budget");
WorksheetSpec spec2 = new WorksheetSpec(KeyItemImportExportLineItem.class, "keyItems");
WorksheetSpec spec3 = new WorksheetSpec(BudgetOverrideImportExport.class, "overrides");
WorksheetSpec spec4 = new WorksheetSpec(ChargeImport.class, "charges");
List<List<?>> objects = excelService.fromExcel(spreadsheet, Arrays.asList(spec1, spec2, spec3, spec4));
// first upsert charges
List<ChargeImport> chargeImportLines = (List<ChargeImport>) objects.get(3);
for (ChargeImport lineItem : chargeImportLines) {
lineItem.importData(null);
}
// import budget en items
List<BudgetImportExport> budgetItemLines = importBudgetAndItems(objects);
// import keyTables
importKeyTables(budgetItemLines, objects);
// import overrides
importOverrides(objects);
return getBudget();
}
Aggregations