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

Maps UI intent to core workspace writer commands. More...

#include <WorkspaceCommands.h>

Inheritance diagram for ui::WorkspaceCommands:
Collaboration diagram for ui::WorkspaceCommands:

Signals

void operationSucceeded (const QString &operation)
 Emitted when a storage command completed.
void operationFailed (const QString &operation, const QString &error)
 Emitted when a storage command failed.

Public Member Functions

 WorkspaceCommands (WorkspaceStore &store, QObject *parent=nullptr)
 Creates workspace commands for a store.
std::optional< core::ports::workspace::StatementDraftSnapshot > statementDraftSnapshot (const QString &draftId={}) const
 Reads a statement draft snapshot from workspace state.
QString finalizeStatementDraft (const core::ports::workspace::StatementDraftSnapshot &draft)
 Finalizes a statement draft through the workspace writer.
void saveStatementDraft (const core::ports::workspace::StatementDraftSnapshot &draft)
 Saves a statement draft in workspace state.
void clearStatementDraft (const QString &draftId={})
 Removes a statement draft from workspace state.
void upsertImportLog (const QString &logId, const QString &status, const QString &message, bool draftAttached, const QString &draftId={}, const QString &statementId={}, const QString &importFile={})
 Creates or updates an import log row.
void deleteImportLog (const QString &id)
 Deletes an import log.
void saveExportLog (const core::ports::workspace::ExportLogSnapshot &log)
 Saves an export log in workspace state.
void deleteExportLog (const QString &id)
 Deletes an export log.
void newFile (const QString &path)
 Creates a new workspace file.
void openFile (const QString &path)
 Opens an existing workspace file.
void saveFile ()
 Saves the current workspace file.
void saveFileAs (const QString &path)
 Saves the current workspace file to a new path.
void setBeforeStorageSaveCallback (std::function< void()> callback)
 Registers an optional hook executed immediately before storage save.
QString saveActor (const QString &id, const QString &name, const QStringList &aliases={}, const QStringList &contractIds={})
 Creates or updates an actor.
void deleteActor (const QString &id)
 Deletes an actor.
QString saveProperty (const QString &id, const QString &name, const QStringList &aliases={}, const QStringList &contractIds={})
 Creates or updates a property.
void deleteProperty (const QString &id)
 Deletes a property.
QString saveContract (const QString &id, const QString &name, const QString &type, const QStringList &actorIds={}, const QStringList &propertyIds={}, const QStringList &aliases={}, const QString &allocatableMode=QStringLiteral("mixed"))
 Creates or updates a contract.
void deleteContract (const QString &id)
 Deletes a contract.
QString addStatement (const QString &name)
 Creates a statement.
QString addStatementWithTransactions (const QString &name, const QVariantList &transactionStates)
 Creates a statement and its transactions in one workspace mutation.
void updateStatement (const QString &id, const QString &name)
 Updates a statement.
void deleteStatement (const QString &id)
 Deletes a statement.
QString addTransaction (const QString &name, const QString &bookingDate, const QString &valuta, const QVariant &amount, const QString &statementId, int status=0, const QString &actorId=QString(), const QString &contractId=QString(), bool allocatable=false, const QStringList &propertyIds={})
 Creates a transaction.
QString insertTransactionAfter (const QString &afterTransactionId, const QString &name, const QString &bookingDate, const QString &valuta, const QVariant &amount, const QString &statementId, int status=0, const QString &actorId=QString(), const QString &contractId=QString(), bool allocatable=false, const QStringList &propertyIds={})
 Creates a transaction after another transaction.
void updateTransaction (const QString &id, const QString &name, const QString &bookingDate, const QString &valuta, const QVariant &amount, const QString &statementId, int status, const QString &actorId, const QString &contractId, bool allocatable, const QStringList &propertyIds)
 Updates a transaction.
void deleteTransaction (const QString &id)
 Deletes a transaction.
QString addAnalysis (const QString &name, const QString &type, const QVariantMap &config, const QVariantMap &filter, const QString &exportFormat, bool includeCalcAdjustments, const QVariantList &snapshotTransactions, const QVariantMap &adjustments={})
 Creates an analysis.
void updateAnalysis (const QString &id, const QString &name, const QString &type, const QVariantMap &config, const QVariantMap &filter, const QString &exportFormat, bool includeCalcAdjustments, const QVariantList &snapshotTransactions, const QVariantMap &adjustments={})
 Updates an analysis.
void deleteAnalysis (const QString &id)
 Deletes an analysis.
void updateAnalysisExportFormat (const QString &analysisId, const QString &exportFormat)
 Updates only the stored export format of an analysis.
QString addAnnual (const QString &name, int year, const QStringList &analysisIds={})
 Creates an annual.
void updateAnnual (const QString &id, const QString &name, int year, const QStringList &analysisIds={})
 Updates an annual.
