OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
Project.h
Go to the documentation of this file.
1#pragma once
2
3#include <iostream>
4#include <cstdint>
5#include <vector>
6#include <bsoncxx/json.hpp>
7#include <bsoncxx/types.hpp>
8
9#include "User.h"
10#include "Group.h"
11#include "MongoUserFunctions.h"
12#include "MongoGroupFunctions.h"
13
15{
16
17public:
18 Project();
19 Project(const bsoncxx::v_noabi::document::view& _view);
20 Project(const bsoncxx::v_noabi::document::view& _view, mongocxx::client& _userClient);
21 Project(const Project&) = default;
22 Project(Project&&) = default;
24
25 Project& operator = (const Project&) = default;
27
28 void setId(const bsoncxx::oid& _id) { m_id = _id; };
29 const bsoncxx::oid& getId(void) const { return m_id; };
30
31 void setName(const std::string& _name) { m_name = _name; };
32 const std::string& getName(void) const { return m_name; };
33
34 void setType(const std::string& _type) { m_type = _type; };
35 const std::string& getType(void) const { return m_type; };
36
37 void setRoleName(const std::string& _roleName) { m_roleName = _roleName; };
38 const std::string& getRoleName(void) const { return m_roleName; };
39
40 void setCollectionName(const std::string& _collectionName) { m_collectionName = _collectionName; };
41 const std::string& getCollectionName(void) const { return m_collectionName; };
42
43 void setCreatedOn(bsoncxx::types::b_date _msSinceEpoch) { m_createdOn = _msSinceEpoch; };
44 bsoncxx::types::b_date getCreatedOn(void) const { return m_createdOn; };
45
46 void setUser(const User& _user) { m_creatingUser = _user; };
47 const User& getUser(void) const { return m_creatingUser; };
48
49 void addGroup(const Group& _group);
50 void setGroups(const std::vector<Group>& _groups) { m_groups = _groups; };
51 const std::vector<Group>& getGroups(void) const { return m_groups; };
52
53 void setVersion(int _version) { m_version = _version; };
54 int getVersion(void) const { return m_version; };
55
56 void setLastAccessedOn(bsoncxx::types::b_date _msSinceEpoch) { m_lastAccessedOn = _msSinceEpoch; };
57 bsoncxx::types::b_date getLastAccessedOn(void) const { return m_lastAccessedOn; };
58
59private:
60 void importData(const bsoncxx::v_noabi::document::view& _view);
61
62 bsoncxx::oid m_id;
63 std::string m_name;
64 std::string m_type;
65 std::string m_roleName;
66 std::string m_collectionName;
67 bsoncxx::types::b_date m_createdOn;
68 User m_creatingUser;
69 std::vector<Group> m_groups;
70 int m_version;
71 bsoncxx::types::b_date m_lastAccessedOn;
72};
73
Definition Group.h:20
Definition Project.h:15
void setLastAccessedOn(bsoncxx::types::b_date _msSinceEpoch)
Definition Project.h:56
void setGroups(const std::vector< Group > &_groups)
Definition Project.h:50
const bsoncxx::oid & getId(void) const
Definition Project.h:29
void setVersion(int _version)
Definition Project.h:53
const std::string & getType(void) const
Definition Project.h:35
const std::string & getName(void) const
Definition Project.h:32
void setRoleName(const std::string &_roleName)
Definition Project.h:37
void setUser(const User &_user)
Definition Project.h:46
Project(Project &&)=default
bsoncxx::types::b_date getLastAccessedOn(void) const
Definition Project.h:57
Project()
Definition Project.cpp:3
const std::string & getRoleName(void) const
Definition Project.h:38
void setName(const std::string &_name)
Definition Project.h:31
void setId(const bsoncxx::oid &_id)
Definition Project.h:28
void setType(const std::string &_type)
Definition Project.h:34
const std::string & getCollectionName(void) const
Definition Project.h:41
void setCollectionName(const std::string &_collectionName)
Definition Project.h:40
~Project()
Definition Project.h:23
void addGroup(const Group &_group)
Definition Project.cpp:28
void setCreatedOn(bsoncxx::types::b_date _msSinceEpoch)
Definition Project.h:43
int getVersion(void) const
Definition Project.h:54
Project(const Project &)=default
const User & getUser(void) const
Definition Project.h:47
Project & operator=(const Project &)=default
const std::vector< Group > & getGroups(void) const
Definition Project.h:51
bsoncxx::types::b_date getCreatedOn(void) const
Definition Project.h:44
Definition User.h:20