Search in sources :

Example 26 with Users

use of com.webstart.model.Users in project FarmCloud by vratsasg.

the class UsersServiceImpl method findUser.

public Users findUser(int userid) {
    Users user;
    user = usersJpaRepository.findOne(userid);
    return user;
}
Also used : Users(com.webstart.model.Users)

Example 27 with Users

use of com.webstart.model.Users in project FarmCloud by vratsasg.

the class HomeController method getMeasuresByObsProperty.

@RequestMapping(value = "/{mydevice}/measures/last", method = RequestMethod.GET)
@ResponseBody
public List<ObservationMeasure> getMeasuresByObsProperty(@PathVariable("mydevice") String mydevice, HttpServletRequest request) {
    Users users = (Users) request.getSession().getAttribute("current_user");
    List<ObservationMeasure> sentData = new ArrayList<ObservationMeasure>();
    try {
        sentData = observationProperyService.getLastObservationbyIdentifier(users.getUser_id(), mydevice);
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
    return sentData;
}
Also used : ArrayList(java.util.ArrayList) Users(com.webstart.model.Users) ParserException(jdk.nashorn.internal.runtime.ParserException) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException)

Example 28 with Users

use of com.webstart.model.Users in project FarmCloud by vratsasg.

the class IndexController method getObsProperties.

@RequestMapping(value = "/topbaruser", method = RequestMethod.GET)
public ResponseEntity<String> getObsProperties(HttpServletRequest request) throws JsonProcessingException {
    Users users;
    users = (Users) request.getSession().getAttribute("current_user");
    // 
    JSONObject jsonObject;
    jsonObject = usersService.userByJson(users.getUser_id());
    return new ResponseEntity<String>(jsonObject.toJSONString(), HttpStatus.OK);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) JSONObject(org.json.simple.JSONObject) Users(com.webstart.model.Users) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 29 with Users

use of com.webstart.model.Users in project FarmCloud by vratsasg.

the class UserController method getUserProfile.

@RequestMapping(value = "profile", method = RequestMethod.GET)
@ResponseBody
public UserProfile getUserProfile(HttpServletRequest httpServletRequest) {
    Users user = new Users();
    user = (Users) httpServletRequest.getSession().getAttribute("current_user");
    UserProfile userprofile = usersService.getUserProfile(user.getUser_id());
    return userprofile;
}
Also used : UserProfile(com.webstart.model.UserProfile) Users(com.webstart.model.Users)

Example 30 with Users

use of com.webstart.model.Users in project FarmCloud by vratsasg.

the class UsersServiceImpl method findUser.

public Users findUser(String username, String password) {
    Users user;
    user = usersJpaRepository.findByUsernameAndPassword(username, password);
    return user;
}
Also used : Users(com.webstart.model.Users)

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