OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
ProjectManagement.h
Go to the documentation of this file.
1/*
2 * ProjectManagement.h
3 *
4 * Author: Peter Thoma
5 * Copyright (c) 2020 openTwin
6 */
7
8#pragma once
9
10// Frontend header
11#include "LoginData.h"
12
13// std header
14#include <string>
15#include <list>
16#include <map>
17#include <vector>
18
19// BSON header
20#include <bsoncxx/document/view.hpp>
21#include <bsoncxx/builder/basic/document.hpp>
22
23class AppBase;
24
26{
27public:
29 ProjectManagement(const LoginData& _data);
31
32 void setDataBaseURL(const std::string &url);
33 void setAuthServerURL(const std::string &url);
34
35 bool InitializeConnection(void);
36
37 bool createProject(const std::string &projectName, const std::string& projectType, const std::string &userName, const std::string &defaultSettingTemplate);
38 bool deleteProject(const std::string &projectName);
39 std::string exportProject(const std::string &projectName, const std::string &exportFileName, AppBase *parent);
40 std::string importProject(const std::string &projectName, const std::string &userName, const std::string &importFileName, AppBase *parent);
41 bool renameProject(const std::string &oldProjectName, const std::string &newProjectName);
42 bool projectExists(const std::string &projectName, bool &canBeDeleted);
43 std::string getProjectCollection(const std::string &projectName);
44 bool findProjectNames(const std::string &projectNameFilter, int maxNumberOfResults, std::list<std::string> &projectsFound, bool &maxLengthExceeded);
45 bool getProjectAuthor(const std::string &projectName, std::string &author);
46 bool readProjectAuthor(std::list<std::string> &projects);
47 bool copyProject(const std::string &sourceProjectName, const std::string &destinationProjectName, const std::string &userName);
48 std::vector<std::string> getDefaultTemplateList(void);
49 bool canAccessProject(const std::string &projectCollection);
50
51 void setProjectType(const std::string& projectName, const std::string& projectType);
52 std::string getProjectType(const std::string& projectName);
53
54private:
55 bool createNewCollection(const std::string &collectionName, const std::string &defaultSettingTemplate);
56 bool hasError(const std::string &response);
57 bool hasSuccessful(const std::string &response);
58 void copyCollection(const std::string& sourceCollectionName, const std::string& destinationCollectionName);
59
60 bool isConnected;
61 std::string databaseURL;
62 std::string authServerURL;
63 const std::string dataBaseName;
64 const std::string projectCatalogCollectionName;
65 std::map<std::string, std::string> projectAuthorMap;
66};
The API manager is used to manage the global objects required for this API to work.
Definition AppBase.h:21
Definition LoginData.h:14
Definition ProjectManagement.h:26
bool renameProject(const std::string &oldProjectName, const std::string &newProjectName)
Definition ProjectManagement.cpp:123
void setDataBaseURL(const std::string &url)
Definition ProjectManagement.cpp:57
bool copyProject(const std::string &sourceProjectName, const std::string &destinationProjectName, const std::string &userName)
Definition ProjectManagement.cpp:479
bool getProjectAuthor(const std::string &projectName, std::string &author)
Definition ProjectManagement.cpp:397
void setAuthServerURL(const std::string &url)
Definition ProjectManagement.cpp:62
void setProjectType(const std::string &projectName, const std::string &projectType)
bool canAccessProject(const std::string &projectCollection)
Definition ProjectManagement.cpp:981
ProjectManagement()
Definition ProjectManagement.cpp:34
bool createProject(const std::string &projectName, const std::string &projectType, const std::string &userName, const std::string &defaultSettingTemplate)
Definition ProjectManagement.cpp:67
std::string exportProject(const std::string &projectName, const std::string &exportFileName, AppBase *parent)
Definition ProjectManagement.cpp:540
std::string getProjectType(const std::string &projectName)
Definition ProjectManagement.cpp:254
bool deleteProject(const std::string &projectName)
Definition ProjectManagement.cpp:102
bool readProjectAuthor(std::list< std::string > &projects)
Definition ProjectManagement.cpp:407
std::vector< std::string > getDefaultTemplateList(void)
Definition ProjectManagement.cpp:523
std::string importProject(const std::string &projectName, const std::string &userName, const std::string &importFileName, AppBase *parent)
Definition ProjectManagement.cpp:736
~ProjectManagement()
Definition ProjectManagement.cpp:52
std::string getProjectCollection(const std::string &projectName)
Definition ProjectManagement.cpp:214
bool projectExists(const std::string &projectName, bool &canBeDeleted)
Definition ProjectManagement.cpp:145
bool findProjectNames(const std::string &projectNameFilter, int maxNumberOfResults, std::list< std::string > &projectsFound, bool &maxLengthExceeded)
Definition ProjectManagement.cpp:297
bool InitializeConnection(void)
Definition ProjectManagement.cpp:370