void deleteAnnual (const QString &id)
 Deletes an annual.

Detailed Description

Maps UI intent to core workspace writer commands.

Definition at line 25 of file ui/include/ui/workspace/WorkspaceCommands.h.

Constructor & Destructor Documentation

◆ WorkspaceCommands()

ui::WorkspaceCommands::WorkspaceCommands ( WorkspaceStore & store,
QObject * parent = nullptr )
explicit

Creates workspace commands for a store.

Parameters
storeWorkspace store owning ports and snapshot refresh state.
parentOptional Qt parent.

Definition at line 241 of file WorkspaceCommands.cpp.

Member Function Documentation

◆ addAnalysis()

QString ui::WorkspaceCommands::addAnalysis ( const QString & name,
const QString & type,
const QVariantMap & config,
const QVariantMap & filter,
const QString & exportFormat,
bool includeCalcAdjustments,
const QVariantList & snapshotTransactions,
const QVariantMap & adjustments = {} )

Creates an analysis.

Parameters
nameAnalysis name.
typeAnalysis type.
configAnalysis configuration payload.
filterAnalysis filter payload.
exportFormatExport format.
includeCalcAdjustmentsWhether calculation adjustments are included.
snapshotTransactionsFrozen transaction snapshot rows.
adjustmentsAdjustment amount map.
Returns
Created analysis id or an empty string.

Definition at line 704 of file WorkspaceCommands.cpp.

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

◆ addAnnual()

QString ui::WorkspaceCommands::addAnnual ( const QString & name,
int year,
const QStringList & analysisIds = {} )

Creates an annual.

Parameters
nameAnnual name.
yearAnnual year.
analysisIdsAssigned analysis ids.
Returns
Created annual id or an empty string.

Definition at line 794 of file WorkspaceCommands.cpp.

◆ addStatement()

QString ui::WorkspaceCommands::addStatement ( const QString & name)

Creates a statement.

Parameters
nameStatement name.
Returns
Created statement id or an empty string.

Definition at line 562 of file WorkspaceCommands.cpp.

Here is the call graph for this function:

◆ addStatementWithTransactions()

QString ui::WorkspaceCommands::addStatementWithTransactions ( const QString & name,
const QVariantList & transactionStates )

Creates a statement and its transactions in one workspace mutation.

Parameters
nameStatement name.
transactionStatesTransaction form state rows.
Returns
Created statement id or an empty string.

Definition at line 578 of file WorkspaceCommands.cpp.

Here is the call graph for this function:

◆ addTransaction()

QString ui::WorkspaceCommands::addTransaction ( const QString & name,
const QString & bookingDate,
const QString & valuta,
const QVariant & amount,
const QString & statementId,
int status = 0,
const QString & actorId = QString(),
const QString & contractId = QString(),
bool allocatable = false,
const QStringList & propertyIds = {} )

Creates a transaction.

Parameters
nameTransaction name.
bookingDateBooking date text.
valutaValuta date text.
amountRaw UI amount value.
statementIdOwning statement id.
statusTransaction status.
actorIdLinked actor id.
contractIdLinked contract id.
allocatableAllocatable flag.
propertyIdsLinked property ids.
Returns
Created transaction id or an empty string.

Definition at line 636 of file WorkspaceCommands.cpp.

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

◆ clearStatementDraft()

void ui::WorkspaceCommands::clearStatementDraft ( const QString & draftId = {})

Removes a statement draft from workspace state.

Parameters
draftIdDraft id; empty allows the writer default.

Definition at line 317 of file WorkspaceCommands.cpp.

Here is the call graph for this function:

◆ deleteActor()

void ui::WorkspaceCommands::deleteActor ( const QString & id)

Deletes an actor.

Parameters
idActor id.

Definition at line 466 of file WorkspaceCommands.cpp.

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

◆ deleteAnalysis()

void ui::WorkspaceCommands::deleteAnalysis ( const QString & id)

Deletes an analysis.

Parameters
idAnalysis id.

Definition at line 747 of file WorkspaceCommands.cpp.

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

◆ deleteAnnual()

void ui::WorkspaceCommands::deleteAnnual ( const QString & id)

Deletes an annual.

Parameters
idAnnual id.

Definition at line 823 of file WorkspaceCommands.cpp.

Here is the call graph for this function:

◆ deleteContract()

void ui::WorkspaceCommands::deleteContract ( const QString & id)

Deletes a contract.

Parameters
idContract id.

Definition at line 545 of file WorkspaceCommands.cpp.

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

◆ deleteExportLog()

void ui::WorkspaceCommands::deleteExportLog ( const QString & id)

Deletes an export log.

Parameters
idExport log id.

Definition at line 396 of file WorkspaceCommands.cpp.

Here is the call graph for this function:

