Commit 2eebb165401e20371aa3e971795aacbefbe21111

Authored by Ronan
1 parent 81044ef5

Merge on UserEndPoint and PArameterNAme

skilldr-data_model/src/main/java/eu/totoandco/data/parameter/ParameterName.java
... ... @@ -17,6 +17,9 @@
17 17 package eu.totoandco.data.parameter;
18 18  
19 19 /**
  20 + * Enum defining the different Parameter of the application
  21 + * The id correspond to the one in database.
  22 + * The value is a String containing parameter's value
20 23 * @author Ronan Presle
21 24 *
22 25 */
... ...
skilldr-rs/src/main/java/eu/totoandco/rs/UserEndPoint.java
... ... @@ -16,8 +16,6 @@
16 16 */
17 17 package eu.totoandco.rs;
18 18  
19   -import java.util.List;
20   -
21 19 import javax.ejb.EJB;
22 20 import javax.ejb.Stateless;
23 21 import javax.servlet.http.HttpServletRequest;
... ... @@ -36,7 +34,6 @@ import eu.totoandco.exception.ExceptionLevel;
36 34 import eu.totoandco.exception.MessageCarrier;
37 35 import eu.totoandco.exception.MessageText;
38 36 import eu.totoandco.exception.RestException;
39   -import eu.totoandco.model.Skill;
40 37 import eu.totoandco.model.User;
41 38  
42 39 /**
... ... @@ -52,7 +49,7 @@ public class UserEndPoint extends EndPoint {
52 49 * UserAccess EJB that provides business method
53 50 */
54 51 @EJB
55   - UserManager userAccess;
  52 + UserManager userManager;
56 53  
57 54 /**
58 55 * Method used to connect user to server
... ... @@ -74,8 +71,8 @@ public class UserEndPoint extends EndPoint {
74 71 throw new RestException(MessageCarrier
75 72 .message(MessageText.ERROR_STRING_EMPTY)
76 73 .level(ExceptionLevel.INFO).build());
77   - }
78   - User userSession = userAccess.connectUser(login, pwd);
  74 + }
  75 + User userSession = userManager.connectUser(login, pwd);
79 76 if (userSession != null) {
80 77 request.getSession(true).setAttribute(USERSESSION, userSession);
81 78 }
... ... @@ -125,7 +122,7 @@ public class UserEndPoint extends EndPoint {
125 122 .message(MessageText.ERROR_STRING_EMPTY)
126 123 .level(ExceptionLevel.INFO).build());
127 124 }
128   - User userSession = userAccess.addUser(login, pwd, firstname, name);
  125 + User userSession = userManager.addUser(login, pwd, firstname,name);
129 126 if (userSession != null) {
130 127 request.getSession(true).setAttribute(USERSESSION, userSession);
131 128 }
... ... @@ -149,7 +146,7 @@ public class UserEndPoint extends EndPoint {
149 146 .message(MessageText.ERROR_OBJECT_NULL)
150 147 .level(ExceptionLevel.INFO).build());
151 148 }
152   - return userAccess.removeUser((User) request.getSession(false)
  149 + return userManager.removeUser((User) request.getSession(false)
153 150 .getAttribute(USERSESSION), idUser);
154 151 }
155 152  
... ... @@ -162,7 +159,7 @@ public class UserEndPoint extends EndPoint {
162 159 @POST
163 160 @Path("/userTmp")
164 161 public User addUserTmp(@Context HttpServletRequest request) {
165   - User userSession = userAccess.addUser(null, null, null, null);
  162 + User userSession = userManager.addUser(null,null,null,null);
166 163 if (userSession != null) {
167 164 request.getSession(true).setAttribute(USERSESSION, userSession);
168 165 }
... ... @@ -189,7 +186,7 @@ public class UserEndPoint extends EndPoint {
189 186 .message(MessageText.ERROR_STRING_EMPTY)
190 187 .level(ExceptionLevel.INFO).build());
191 188 }
192   - return userAccess.grantPermission((User) request.getSession(false)
  189 + return userManager.grantPermission((User) request.getSession(false)
193 190 .getAttribute(USERSESSION), login, role);
194 191 }
195 192  
... ... @@ -222,22 +219,8 @@ public class UserEndPoint extends EndPoint {
222 219 .message(MessageText.ERROR_STRING_EMPTY)
223 220 .level(ExceptionLevel.INFO).build());
224 221 }
225   - return userAccess.updateUser((User) request.getSession(false)
226   - .getAttribute(USERSESSION), login, pwd, firstname, name);
227   - }
228   -
229   - /**
230   - * Get all the skill of the current user
231   - *
232   - * @param request
233   - * User's context
234   - * @return the list of the user's skills
235   - */
236   - @GET
237   - @Path("/p/userSkills")
238   - public List<Skill> getUserSkills(@Context HttpServletRequest request) {
239   - List<Skill> skills = null;
240   - skills = userAccess.getUserSkills(1);
241   - return skills;
  222 + return userManager.updateUser(
  223 + (User) request.getSession(false).getAttribute(USERSESSION), login,
  224 + pwd, firstname, name);
242 225 }
243 226 }
... ...