Search in sources :

Example 1 with InsertAction

use of name.abuchen.portfolio.datatransfer.actions.InsertAction in project portfolio by buchen.

the class CSVImportWizard method importItems.

private boolean importItems() {
    InsertAction action = new InsertAction(client);
    action.setConvertBuySellToDelivery(reviewPage.doConvertToDelivery());
    boolean isDirty = false;
    for (ExtractedEntry entry : reviewPage.getEntries()) {
        if (entry.isImported()) {
            entry.getItem().apply(action, reviewPage);
            isDirty = true;
        }
    }
    return isDirty;
}
Also used : InsertAction(name.abuchen.portfolio.datatransfer.actions.InsertAction)

Example 2 with InsertAction

use of name.abuchen.portfolio.datatransfer.actions.InsertAction in project portfolio by buchen.

the class ImportExtractedItemsWizard method performFinish.

@Override
public boolean performFinish() {
    if (!pages.isEmpty()) {
        boolean isDirty = false;
        for (int index = 0; index < pages.size(); index++) {
            ReviewExtractedItemsPage page = pages.get(index);
            page.afterPage();
            InsertAction action = new InsertAction(client);
            action.setConvertBuySellToDelivery(page.doConvertToDelivery());
            for (ExtractedEntry entry : page.getEntries()) {
                if (entry.isImported()) {
                    entry.getItem().apply(action, page);
                    isDirty = true;
                }
            }
        }
        if (isDirty) {
            client.markDirty();
            // run consistency checks in case bogus transactions have been
            // created (say: an outbound delivery of a security where there
            // no held shares)
            new ConsistencyChecksJob(client, false).schedule();
        }
    }
    return true;
}
Also used : ConsistencyChecksJob(name.abuchen.portfolio.ui.ConsistencyChecksJob) InsertAction(name.abuchen.portfolio.datatransfer.actions.InsertAction)

Aggregations

InsertAction (name.abuchen.portfolio.datatransfer.actions.InsertAction)2 ConsistencyChecksJob (name.abuchen.portfolio.ui.ConsistencyChecksJob)1