◆ deleteImportLog()

void ui::WorkspaceCommands::deleteImportLog ( const QString & id)

Deletes an import log.

Parameters
idImport log id.

Definition at line 378 of file WorkspaceCommands.cpp.

Here is the call graph for this function:

◆ deleteProperty()

void ui::WorkspaceCommands::deleteProperty ( const QString & id)

Deletes a property.

Parameters
idProperty id.

Definition at line 503 of file WorkspaceCommands.cpp.

Here is the call graph for this function:

◆ deleteStatement()

void ui::WorkspaceCommands::deleteStatement ( const QString & id)

Deletes a statement.

Parameters
idStatement id.

Definition at line 616 of file WorkspaceCommands.cpp.

Here is the call graph for this function:

◆ deleteTransaction()

void ui::WorkspaceCommands::deleteTransaction ( const QString & id)

Deletes a transaction.

Parameters
idTransaction id.

Definition at line 697 of file WorkspaceCommands.cpp.

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

◆ finalizeStatementDraft()

QString ui::WorkspaceCommands::finalizeStatementDraft ( const core::ports::workspace::StatementDraftSnapshot & draft)

Finalizes a statement draft through the workspace writer.

Parameters
draftDraft snapshot to finalize.
Returns
Created statement id or an empty string.

Definition at line 293 of file WorkspaceCommands.cpp.

◆ insertTransactionAfter()

QString ui::WorkspaceCommands::insertTransactionAfter ( const QString & afterTransactionId,
const QString & name,
const QString & bookingDate,
const QString & valuta,
const QVariant & amount,
const QString & statementId,
int status = 0,
const QString & actorId = QString(),
const QString & contractId = QString(),
bool allocatable = false,
const QStringList & propertyIds = {} )

Creates a transaction after another transaction.

Parameters
afterTransactionIdTransaction id used as insertion anchor.
nameTransaction name.
bookingDateBooking date text.
valutaValuta date text.
amountRaw UI amount value.
statementIdOwning statement id.
statusTransaction status.
actorIdLinked actor id.
contractIdLinked contract id.
allocatableAllocatable flag.
propertyIdsLinked property ids.
Returns
Created transaction id or an empty string.

Definition at line 657 of file WorkspaceCommands.cpp.

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

◆ newFile()

void ui::WorkspaceCommands::newFile ( const QString & path)

Creates a new workspace file.

Parameters
pathTarget file path.

Definition at line 403 of file WorkspaceCommands.cpp.

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

◆ openFile()

void ui::WorkspaceCommands::openFile ( const QString & path)

Opens an existing workspace file.

Parameters
pathSource file path.

Definition at line 409 of file WorkspaceCommands.cpp.

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

◆ operationFailed

void ui::WorkspaceCommands::operationFailed ( const QString & operation,
const QString & error )
signal

Emitted when a storage command failed.

Parameters
operationStorage operation name.
errorError message.
Here is the caller graph for this function:

◆ operationSucceeded

void ui::WorkspaceCommands::operationSucceeded ( const QString & operation)
signal

Emitted when a storage command completed.

Parameters
operationStorage operation name.
Here is the caller graph for this function:

◆ saveActor()

QString ui::WorkspaceCommands::saveActor ( const QString & id,
const QString & name,
const QStringList & aliases = {},
const QStringList & contractIds = {} )

Creates or updates an actor.

Parameters
idExisting actor id or empty to create.
nameActor name.
aliasesActor aliases.
contractIdsLinked contract ids.
Returns
Saved actor id or an empty string.

Definition at line 448 of file WorkspaceCommands.cpp.

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

◆ saveContract()

QString ui::WorkspaceCommands::saveContract ( const QString & id,
const QString & name,
const QString & type,
const QStringList & actorIds = {},
const QStringList & propertyIds = {},
const QStringList & aliases = {},
const QString & allocatableMode = QStringLiteral("mixed") )

Creates or updates a contract.

Parameters
idExisting contract id or empty to create.
nameContract name.
typeContract type.
actorIdsLinked actor ids.
propertyIdsLinked property ids.
aliasesContract aliases.
allocatableModeContract allocatable mode.
Returns
Saved contract id or an empty string.

Definition at line 522 of file WorkspaceCommands.cpp.

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

◆ saveExportLog()

void ui::WorkspaceCommands::saveExportLog ( const core::ports::workspace::ExportLogSnapshot & log)

Saves an export log in workspace state.

Parameters
logExport log snapshot.

Definition at line 385 of file WorkspaceCommands.cpp.

◆ saveFile()

void ui::WorkspaceCommands::saveFile ( )

Saves the current workspace file.

Definition at line 415 of file WorkspaceCommands.cpp.

Here is the caller graph for this function:

◆ saveFileAs()

void ui::WorkspaceCommands::saveFileAs ( const QString & path)

