FOSSredder 0.5.0
Loading...
Searching...
No Matches
ui::ImportWorkflow Class Reference

Runs PDF imports and holds the active in-memory statement draft session. More...

#include <ImportWorkflow.h>

Inheritance diagram for ui::ImportWorkflow:
Collaboration diagram for ui::ImportWorkflow:

Public Types

using StateSnapshotProvider

Signals

void stateChanged ()
 Emitted when import workflow state changed.
void importFinished ()
 Emitted when an import reached a finished state.
void importCanceled ()
 Emitted when an import was canceled.
void importFailed (const QString &error)
 Emitted when an import failed.

Public Member Functions

 ImportWorkflow (std::shared_ptr< ui::adapters::ImportAdapter > importAdapter, std::shared_ptr< core::ports::diagnostics::IErrorReporter > errorReporter, StateSnapshotProvider stateSnapshotProvider={}, WorkspaceCommands *commands=nullptr, WorkspaceSelectors *selectors=nullptr, QObject *parent=nullptr)
 Creates an import workflow.
 ~ImportWorkflow () override
 Destroys the workflow and its internal state.
void setWorkspaceRoles (WorkspaceCommands *commands, WorkspaceSelectors *selectors)
 Rebinds workspace roles used by the workflow.
bool isRunning () const noexcept
 Reports whether an import is running.
bool isPaused () const noexcept
 Reports whether the running import is paused.
double progress () const noexcept
 Returns import progress.
QString phase () const
 Returns the current import phase text.
QString error () const
 Returns the current import error text.
QString selectedFile () const
 Returns the selected import file.
void setSelectedFile (const QString &path)
 Sets the selected import file.
int queuedCount () const noexcept
 Returns queued import file count.
QStringList queuedFiles () const
 Returns queued import files.
bool hasDraft () const noexcept
 Reports whether an active statement draft exists.
QString currentDraftId () const
 Returns the active draft id.
int currentTransactionIndex () const noexcept
 Returns the selected transaction draft index.
void setCurrentTransactionIndex (int index)
 Selects the current transaction draft by index.
int transactionCount () const noexcept
 Returns transaction count in the active draft.
QString currentStatementName () const
 Returns the editable name of the active statement draft.
void flushActiveDraftToWorkspace ()
 Saves the active in-memory draft into workspace draft state.
bool renameCurrentStatementDraft (const QString &name)
 Renames the active statement draft.
int insertTransactionAfterCurrent ()
 Inserts a transaction draft after the current one.
int removeCurrentTransaction ()
 Removes the current transaction draft.
bool commitCurrentTransactionName (const QString &name)
 Updates the current transaction draft name.
bool commitCurrentTransactionBookingDate (const QString &bookingDate)
 Updates the current transaction draft booking date.
bool commitCurrentTransactionValuta (const QString &valuta)
 Updates the current transaction draft valuta date.
bool setCurrentTransactionStatus (int status)
 Updates the current transaction draft status.
bool setCurrentTransactionAllocatable (bool allocatable)
 Updates the current transaction draft allocatable flag.
bool applyCurrentTransactionAmountText (const QString &amountText)
 Applies user-entered amount text to the current transaction draft.
bool selectCurrentTransactionActor (const QString &actorId)
 Selects an actor for the current transaction draft.
bool clearCurrentTransactionActor ()
 Clears the actor selection for the current transaction draft.
bool setCurrentTransactionPropertySelected (const QString &propertyId, bool selected)
 Selects or deselects a property for the current transaction draft.
bool selectCurrentTransactionContract (const QString &contractId)
 Selects a contract for the current transaction draft.
bool clearCurrentTransactionContract ()
 Clears the contract selection for the current transaction draft.
bool createActorForCurrentTransaction (const QString &actorName)
 Creates or reuses an actor and selects it for the current draft.
bool createPropertyForCurrentTransaction (const QString &propertyName)
 Creates or reuses a property and selects it for the current draft.
bool createOrSelectContractForCurrentTransaction (const QString &contractName, const QString &contractType, const QString &allocatableMode)
 Creates or reuses a contract and selects it for the current draft.
TransactionDraftView currentTransactionView () const
 Builds the QML-facing view of the current transaction draft.
void pauseActiveDraft ()
 Saves the active draft and returns to the import overview.
void discardActiveDraft ()
 Discards the active draft and removes its workspace draft state.
void finalizeActiveDraft ()
 Finalizes the active draft into workspace statement data.
