Mercurial > hg > orthanc
annotate OrthancServer/Sources/ServerIndexChange.h @ 5850:1980354c8113 find-refactoring
add level of interest to StatelessDatabaseOperations::LookupAttachment()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 29 Oct 2024 15:03:32 +0000 |
parents | f7adfb22e20e |
children |
rev | line source |
---|---|
1198 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1242
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
5640
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5485
diff
changeset
|
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium |
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5485
diff
changeset
|
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium |
5485
48b8dae6dc77
upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5185
diff
changeset
|
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
1198 | 8 * |
9 * This program is free software: you can redistribute it and/or | |
10 * modify it under the terms of the GNU General Public License as | |
11 * published by the Free Software Foundation, either version 3 of the | |
12 * License, or (at your option) any later version. | |
13 * | |
14 * This program is distributed in the hope that it will be useful, but | |
15 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 * General Public License for more details. | |
18 * | |
19 * You should have received a copy of the GNU General Public License | |
20 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 **/ | |
22 | |
23 | |
24 #pragma once | |
25 | |
26 #include "ServerEnumerations.h" | |
4045 | 27 #include "../../OrthancFramework/Sources/IDynamicObject.h" |
28 #include "../../OrthancFramework/Sources/SystemToolbox.h" | |
1198 | 29 |
30 #include <string> | |
1240 | 31 #include <json/value.h> |
1198 | 32 |
33 namespace Orthanc | |
34 { | |
1436
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
35 struct ServerIndexChange : public IDynamicObject |
1198 | 36 { |
37 private: | |
1240 | 38 int64_t seq_; |
1198 | 39 ChangeType changeType_; |
40 ResourceType resourceType_; | |
41 std::string publicId_; | |
1240 | 42 std::string date_; |
1198 | 43 |
44 public: | |
45 ServerIndexChange(ChangeType changeType, | |
46 ResourceType resourceType, | |
1240 | 47 const std::string& publicId) : |
48 seq_(-1), | |
1198 | 49 changeType_(changeType), |
50 resourceType_(resourceType), | |
1240 | 51 publicId_(publicId), |
2475
8cc3ca64a534
Orthanc now uses UTC (universal time) instead of local time in its database
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2447
diff
changeset
|
52 date_(SystemToolbox::GetNowIsoString(true /* use UTC time (not local time) */)) |
1198 | 53 { |
54 } | |
55 | |
1240 | 56 ServerIndexChange(int64_t seq, |
57 ChangeType changeType, | |
58 ResourceType resourceType, | |
59 const std::string& publicId, | |
60 const std::string& date) : | |
61 seq_(seq), | |
62 changeType_(changeType), | |
63 resourceType_(resourceType), | |
64 publicId_(publicId), | |
65 date_(date) | |
66 { | |
67 } | |
68 | |
1436
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
69 ServerIndexChange(const ServerIndexChange& other) |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
70 : seq_(other.seq_), |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
71 changeType_(other.changeType_), |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
72 resourceType_(other.resourceType_), |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
73 publicId_(other.publicId_), |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
74 date_(other.date_) |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
75 { |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
76 } |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
77 |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
78 ServerIndexChange* Clone() const |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
79 { |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
80 return new ServerIndexChange(*this); |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
81 } |
0a3e3be59094
uncoupling of SignalChange for Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1288
diff
changeset
|
82 |
1240 | 83 int64_t GetSeq() const |
84 { | |
85 return seq_; | |
86 } | |
87 | |
1198 | 88 ChangeType GetChangeType() const |
89 { | |
90 return changeType_; | |
91 } | |
92 | |
93 ResourceType GetResourceType() const | |
94 { | |
95 return resourceType_; | |
96 } | |
97 | |
98 const std::string& GetPublicId() const | |
99 { | |
100 return publicId_; | |
101 } | |
1240 | 102 |
103 const std::string& GetDate() const | |
104 { | |
105 return date_; | |
106 } | |
107 | |
108 void Format(Json::Value& item) const | |
109 { | |
110 item = Json::objectValue; | |
111 item["Seq"] = static_cast<int>(seq_); | |
112 item["ChangeType"] = EnumerationToString(changeType_); | |
113 item["ResourceType"] = EnumerationToString(resourceType_); | |
114 item["ID"] = publicId_; | |
115 item["Path"] = GetBasePath(resourceType_, publicId_); | |
116 item["Date"] = date_; | |
117 } | |
1198 | 118 }; |
119 } |