use of com.webstart.model.Users in project FarmCloud by vratsasg.
the class UsersServiceImpl method CheckUserExists.
public boolean CheckUserExists(String username) {
Users user;
user = usersJpaRepository.findByUsername(username);
return user != null ? true : false;
}
use of com.webstart.model.Users in project FarmCloud by vratsasg.
the class UsersServiceImpl method userByJson.
public JSONObject userByJson(Integer userid) {
JSONObject jsonObject = new JSONObject();
Users user;
user = usersJpaRepository.findOne(userid);
jsonObject.put("username", user.getUsername());
return jsonObject;
}
use of com.webstart.model.Users in project FarmCloud by vratsasg.
the class UserController method saveUserProfile.
@RequestMapping(value = "notifications/{id}/read", method = RequestMethod.PUT)
public ResponseEntity<?> saveUserProfile(@PathVariable("id") int id, HttpServletRequest httpServletRequest) {
Users users = (Users) httpServletRequest.getSession().getAttribute("current_user");
if (users == null) {
return new ResponseEntity(HttpStatus.UNAUTHORIZED);
}
usersService.makeNotificationRead(id);
return new ResponseEntity<Boolean>(HttpStatus.OK);
}
use of com.webstart.model.Users in project FarmCloud by vratsasg.
the class UserController method saveUserProfile.
@RequestMapping(value = "profile", method = RequestMethod.POST)
public ResponseEntity<Boolean> saveUserProfile(HttpServletRequest httpServletRequest, @RequestBody UserProfile userprofile) {
Users user = new Users();
user = (Users) httpServletRequest.getSession().getAttribute("current_user");
boolean isDone = usersService.saveUserProfiledata(userprofile);
return new ResponseEntity<Boolean>(isDone, HttpStatus.CREATED);
}
use of com.webstart.model.Users in project FarmCloud by vratsasg.
the class UserController method getCounterNotifications.
@RequestMapping(value = "notifications", method = RequestMethod.GET)
@ResponseBody
public List<Notifications> getCounterNotifications(HttpServletRequest request) {
List<Notifications> notificationList = null;
Users users = (Users) request.getSession().getAttribute("current_user");
try {
notificationList = usersService.getUserCounterNotifications(users.getUser_id());
} catch (Exception e) {
e.printStackTrace();
return null;
}
return notificationList;
}
Aggregations