ImagingTools Core SDK
IUserRecentAction.h
1// SPDX-License-Identifier: LGPL-2.1-or-later OR GPL-2.0-or-later OR GPL-3.0-or-later OR LicenseRef-ImtCore-Commercial
2#pragma once
3
4
5// ACF includes
6#include <iser/IObject.h>
7#include <iprm/IParamsSet.h>
8#include <idoc/IDocumentMetaInfo.h>
9
10
11namespace imtauth
12{
13
14
15class IUserRecentAction : virtual public iser::IObject
16{
17public:
18 enum MetaInfoTypes
19 {
20 MIT_USER_ID = idoc::IDocumentMetaInfo::MIT_USER + 1,
21 MIT_USER_NAME,
22 MIT_TARGET_ID,
23 MIT_TARGET_NAME,
24 MIT_TARGET_SOURCE,
25 MIT_TARGET_TYPE_ID,
26 MIT_TARGET_TYPE_NAME,
27 MIT_ACTION_TYPE_ID,
28 MIT_ACTION_TYPE_NAME,
29 MIT_ACTION_TYPE_DESCRIPTION
30 };
31
32 typedef std::function<iser::ISerializableSharedPtr(const QByteArray& actionTypeId)> ActionDataFactoryFunction;
33
34 struct TargetInfo
35 {
36 TargetInfo(
37 const QByteArray& id = QByteArray(),
38 const QByteArray& typeId = QByteArray(),
39 const QString& typeName = QString(),
40 const QString& source = QString(),
41 const QString& name = QString()):
42 id(id),
43 typeId(typeId),
44 typeName(typeName),
45 source(source),
46 name(name){}
47
48 QByteArray id;
49 QByteArray typeId;
50 QString typeName;
51 QString source;
52 QString name;
53
54 bool operator == (const TargetInfo& other) const
55 {
56 return (id == other.id) &&
57 (typeId == other.typeId) &&
58 (typeName == other.typeName) &&
59 (source == other.source) &&
60 (name == other.name);
61 }
62
63 bool operator != (const TargetInfo& other) const
64 {
65 return !(*this == other);
66 }
67 };
68
69 struct ActionTypeInfo
70 {
71 ActionTypeInfo(
72 const QByteArray& id = QByteArray(),
73 const QString& name = QString(),
74 const QString& description = QString()):
75 id(id),
76 description(description),
77 name(name){}
78
79 QByteArray id;
80 QString name;
81 QString description;
82
83 bool operator == (const ActionTypeInfo& other) const
84 {
85 return (id == other.id) &&
86 (description == other.description) &&
87 (name == other.name);
88 }
89
90 bool operator != (const ActionTypeInfo& other) const
91 {
92 return !(*this == other);
93 }
94 };
95
96 struct UserInfo
97 {
98 UserInfo(const QByteArray& id = QByteArray(), const QString& name = QString()): id(id), name(name){}
99
100 QByteArray id;
101 QString name;
102
103 bool operator == (const UserInfo& other) const
104 {
105 return (id == other.id) &&
106 (name == other.name);
107 }
108
109 bool operator != (const UserInfo& other) const
110 {
111 return !(*this == other);
112 }
113 };
114
115 virtual UserInfo GetUserInfo() const = 0;
116 virtual void SetUserInfo(UserInfo userInfo) = 0;
117
118 virtual ActionTypeInfo GetActionTypeInfo() const = 0;
119 virtual void SetActionTypeInfo(ActionTypeInfo actionTypeInfo) = 0;
120
121 virtual TargetInfo GetTargetInfo() const = 0;
122 virtual void SetTargetInfo(TargetInfo targetInfo) = 0;
123
124 virtual QDateTime GetTimestamp() const = 0;
125 virtual void SetTimestamp(const QDateTime& timestamp) = 0;
126
127 virtual iser::ISerializableSharedPtr GetActionData() const = 0;
128 virtual void SetActionData(const iser::ISerializableSharedPtr& actionDataPtr) = 0;
129
130 virtual void SetActionDataFactory(const ActionDataFactoryFunction& factory) = 0;
131};
132
133
134typedef istd::TUniqueInterfacePtr<IUserRecentAction> IUserActionInfoUniquePtr;
135typedef istd::TSharedInterfacePtr<IUserRecentAction> IUserActionInfoSharedPtr;
136
137
138} // namespace imtauth
139
140