void removeAttachedImportLog (const QString &logId, bool draftAttached, const QString &draftId)
 Removes an import log and optionally its attached draft.
void startStatementImport ()
 Starts importing the selected or next queued statement file.
void addFiles (const QStringList &paths)
 Adds files to the import selection or queue.
void resetStatus ()
 Resets import status fields when no import is running.
void clearDraft ()
 Clears the active draft and may continue queued imports.
bool openStoredDraft (const QString &draftId={})
 Opens a statement draft stored in workspace state.
void cancelImport ()
 Cancels the current running import.
void cancelQueuedImports ()
 Cancels the running import and clears queued imports.
void pauseImport ()
 Pauses the current running import.
void resumeImport ()
 Resumes the current paused import.

Detailed Description

Runs PDF imports and holds the active in-memory statement draft session.

Definition at line 64 of file ImportWorkflow.h.

Member Typedef Documentation

◆ StateSnapshotProvider

Constructor & Destructor Documentation

◆ ImportWorkflow()

ui::ImportWorkflow::ImportWorkflow ( std::shared_ptr< ui::adapters::ImportAdapter > importAdapter,
std::shared_ptr< core::ports::diagnostics::IErrorReporter > errorReporter,
StateSnapshotProvider stateSnapshotProvider = {},
WorkspaceCommands * commands = nullptr,
WorkspaceSelectors * selectors = nullptr,
QObject * parent = nullptr )
explicit

Creates an import workflow.

Parameters
importAdapterAdapter used to invoke the core import runner.
errorReporterError reporter used for workflow exceptions.
stateSnapshotProviderProvider for the current workspace snapshot.
commandsWorkspace commands used for draft/log mutations.
selectorsWorkspace selectors used for log/draft lookups.
parentOptional Qt parent.

Definition at line 395 of file ImportWorkflow.cpp.

◆ ~ImportWorkflow()

ui::ImportWorkflow::~ImportWorkflow ( )
overridedefault

Destroys the workflow and its internal state.

Here is the call graph for this function:

Member Function Documentation

◆ addFiles()

void ui::ImportWorkflow::addFiles ( const QStringList & paths)

Adds files to the import selection or queue.

Parameters
pathsFile paths.

Definition at line 564 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ applyCurrentTransactionAmountText()

bool ui::ImportWorkflow::applyCurrentTransactionAmountText ( const QString & amountText)

Applies user-entered amount text to the current transaction draft.

Parameters
amountTextAmount text.
Returns
True when the draft changed.

Definition at line 1210 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cancelImport()

void ui::ImportWorkflow::cancelImport ( )

Cancels the current running import.

Definition at line 731 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cancelQueuedImports()

void ui::ImportWorkflow::cancelQueuedImports ( )

Cancels the running import and clears queued imports.

Definition at line 737 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearCurrentTransactionActor()

bool ui::ImportWorkflow::clearCurrentTransactionActor ( )

Clears the actor selection for the current transaction draft.

Returns
True when the draft changed.

Definition at line 1244 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearCurrentTransactionContract()

bool ui::ImportWorkflow::clearCurrentTransactionContract ( )

Clears the contract selection for the current transaction draft.

Returns
True when the draft changed.

Definition at line 1297 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearDraft()

void ui::ImportWorkflow::clearDraft ( )

Clears the active draft and may continue queued imports.

Definition at line 582 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ commitCurrentTransactionBookingDate()

bool ui::ImportWorkflow::commitCurrentTransactionBookingDate ( const QString & bookingDate)

Updates the current transaction draft booking date.

Parameters
bookingDateBooking date text.
Returns
True when the draft changed.

Definition at line 1180 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ commitCurrentTransactionName()

bool ui::ImportWorkflow::commitCurrentTransactionName ( const QString & name)

Updates the current transaction draft name.

Parameters
nameTransaction name.
Returns
True when the draft changed.

Definition at line 1173 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ commitCurrentTransactionValuta()

bool ui::ImportWorkflow::commitCurrentTransactionValuta ( const QString & valuta)

Updates the current transaction draft valuta date.

Parameters
valutaValuta date text.
Returns
True when the draft changed.

Definition at line 1188 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createActorForCurrentTransaction()

bool ui::ImportWorkflow::createActorForCurrentTransaction ( const QString & actorName)

Creates or reuses an actor and selects it for the current draft.

Parameters
actorNameActor name.
Returns
True when an actor was selected.

Definition at line 1313 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createOrSelectContractForCurrentTransaction()

