27 #include <boost/date_time/posix_time/posix_time.hpp> 29 #include <odb/callback.hxx> 30 #include <odb/core.hxx> 44 #pragma db object polymorphic optimistic callback(odb_callback) 46 public std::enable_shared_from_this<AuditEntry>
77 virtual size_t version()
const override;
79 virtual void reload()
override;
81 virtual boost::posix_time::ptime
timestamp()
const override;
102 #pragma db value_not_null 106 #pragma db inverse(children_) 118 #pragma db type("TEXT") 167 void odb_callback(odb::callback_event e, odb::database &)
const;
170 #pragma db view object(AuditEntry) 173 #pragma db column("count(" + AuditEntry::id_ + ")")
bool finalized_
Audit entry are sometime persisted multiple time before reaching their final state.
virtual void remove_parent() override
Remove the parent-child relationship between this entry and its parent.
Implementation of IAuditEntry, backed by ODB.
This is the header file for a generated source file, GitSHA1.cpp.
virtual size_t children_count() const override
Returns the number of children that this entry has.
odb::lazy_shared_ptr< User > UserLPtr
virtual void author(Auth::UserPtr user) override
Set the author of the entry.
unsigned long AuditEntryId
size_t duration_
How long did it take for the Audit object to be finalized.
static AuditEntryPtr get_last_audit(DBPtr db)
Retrieve the last (finalized) audit entry.
virtual bool finalized() const override
Is this entry finalized.
Tools::ElapsedTimeCounter etc_
Keep track of how long the object has been alive.
std::shared_ptr< IAuditEntry > IAuditEntryPtr
virtual IAuditEntryPtr parent() const override
Retrieve the parent of this entry.
virtual void finalize() override
Mark the entry as finalized, and update it wrt the database.
void odb_callback(odb::callback_event e, odb::database &) const
Implementation of an ODB callback.
Base interface to Audit object.
std::vector< AuditEntryPtr > children_
virtual Auth::UserId author_id() const override
Retrieve the user id of the author of this entry.
virtual boost::posix_time::ptime timestamp() const override
Retrieve unix timestamp.
std::shared_ptr< AuditEntry > AuditEntryPtr
virtual const EventMask & event_mask() const override
Retrieve the current event mask.
DBPtr database_
Pointer to the database.
std::shared_ptr< User > UserPtr
boost::posix_time::ptime timestamp_
FlagSet< EventType > EventMask
virtual void reload() override
Reload the object from the database.
virtual size_t version() const override
Returns the ODB version of the object.
virtual void set_parent(IAuditEntryPtr parent) override
Set parent as the parent audit entry for this entry.
Auth::UserLPtr author_
The user at the source of the entry.
virtual ~AuditEntry()=default
std::shared_ptr< odb::database > DBPtr
void database(DBPtr db)
Set the database pointer.
virtual AuditEntryId id() const override
Retrieve the identifier of the entry.
std::weak_ptr< AuditEntry > AuditEntryWPtr