Search in sources :

Example 6 with Users

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;
}
Also used : Users(com.webstart.model.Users)

Example 7 with Users

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;
}
Also used : JSONObject(org.json.simple.JSONObject) Users(com.webstart.model.Users)

Example 8 with Users

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);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) Users(com.webstart.model.Users)

Example 9 with Users

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);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) Users(com.webstart.model.Users)

Example 10 with Users

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;
}
Also used : Users(com.webstart.model.Users) Notifications(com.webstart.model.Notifications)

Aggregations

Users (com.webstart.model.Users)30 ResponseEntity (org.springframework.http.ResponseEntity)18 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)12 ParserException (jdk.nashorn.internal.runtime.ParserException)12 Featureofinterest (com.webstart.model.Featureofinterest)9 HelperCls (com.webstart.Helpers.HelperCls)8 DateTime (org.joda.time.DateTime)8 DateTimeFormatter (org.joda.time.format.DateTimeFormatter)8 LocalDateTime (org.joda.time.LocalDateTime)6 ByteArrayOutputStream (java.io.ByteArrayOutputStream)4 ArrayList (java.util.ArrayList)4 JSONObject (org.json.simple.JSONObject)4 HttpHeaders (org.springframework.http.HttpHeaders)4 ObservableMeasure (com.webstart.DTO.ObservableMeasure)3 WateringMeasure (com.webstart.DTO.WateringMeasure)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 com.itextpdf.text (com.itextpdf.text)2 WateringValueTime (com.webstart.DTO.WateringValueTime)2 SimpleDateFormat (java.text.SimpleDateFormat)2 HSSFWorkbook (org.apache.poi.hssf.usermodel.HSSFWorkbook)2