bool ui::ImportWorkflow::createOrSelectContractForCurrentTransaction ( const QString & contractName,
const QString & contractType,
const QString & allocatableMode )

Creates or reuses a contract and selects it for the current draft.

Parameters
contractNameContract name.
contractTypeContract type.
allocatableModeAllocatable mode.
Returns
True when a contract was selected.

Definition at line 1346 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ createPropertyForCurrentTransaction()

bool ui::ImportWorkflow::createPropertyForCurrentTransaction ( const QString & propertyName)

Creates or reuses a property and selects it for the current draft.

Parameters
propertyNameProperty name.
Returns
True when a property was selected.

Definition at line 1329 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ currentDraftId()

QString ui::ImportWorkflow::currentDraftId ( ) const

Returns the active draft id.

Returns
Draft id or empty.

Definition at line 1073 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ currentStatementName()

QString ui::ImportWorkflow::currentStatementName ( ) const

Returns the editable name of the active statement draft.

Returns
Statement draft name or empty.

Definition at line 1078 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ currentTransactionIndex()

int ui::ImportWorkflow::currentTransactionIndex ( ) const
noexcept

Returns the selected transaction draft index.

Returns
Zero-based transaction index.

Definition at line 456 of file ImportWorkflow.cpp.

Here is the caller graph for this function:

◆ currentTransactionView()

TransactionDraftView ui::ImportWorkflow::currentTransactionView ( ) const

Builds the QML-facing view of the current transaction draft.

Returns
Transaction draft view payload.

Definition at line 1385 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ discardActiveDraft()

void ui::ImportWorkflow::discardActiveDraft ( )

Discards the active draft and removes its workspace draft state.

Definition at line 509 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ error()

QString ui::ImportWorkflow::error ( ) const

Returns the current import error text.

Returns
Error text or empty.

Definition at line 436 of file ImportWorkflow.cpp.

Here is the caller graph for this function:

◆ finalizeActiveDraft()

void ui::ImportWorkflow::finalizeActiveDraft ( )

Finalizes the active draft into workspace statement data.

Definition at line 522 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ flushActiveDraftToWorkspace()

void ui::ImportWorkflow::flushActiveDraftToWorkspace ( )

Saves the active in-memory draft into workspace draft state.

Definition at line 1422 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hasDraft()

bool ui::ImportWorkflow::hasDraft ( ) const
noexcept

Reports whether an active statement draft exists.

Returns
True when a draft is loaded.

Definition at line 452 of file ImportWorkflow.cpp.

Here is the caller graph for this function:

◆ importCanceled

void ui::ImportWorkflow::importCanceled ( )
signal

Emitted when an import was canceled.

◆ importFailed

void ui::ImportWorkflow::importFailed ( const QString & error)
signal

Emitted when an import failed.

Parameters
errorError message.
Here is the call graph for this function:

◆ importFinished

void ui::ImportWorkflow::importFinished ( )
signal

Emitted when an import reached a finished state.

◆ insertTransactionAfterCurrent()

int ui::ImportWorkflow::insertTransactionAfterCurrent ( )

Inserts a transaction draft after the current one.

Returns
New selected transaction index or -1.

Definition at line 1123 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isPaused()

bool ui::ImportWorkflow::isPaused ( ) const
noexcept

Reports whether the running import is paused.

Returns
True while paused.

Definition at line 424 of file ImportWorkflow.cpp.

Here is the caller graph for this function:

◆ isRunning()

bool ui::ImportWorkflow::isRunning ( ) const
noexcept

Reports whether an import is running.

Returns
True while running.

Definition at line 420 of file ImportWorkflow.cpp.

◆ openStoredDraft()

bool ui::ImportWorkflow::openStoredDraft ( const QString & draftId = {})

Opens a statement draft stored in workspace state.

Parameters
draftIdDraft id; empty selects the remembered or first attached draft.
Returns
True when a draft was restored.

Definition at line 982 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pauseActiveDraft()

void ui::ImportWorkflow::pauseActiveDraft ( )

Saves the active draft and returns to the import overview.

Definition at line 498 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pauseImport()

void ui::ImportWorkflow::pauseImport ( )

Pauses the current running import.

Definition at line 777 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ phase()

QString ui::ImportWorkflow::phase ( ) const

Returns the current import phase text.

Returns
Phase text.

Definition at line 432 of file ImportWorkflow.cpp.

Here is the caller graph for this function:

◆ progress()

double ui::ImportWorkflow::progress ( ) const
noexcept

Returns import progress.

Returns
Progress in the range 0..1.

