FOSSredder 0.5.0
Loading...
Searching...
No Matches
SqliteContractRepository Class Reference

#include <SqliteContractRepository.h>

Inheritance diagram for SqliteContractRepository:
Collaboration diagram for SqliteContractRepository:

Classes

struct  Impl

Public Member Functions

 SqliteContractRepository (const std::string &dbPath)
 Create a contract repository for the database at the given path.
 SqliteContractRepository (std::shared_ptr< SqliteDb > db)
 Create a contract repository using an existing database handle wrapper.
 ~SqliteContractRepository () override
 Destroy the repository.
void addContract (const std::shared_ptr< core::domain::Contract > &contract) override
 Insert a new contract.
std::vector< std::shared_ptr< core::domain::Contract > > getContracts () const override
 Retrieve all contracts.
std::optional< std::shared_ptr< core::domain::Contract > > getContractById (const std::string &id) const override
 Retrieve a contract by identifier.
void removeContract (const std::string &id) override
 Remove a contract by identifier.
void updateContract (const std::shared_ptr< core::domain::Contract > &contract) override
 Update an existing contract.
void upsertContract (const std::shared_ptr< core::domain::Contract > &contract) override
 Insert or update a contract.
void clearContracts () override
 Remove all contracts.
std::vector< std::shared_ptr< core::domain::Contract > > getContractsForActor (const std::string &actorId) const override
 Retrieve contracts associated with a given actor.
std::vector< std::shared_ptr< core::domain::Contract > > getContractsForProperty (const std::string &propertyId) const override
 Retrieve contracts associated with a given property.
std::vector< std::string > getActorIdsForContract (const std::string &contractId) const override
 Retrieve actor identifiers linked to a contract.
std::vector< std::string > getPropertyIdsForContract (const std::string &contractId) const override
 Retrieve property identifiers linked to a contract.
Public Member Functions inherited from core::ports::repositories::IContractRepository
virtual ~IContractRepository ()=default
 Destroy the contract repository interface.

Detailed Description

Definition at line 14 of file SqliteContractRepository.h.

Constructor & Destructor Documentation

◆ SqliteContractRepository() [1/2]

SqliteContractRepository::SqliteContractRepository ( const std::string & dbPath)
explicit

Create a contract repository for the database at the given path.

Parameters
dbPathSQLite database path.

Definition at line 21 of file SqliteContractRepository.cpp.

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

◆ SqliteContractRepository() [2/2]

SqliteContractRepository::SqliteContractRepository ( std::shared_ptr< SqliteDb > db)
explicit

Create a contract repository using an existing database handle wrapper.

Parameters
dbShared SQLite database wrapper.

Definition at line 24 of file SqliteContractRepository.cpp.

◆ ~SqliteContractRepository()

SqliteContractRepository::~SqliteContractRepository ( )
overridedefault

Destroy the repository.

Member Function Documentation

◆ addContract()

void SqliteContractRepository::addContract ( const std::shared_ptr< core::domain::Contract > & contract)
overridevirtual

Insert a new contract.

Parameters
contractContract to add.

Implements core::ports::repositories::IContractRepository.

Definition at line 244 of file SqliteContractRepository.cpp.

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

◆ clearContracts()

void SqliteContractRepository::clearContracts ( )
overridevirtual

Remove all contracts.

Implements core::ports::repositories::IContractRepository.

Definition at line 350 of file SqliteContractRepository.cpp.

◆ getActorIdsForContract()

std::vector< std::string > SqliteContractRepository::getActorIdsForContract ( const std::string & contractId) const
overridevirtual

Retrieve actor identifiers linked to a contract.

Parameters
contractIdContract identifier.
Returns
Actor identifiers linked to the contract.

Implements core::ports::repositories::IContractRepository.

Definition at line 396 of file SqliteContractRepository.cpp.

Here is the call graph for this function:

◆ getContractById()

std::optional< std::shared_ptr< Contract > > SqliteContractRepository::getContractById ( const std::string & id) const
overridevirtual

Retrieve a contract by identifier.

Parameters
idContract identifier.
Returns
Contract with the requested identifier, if found.

Implements core::ports::repositories::IContractRepository.

Definition at line 287 of file SqliteContractRepository.cpp.

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

◆ getContracts()

std::vector< std::shared_ptr< Contract > > SqliteContractRepository::getContracts ( ) const
overridevirtual

Retrieve all contracts.

Returns
All stored contracts.

Implements core::ports::repositories::IContractRepository.

Definition at line 267 of file SqliteContractRepository.cpp.

Here is the call graph for this function:

◆ getContractsForActor()

std::vector< std::shared_ptr< Contract > > SqliteContractRepository::getContractsForActor ( const std::string & actorId) const
overridevirtual

Retrieve contracts associated with a given actor.

Parameters
actorIdActor identifier.
Returns
Contracts linked to the actor.

Implements core::ports::repositories::IContractRepository.

Definition at line 361 of file SqliteContractRepository.cpp.

Here is the call graph for this function:

◆ getContractsForProperty()

std::vector< std::shared_ptr< Contract > > SqliteContractRepository::getContractsForProperty ( const std::string & propertyId) const
overridevirtual

Retrieve contracts associated with a given property.

Parameters
propertyIdProperty identifier.
Returns
Contracts linked to the property.

Implements core::ports::repositories::IContractRepository.

Definition at line 379 of file SqliteContractRepository.cpp.

Here is the call graph for this function:

◆ getPropertyIdsForContract()

std::vector< std::string > SqliteContractRepository::getPropertyIdsForContract ( const std::string & contractId) const
overridevirtual

Retrieve property identifiers linked to a contract.

Parameters
contractIdContract identifier.
Returns
Property identifiers linked to the contract.

Implements core::ports::repositories::IContractRepository.

Definition at line 410 of file SqliteContractRepository.cpp.

Here is the call graph for this function:

◆ removeContract()

void SqliteContractRepository::removeContract ( const std::string & id)
overridevirtual

Remove a contract by identifier.

Parameters
idContract identifier.

Implements core::ports::repositories::IContractRepository.

Definition at line 305 of file SqliteContractRepository.cpp.

Here is the call graph for this function:

◆ updateContract()

void SqliteContractRepository::updateContract ( const std::shared_ptr< core::domain::Contract > & contract)
overridevirtual

Update an existing contract.

Parameters
contractContract to update.

Implements core::ports::repositories::IContractRepository.

Definition at line 315 of file SqliteContractRepository.cpp.

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

◆ upsertContract()

void SqliteContractRepository::upsertContract ( const std::shared_ptr< core::domain::Contract > & contract)
overridevirtual

Insert or update a contract.

Parameters
contractContract to upsert.

Implements core::ports::repositories::IContractRepository.

Definition at line 341 of file SqliteContractRepository.cpp.

Here is the call graph for this function:

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