Search in sources :

Example 1 with UserProfile

use of com.webstart.model.UserProfile 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 2 with UserProfile

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

the class UsersServiceImpl method getUserprofileuserByJson.

public String getUserprofileuserByJson(Integer userid) {
    // JSONObject jsonObject = new JSONObject();
    // Users user = usersJpaRepository.findOne(userid);
    ObjectMapper mapper = new ObjectMapper();
    // Object to JSON in String
    String jsonInString = null;
    UserProfile userprofile = userProfileJpaRepository.findOne(userid);
    try {
        jsonInString = mapper.writeValueAsString(userprofile);
    } catch (JsonProcessingException e) {
        e.printStackTrace();
    }
    return jsonInString;
}
Also used : UserProfile(com.webstart.model.UserProfile) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

UserProfile (com.webstart.model.UserProfile)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Users (com.webstart.model.Users)1