Salome HOME
0ed8c347c61e0ba84a34d0a5325241ea70bc12fd
[modules/gde.git] / projects / GDE_API_CPP / api / src / GDESession.hpp
1 #ifndef GDE_SESSION_HPP
2 #define GDE_SESSION_HPP
3
4 #include "Credentials.hpp"
5 #include "User.hpp"
6 #include "UserGroup.hpp"
7 #include "Study.hpp"
8 #include "Attribute.hpp"
9 #include "AttributeGroup.hpp"
10 #include "Profile.hpp"
11 #include "ProfileAttribute.hpp"
12
13 #include <string>
14 #include <vector>
15
16 namespace gde {
17
18   class GDESession {
19
20   public:
21
22     GDESession(const std::string& serverAddress, const Credentials& credentials=Credentials())
23       : _serverAddress(serverAddress), _credentials(credentials)
24     {}
25     GDESession(const GDESession& x)
26       : _serverAddress(x._serverAddress), _credentials(x._credentials)
27     {}
28     ~GDESession() {}
29
30     inline std::string getServerAddress() const { return _serverAddress; }
31     //inline void setServerAddress(const std::string& serverAddress) { this->_serverAddress = serverAddress; }
32
33     inline const Credentials& getCredentials() const { return _credentials; }
34     //inline void setCredentials(const Credentials& credentials) { this->_credentials = credentials; }
35
36     std::string getServiceURI(const std::string& serviceName) const;
37
38     /* UserService */
39
40     const User createUser(const std::string& name, const std::string& password);
41     bool deleteUser(const User&);
42     const User findUser(const std::string& name);
43
44     const UserGroup createUserGroup(const std::string& name);
45     bool deleteUserGroup(const UserGroup&);
46     const UserGroup findUserGroup(const std::string& name);
47
48     bool addToUserGroup(const UserGroup&, const User&);
49     bool removeFromUserGroup(const UserGroup&, const User&);
50
51     /* StudyService */
52
53     const Study createStudy(const std::string& name);
54     bool deleteStudy(const Study&);
55
56     bool setStudyState(const Study&, int);
57     const Study readStudy(int);
58
59     /* AttributesService */
60
61     const Attribute createAttribute(const std::string& name, const std::string& type, const std::string& value, int groupId, bool mandatory);
62     bool deleteAttribute(const Attribute&);
63     const Attribute readAttribute(int);
64
65     const AttributeGroup createAttributeGroup(const AttributeGroup& attributeGroup=AttributeGroup());
66     bool deleteAttributeGroup(const AttributeGroup&);
67     const AttributeGroup updateAttributeGroup(const AttributeGroup&);
68     const AttributeGroup readAttributeGroup(int);
69
70     /* ProfilesService */
71
72     const Profile createProfile(const Profile&);
73     bool deleteProfile(const Profile&);
74     const Profile readProfile(int);
75     const Profile updateProfile(const Profile&);
76
77     const ProfileAttribute createProfileAttribute(const std::string& name, const std::string& type, int profileId, bool mandatory);
78     bool deleteProfileAttribute(const ProfileAttribute&);
79     const ProfileAttribute readProfileAttribute(int);
80     const ProfileAttribute updateProfileAttribute(const ProfileAttribute&);
81
82   private:
83     std::string _serverAddress;
84     Credentials _credentials;
85
86   };
87
88 };
89
90 #endif