Salome HOME
7abdf9dc2f9aae3b4e2a343944225b8dfa3d5e0d
[modules/gde.git] / projects / GDE_API_CPP / api / src / GDESession.cpp
1 #include "GDESession.hpp"
2 #include "UserService.hpp"
3 #include "StudyService.hpp"
4 #include "AttributesService.hpp"
5 #include "ProfilesService.hpp"
6
7 std::string
8 gde::GDESession::getServiceURI(const std::string& serviceName) const
9 {
10   std::string uri = serviceName;
11
12   if (*serviceName.begin() == '/') // begins with '/'
13     uri.erase(0, 1);
14
15   if (*_serverAddress.rbegin() != '/') // does not end with '/'
16     uri = '/' + uri;
17
18   uri = _serverAddress + uri;
19   return uri;
20 }
21
22 /* UserService */
23
24 const gde::User
25 gde::GDESession::createUser(const std::string& name, const std::string& password)
26 {
27   return gde::UserService(*this).createUser(name, password);
28 }
29
30 bool
31 gde::GDESession::deleteUser(const User& user)
32 {
33   return gde::UserService(*this).deleteUser(user);
34 }
35
36 const gde::User
37 gde::GDESession::findUser(const std::string& name)
38 {
39   return gde::UserService(*this).findUser(name);
40 }
41
42 const gde::UserGroup
43 gde::GDESession::createUserGroup(const std::string& name)
44 {
45   return gde::UserService(*this).createUserGroup(name);
46 }
47
48 bool
49 gde::GDESession::deleteUserGroup(const gde::UserGroup& group)
50 {
51   return gde::UserService(*this).deleteUserGroup(group);
52 }
53
54 const gde::UserGroup
55 gde::GDESession::findUserGroup(const std::string& name)
56 {
57   return gde::UserService(*this).findUserGroup(name);
58 }
59
60 bool
61 gde::GDESession::addToUserGroup(const gde::UserGroup& group, const gde::User& user)
62 {
63   return gde::UserService(*this).addToUserGroup(group, user);
64 }
65
66 bool
67 gde::GDESession::removeFromUserGroup(const gde::UserGroup& group, const gde::User& user)
68 {
69   return gde::UserService(*this).removeFromUserGroup(group, user);
70 }
71
72 /* StudyService */
73
74 const gde::Study
75 gde::GDESession::createStudy(const std::string& name)
76 {
77   return gde::StudyService(*this).createStudy(name);
78 }
79
80 bool
81 gde::GDESession::deleteStudy(const gde::Study& study)
82 {
83   return gde::StudyService(*this).deleteStudy(study);
84 }
85
86 bool
87 gde::GDESession::setStudyState(const gde::Study& study, int lock)
88 {
89   return gde::StudyService(*this).setStudyState(study, lock);
90 }
91
92 const gde::Study
93 gde::GDESession::readStudy(int studyId)
94 {
95   return gde::StudyService(*this).readStudy(studyId);
96 }
97
98 /* AttributesService */
99
100 const gde::Attribute
101 gde::GDESession::createAttribute(const std::string& name, const std::string& type, const std::string& value, int groupId, bool mandatory)
102 {
103   return gde::AttributesService(*this).createAttribute(name, type, value, groupId, mandatory);
104 }
105
106 bool
107 gde::GDESession::deleteAttribute(const gde::Attribute& attribute)
108 {
109   return gde::AttributesService(*this).deleteAttribute(attribute);
110 }
111
112 const gde::Attribute
113 gde::GDESession::readAttribute(int attributeId)
114 {
115   return gde::AttributesService(*this).readAttribute(attributeId);
116 }
117
118 const gde::AttributeGroup
119 gde::GDESession::createAttributeGroup(const AttributeGroup& attributeGroup)
120 {
121   return gde::AttributesService(*this).createAttributeGroup(attributeGroup);
122 }
123
124 bool
125 gde::GDESession::deleteAttributeGroup(const gde::AttributeGroup& attributeGroup)
126 {
127   return gde::AttributesService(*this).deleteAttributeGroup(attributeGroup);
128 }
129
130 const gde::AttributeGroup
131 gde::GDESession::updateAttributeGroup(const gde::AttributeGroup& attributeGroup)
132 {
133   return gde::AttributesService(*this).updateAttributeGroup(attributeGroup);
134 }
135
136 const gde::AttributeGroup
137 gde::GDESession::readAttributeGroup(int attributeGroupId)
138 {
139   return gde::AttributesService(*this).readAttributeGroup(attributeGroupId);
140 }
141
142     /* ProfilesService */
143 const gde::Profile
144 gde::GDESession::createProfile(const gde::Profile& profile)
145 {
146   return gde::ProfilesService(*this).createProfile(profile);
147 }
148
149 bool
150 gde::GDESession::deleteProfile(const gde::Profile& profile)
151 {
152   return gde::ProfilesService(*this).deleteProfile(profile);
153 }
154
155 const gde::Profile
156 gde::GDESession::readProfile(int profileId)
157 {
158   return gde::ProfilesService(*this).readProfile(profileId);
159 }
160
161 const gde::Profile
162 gde::GDESession::updateProfile(const gde::Profile& profile)
163 {
164   return gde::ProfilesService(*this).updateProfile(profile);
165 }
166
167 const gde::ProfileAttribute
168 gde::GDESession::createProfileAttribute(const std::string& name, const std::string& type, int profileId, bool mandatory)
169 {
170   return gde::ProfilesService(*this).createProfileAttribute(name, type, profileId, mandatory);
171 }
172
173 bool
174 gde::GDESession::deleteProfileAttribute(const gde::ProfileAttribute& attribute)
175 {
176   return gde::ProfilesService(*this).deleteProfileAttribute(attribute);
177 }
178
179 const gde::ProfileAttribute
180 gde::GDESession::readProfileAttribute(int attributeId)
181 {
182   return gde::ProfilesService(*this).readProfileAttribute(attributeId);
183 }
184
185 const gde::ProfileAttribute
186 gde::GDESession::updateProfileAttribute(const gde::ProfileAttribute& attribute)
187 {
188   return gde::ProfilesService(*this).updateProfileAttribute(attribute);
189 }