![]() |
FOSSology
4.5.1
Open Source License Compliance by Open Source Software
|
#include <OjosDatabaseHandler.hpp>


Public Member Functions | |
| OjosDatabaseHandler (fo::DbManager dbManager) | |
| OjosDatabaseHandler (OjosDatabaseHandler &&other) | |
| OjosDatabaseHandler | spawn () const |
| std::vector< unsigned long > | queryFileIdsForUpload (int uploadId, int agentId, bool ignoreFilesWithMimeType) |
| unsigned long | saveLicenseToDatabase (OjoDatabaseEntry &entry) const |
| Save findings to the database if agent was called by scheduler. More... | |
| bool | insertNoResultInDatabase (OjoDatabaseEntry &entry) const |
| Save no result to the database. More... | |
| bool | saveHighlightToDatabase (const ojomatch &match, const unsigned long fl_fk) const |
| unsigned long | getLicenseIdForName (std::string const &rfShortName, const int groupId, const int userId) |
| Get the license id for a given short name. More... | |
Public Member Functions inherited from fo::AgentDatabaseHandler | |
| AgentDatabaseHandler (DbManager dbManager) | |
| AgentDatabaseHandler (AgentDatabaseHandler &&other) | |
| AgentDatabaseHandler (const AgentDatabaseHandler &)=delete | |
| virtual | ~AgentDatabaseHandler () |
| AgentDatabaseHandler | operator= (const AgentDatabaseHandler &)=delete |
| bool | begin () const |
| BEGIN a transaction block in DB. More... | |
| bool | commit () const |
| COMMIT a transaction block in DB. More... | |
| bool | rollback () const |
| ROLLBACK a transaction block in DB. More... | |
| char * | getPFileNameForFileId (unsigned long pfileId) const |
| Get the file name of a give pfile id. More... | |
| std::string | queryUploadTreeTableName (int uploadId) |
| Get the upload tree table name for a given upload id. More... | |
| std::vector< unsigned long > | queryFileIdsVectorForUpload (int uploadId, bool ignoreFilesWithMimeType) const |
| Get pfile ids for a given upload id. More... | |
| std::vector< unsigned long > | queryFileIdsVectorForUpload (int uploadId, int agentId, bool ignoreFilesWithMimeType) const |
| Get pfile ids for a given upload id which agent has not scanned. More... | |
Private Member Functions | |
| unsigned long | getCachedLicenseIdForName (std::string const &rfShortName) const |
| unsigned long | selectOrInsertLicenseIdForName (std::string rfShortname, const int groupId, const int userId) |
Private Attributes | |
| std::unordered_map< std::string, long > | licenseRefCache |
Additional Inherited Members | |
Protected Attributes inherited from fo::AgentDatabaseHandler | |
| DbManager | dbManager |
| DbManager to use. | |
Database handler for OJO agent
Definition at line 60 of file OjosDatabaseHandler.hpp.
| OjosDatabaseHandler::OjosDatabaseHandler | ( | fo::DbManager | dbManager | ) |
Default constructor for OjosDatabaseHandler
| dbManager | DBManager to be used |
Definition at line 20 of file OjosDatabaseHandler.cc.
|
private |
Get the license id from the cached license list.
| rfShortName | Name of the license |
Definition at line 347 of file OjosDatabaseHandler.cc.
| unsigned long OjosDatabaseHandler::getLicenseIdForName | ( | std::string const & | rfShortName, |
| const int | groupId, | ||
| const int | userId | ||
| ) |
Get the license id for a given short name.
The function first checks if the license exists in the cache list. If the license is not cached, it checks in DB and store in the cache.
| rfShortName | Short name to be searched |
| groupId | Group running the agent |
| userId | UserRunning the agent |
Definition at line 330 of file OjosDatabaseHandler.cc.
| bool OjosDatabaseHandler::insertNoResultInDatabase | ( | OjoDatabaseEntry & | entry | ) | const |
Save no result to the database.
| entry | Entry containing the agent id and file id |
Definition at line 108 of file OjosDatabaseHandler.cc.
| vector< unsigned long > OjosDatabaseHandler::queryFileIdsForUpload | ( | int | uploadId, |
| int | agentId, | ||
| bool | ignoreFilesWithMimeType | ||
| ) |
Get a vector of all file id for a given upload id.
| uploadId | Upload ID to be queried |
| agentId | Current agent ID |
| ignoreFilesWithMimeType | To ignore files with particular mimetype |
Definition at line 32 of file OjosDatabaseHandler.cc.
| bool OjosDatabaseHandler::saveHighlightToDatabase | ( | const ojomatch & | match, |
| const unsigned long | fl_fk | ||
| ) | const |
Save findings highlights to DB
| match | Match to be saved |
| fl_fk | fl_pk from license_file table |
Definition at line 84 of file OjosDatabaseHandler.cc.
| unsigned long OjosDatabaseHandler::saveLicenseToDatabase | ( | OjoDatabaseEntry & | entry | ) | const |
Save findings to the database if agent was called by scheduler.
| entry | The entry to be made |
Definition at line 55 of file OjosDatabaseHandler.cc.
|
private |
Get the license id for a given short name or create a new entry.
GPL-2.0 and GPL-2.0-only are treated as sameGPL-2.0+ and GPL-2.0-or-later are treated as same| rfShortName | Short name to be searched. |
| groupId | Group id for candidate license |
| userId | User who is running the agent |
Definition at line 160 of file OjosDatabaseHandler.cc.
| OjosDatabaseHandler OjosDatabaseHandler::spawn | ( | ) | const |
Spawn a new DbManager object.
Used to create new objects for threads.
Definition at line 44 of file OjosDatabaseHandler.cc.
|
private |
Cached license pairs
Definition at line 91 of file OjosDatabaseHandler.hpp.