Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Users updateUser(Users requestBody) throws AppServiceException {
- Users user = new Users();
- try {
- user = userDAO.getUserByUserId(requestBody.getUserId());
- if (requestBody.getRole() != null && !requestBody.getRole().isEmpty()) {
- user.setRole(requestBody.getRole());
- }
- if (requestBody.getUserName() != null && !requestBody.getUserName().isEmpty()) {
- user.setUserName(requestBody.getUserName());
- }
- if (requestBody.getChannelType() != null && !requestBody.getChannelType().isEmpty()) {
- user.setChannelType(requestBody.getChannelType());
- }
- if (requestBody.getStatus() != null && !requestBody.getStatus().isEmpty()) {
- user.setStatus(requestBody.getStatus());
- }
- if (requestBody.getDevice() != null) {
- user.setDevice(requestBody.getDevice());
- }
- user.setUpdatedDate(new Date());
- user = userDAO.updateUser(user);
- } catch (Exception e) {
- e.printStackTrace();
- throw new AppServiceException(AppServiceException._FAIL_TO_UPDATE);
- }
- return user;
- }
Add Comment
Please, Sign In to add comment