Definition at line 428 of file ImportWorkflow.cpp.

Here is the caller graph for this function:

◆ queuedCount()

int ui::ImportWorkflow::queuedCount ( ) const
noexcept

Returns queued import file count.

Returns
Queue size.

Definition at line 444 of file ImportWorkflow.cpp.

Here is the caller graph for this function:

◆ queuedFiles()

QStringList ui::ImportWorkflow::queuedFiles ( ) const

Returns queued import files.

Returns
Queued file paths.

Definition at line 448 of file ImportWorkflow.cpp.

Here is the caller graph for this function:

◆ removeAttachedImportLog()

void ui::ImportWorkflow::removeAttachedImportLog ( const QString & logId,
bool draftAttached,
const QString & draftId )

Removes an import log and optionally its attached draft.

Parameters
logIdImport log id.
draftAttachedWhether the log points to a draft.
draftIdAttached draft id.

Definition at line 552 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeCurrentTransaction()

int ui::ImportWorkflow::removeCurrentTransaction ( )

Removes the current transaction draft.

Returns
New selected transaction index or -1.

Definition at line 1140 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ renameCurrentStatementDraft()

bool ui::ImportWorkflow::renameCurrentStatementDraft ( const QString & name)

Renames the active statement draft.

Parameters
nameNew statement draft name.
Returns
True when the draft changed.

Definition at line 1108 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetStatus()

void ui::ImportWorkflow::resetStatus ( )

Resets import status fields when no import is running.

Definition at line 576 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resumeImport()

void ui::ImportWorkflow::resumeImport ( )

Resumes the current paused import.

Definition at line 781 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ selectCurrentTransactionActor()

bool ui::ImportWorkflow::selectCurrentTransactionActor ( const QString & actorId)

Selects an actor for the current transaction draft.

Parameters
actorIdActor id.
Returns
True when the draft changed.

Definition at line 1227 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ selectCurrentTransactionContract()

bool ui::ImportWorkflow::selectCurrentTransactionContract ( const QString & contractId)

Selects a contract for the current transaction draft.

Parameters
contractIdContract id.
Returns
True when the draft changed.

Definition at line 1279 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ selectedFile()

QString ui::ImportWorkflow::selectedFile ( ) const

Returns the selected import file.

Returns
Selected file path.

Definition at line 440 of file ImportWorkflow.cpp.

Here is the caller graph for this function:

◆ setCurrentTransactionAllocatable()

bool ui::ImportWorkflow::setCurrentTransactionAllocatable ( bool allocatable)

Updates the current transaction draft allocatable flag.

Parameters
allocatableAllocatable flag.
Returns
True when the draft changed.

Definition at line 1202 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCurrentTransactionIndex()

void ui::ImportWorkflow::setCurrentTransactionIndex ( int index)

Selects the current transaction draft by index.

Parameters
indexZero-based transaction index.

Definition at line 1093 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCurrentTransactionPropertySelected()

bool ui::ImportWorkflow::setCurrentTransactionPropertySelected ( const QString & propertyId,
bool selected )

Selects or deselects a property for the current transaction draft.

Parameters
propertyIdProperty id.
selectedWhether the property should be selected.
Returns
True when the draft changed.

Definition at line 1260 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCurrentTransactionStatus()

bool ui::ImportWorkflow::setCurrentTransactionStatus ( int status)

Updates the current transaction draft status.

Parameters
statusTransaction status.
Returns
True when the draft changed.

Definition at line 1195 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSelectedFile()

void ui::ImportWorkflow::setSelectedFile ( const QString & path)

Sets the selected import file.

Parameters
pathImport file path.

Definition at line 570 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setWorkspaceRoles()

void ui::ImportWorkflow::setWorkspaceRoles ( WorkspaceCommands * commands,
WorkspaceSelectors * selectors )

Rebinds workspace roles used by the workflow.

Parameters
commandsWorkspace commands.
selectorsWorkspace selectors.

Definition at line 413 of file ImportWorkflow.cpp.

Here is the call graph for this function:

◆ startStatementImport()

void ui::ImportWorkflow::startStatementImport ( )

Starts importing the selected or next queued statement file.

Definition at line 613 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ stateChanged

void ui::ImportWorkflow::stateChanged ( )
signal

Emitted when import workflow state changed.

Here is the caller graph for this function:

◆ transactionCount()

int ui::ImportWorkflow::transactionCount ( ) const
noexcept

Returns transaction count in the active draft.

Returns
Transaction count.

Definition at line 1062 of file ImportWorkflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: