Leosac  0.8.0
Open Source Access Control
Update.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014-2016 Leosac
3 
4  This file is part of Leosac.
5 
6  Leosac is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Affero General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Leosac is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Affero General Public License for more details.
15 
16  You should have received a copy of the GNU Affero General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #pragma once
21 
23 #include "core/update/IUpdate.hpp"
24 #include <odb/core.hxx>
25 #include <string>
26 
27 namespace Leosac
28 {
29 namespace update
30 {
31 
38 #pragma db object polymorphic optimistic
39 class Update : virtual public IUpdate
40 {
41  public:
42  Update();
43 
44  virtual UpdateId id() const override;
45 
46  virtual const TimePoint &generated_at() const override;
47 
48  virtual Status status() const override;
49  virtual void status(Status st) override;
50 
51  virtual const TimePoint &status_updated_at() const override;
52 
53  virtual void set_checkpoint(Audit::AuditEntryPtr) override;
54 
55  virtual Audit::AuditEntryId get_checkpoint() const override;
56 
57  virtual const std::string &source_module() const override;
58 
59  virtual void source_module(const std::string &s) override;
60 
61  virtual const std::string &description() const override;
62  virtual void description(const std::string &d) override;
63 
64  private:
65 #pragma db id auto
67 
69 
75 
82 
89  std::string source_module_;
90 
94  std::string description_;
95 
97 
98 #pragma db version
99  const size_t odb_version_;
100 
101  friend class odb::access;
102 };
103 }
104 }
Leosac::update::Update::status_updated_at_
TimePoint status_updated_at_
Last timepoint when status was updated.
Definition: Update.hpp:81
Leosac::update::Update::status_
Status status_
Definition: Update.hpp:96
Leosac::update::Update::status_updated_at
virtual const TimePoint & status_updated_at() const override
Definition: Update.cpp:57
IUpdate.hpp
Leosac::Audit::AuditEntryPtr
std::shared_ptr< AuditEntry > AuditEntryPtr
Definition: AuditFwd.hpp:81
Leosac::update::Update::status
virtual Status status() const override
Definition: Update.cpp:46
Leosac::update::Update::odb_version_
const size_t odb_version_
Definition: Update.hpp:99
Leosac::Audit::AuditEntryId
unsigned long AuditEntryId
Definition: AuditFwd.hpp:31
Leosac::update::Update::access
friend class odb::access
Definition: Update.hpp:101
Leosac::Audit::AuditTracker
Implementation of IAuditTracker, backed by ODB.
Definition: AuditTracker.hpp:38
Leosac::update::Update::source_module_
std::string source_module_
The name (as returned by get_module_name()) that created this update.
Definition: Update.hpp:89
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition: APIStatusCode.hpp:22
Leosac::update::Update::description
virtual const std::string & description() const override
Definition: Update.cpp:82
Leosac::update::Update
Represent an update.
Definition: Update.hpp:39
Leosac::update::Update::generated_at_
TimePoint generated_at_
Definition: Update.hpp:68
AuditTracker.hpp
Leosac::update::Update::set_checkpoint
virtual void set_checkpoint(Audit::AuditEntryPtr) override
Set the checkpoint for the update object.
Definition: Update.cpp:62
Leosac::update::Status
Status
Definition: UpdateFwd.hpp:30
Leosac::update::IUpdate::TimePoint
std::chrono::system_clock::time_point TimePoint
Definition: IUpdate.hpp:33
Leosac::update::Update::generated_at
virtual const TimePoint & generated_at() const override
Definition: Update.cpp:40
Leosac::update::Update::get_checkpoint
virtual Audit::AuditEntryId get_checkpoint() const override
Definition: Update.cpp:67
Leosac::update::IUpdate
Definition: IUpdate.hpp:30
Leosac::update::Update::Update
Update()
Definition: Update.cpp:27
Leosac::update::Update::id_
UpdateId id_
Definition: Update.hpp:66
Leosac::update::Update::description_
std::string description_
Optional description for the update.
Definition: Update.hpp:94
Leosac::update::Update::checkpoint_
Audit::AuditTracker checkpoint_
Tracks the audit entry that represents the point in time of this update.
Definition: Update.hpp:74
Leosac::update::Update::source_module
virtual const std::string & source_module() const override
Definition: Update.cpp:72
Leosac::update::Update::id
virtual UpdateId id() const override
Definition: Update.cpp:35
Leosac::update::UpdateId
unsigned long UpdateId
Definition: UpdateFwd.hpp:56