Saves the current workspace file to a new path.

Parameters
pathTarget file path.

Definition at line 424 of file WorkspaceCommands.cpp.

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

◆ saveProperty()

QString ui::WorkspaceCommands::saveProperty ( const QString & id,
const QString & name,
const QStringList & aliases = {},
const QStringList & contractIds = {} )

Creates or updates a property.

Parameters
idExisting property id or empty to create.
nameProperty name.
aliasesProperty aliases.
contractIdsLinked contract ids.
Returns
Saved property id or an empty string.

Definition at line 484 of file WorkspaceCommands.cpp.

◆ saveStatementDraft()

void ui::WorkspaceCommands::saveStatementDraft ( const core::ports::workspace::StatementDraftSnapshot & draft)

Saves a statement draft in workspace state.

Parameters
draftDraft snapshot to save.

Definition at line 306 of file WorkspaceCommands.cpp.

◆ setBeforeStorageSaveCallback()

void ui::WorkspaceCommands::setBeforeStorageSaveCallback ( std::function< void()> callback)

Registers an optional hook executed immediately before storage save.

Parameters
callbackCallback used by composition to flush active workflow state.

Definition at line 433 of file WorkspaceCommands.cpp.

◆ statementDraftSnapshot()

std::optional< core::ports::workspace::StatementDraftSnapshot > ui::WorkspaceCommands::statementDraftSnapshot ( const QString & draftId = {}) const

Reads a statement draft snapshot from workspace state.

Parameters
draftIdDraft id; empty allows the workspace reader default.
Returns
Draft snapshot when available.

Definition at line 287 of file WorkspaceCommands.cpp.

Here is the call graph for this function:

◆ updateAnalysis()

void ui::WorkspaceCommands::updateAnalysis ( const QString & id,
const QString & name,
const QString & type,
const QVariantMap & config,
const QVariantMap & filter,
const QString & exportFormat,
bool includeCalcAdjustments,
const QVariantList & snapshotTransactions,
const QVariantMap & adjustments = {} )

Updates an analysis.

Parameters
idAnalysis id.
nameAnalysis name.
typeAnalysis type.
configAnalysis configuration payload.
filterAnalysis filter payload.
exportFormatExport format.
includeCalcAdjustmentsWhether calculation adjustments are included.
snapshotTransactionsFrozen transaction snapshot rows.
adjustmentsAdjustment amount map.

Definition at line 728 of file WorkspaceCommands.cpp.

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

◆ updateAnalysisExportFormat()

void ui::WorkspaceCommands::updateAnalysisExportFormat ( const QString & analysisId,
const QString & exportFormat )

Updates only the stored export format of an analysis.

Parameters
analysisIdAnalysis id.
exportFormatExport format.

Definition at line 754 of file WorkspaceCommands.cpp.

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

◆ updateAnnual()

void ui::WorkspaceCommands::updateAnnual ( const QString & id,
const QString & name,
int year,
const QStringList & analysisIds = {} )

Updates an annual.

Parameters
idAnnual id.
nameAnnual name.
yearAnnual year.
analysisIdsAssigned analysis ids.

Definition at line 810 of file WorkspaceCommands.cpp.

◆ updateStatement()

void ui::WorkspaceCommands::updateStatement ( const QString & id,
const QString & name )

Updates a statement.

Parameters
idStatement id.
nameStatement name.

Definition at line 601 of file WorkspaceCommands.cpp.

Here is the call graph for this function:

◆ updateTransaction()

void ui::WorkspaceCommands::updateTransaction ( const QString & id,
const QString & name,
const QString & bookingDate,
const QString & valuta,
const QVariant & amount,
const QString & statementId,
int status,
const QString & actorId,
const QString & contractId,
bool allocatable,
const QStringList & propertyIds )

Updates a transaction.

Parameters
idTransaction id.
nameTransaction name.
bookingDateBooking date text.
valutaValuta date text.
amountRaw UI amount value.
statementIdOwning statement id.
statusTransaction status.
actorIdLinked actor id.
contractIdLinked contract id.
allocatableAllocatable flag.
propertyIdsLinked property ids.

Definition at line 679 of file WorkspaceCommands.cpp.

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

◆ upsertImportLog()

void ui::WorkspaceCommands::upsertImportLog ( const QString & logId,
const QString & status,
const QString & message,
bool draftAttached,
const QString & draftId = {},
const QString & statementId = {},
const QString & importFile = {} )

Creates or updates an import log row.

Parameters
logIdExisting log id or empty for a generated id.
statusUser-visible import status.
messageUser-visible import message.
draftAttachedWhether the log points to a review draft.
draftIdAttached draft id.
statementIdFinalized statement id.
importFileSource import file.

Definition at line 336 of file WorkspaceCommands.cpp.


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