Package com.getit.todoapp.domain

Examples of com.getit.todoapp.domain.Userinfo


  @RequestMapping(method = RequestMethod.POST, headers = "Accept=application/json")
    public ResponseEntity<String> createFromJson(@RequestBody String json,Authentication authentication) {
        Todo todo = Todo.fromJsonToTodo(json);
        User user=(User) authentication.getPrincipal();
        Userinfo userinfo=userService.findByUserName(user.getUsername()).get(0);
        todo.setUserName(userinfo);
        todoService.saveTodo(todo);
        HttpHeaders headers = new HttpHeaders();
        headers.add("Content-Type", "application/json");
        return new ResponseEntity<String>(headers, HttpStatus.CREATED);
View Full Code Here


      Collection<GrantedAuthority> userAuthorities = new ArrayList<GrantedAuthority>();
      userAuthorities.add(new SimpleGrantedAuthority(ROLE_USER));

      List<Userinfo> userinfos = userService.findByUserName(username);

      Userinfo userinfo = userinfos.get(0);

      User user = new User(userinfo.getUserName(),
          userinfo.getPassword(), true, true, true, true,
          userAuthorities);
      currentUser.set(user);
      return user;

    } catch (Exception e) {
View Full Code Here

    UserService userService;

  @RequestMapping(value = "/{id}", method = RequestMethod.GET, headers = "Accept=application/json")
    @ResponseBody
    public ResponseEntity<String> showJson(@PathVariable("id") Long id) {
        Userinfo userinfo = userService.findUserinfo(id);
        HttpHeaders headers = new HttpHeaders();
        headers.add("Content-Type", "application/json; charset=utf-8");
        if (userinfo == null) {
            return new ResponseEntity<String>(headers, HttpStatus.NOT_FOUND);
        }
        return new ResponseEntity<String>(userinfo.toJson(), headers, HttpStatus.OK);
    }
View Full Code Here

        return new ResponseEntity<String>(Userinfo.toJsonArray(result), headers, HttpStatus.OK);
    }

  @RequestMapping(method = RequestMethod.POST, headers = "Accept=application/json")
    public ResponseEntity<String> createFromJson(@RequestBody String json) {
        Userinfo userinfo = Userinfo.fromJsonToUserinfo(json);
        userService.saveUserinfo(userinfo);
        HttpHeaders headers = new HttpHeaders();
        headers.add("Content-Type", "application/json");
        return new ResponseEntity<String>(headers, HttpStatus.CREATED);
    }
View Full Code Here

  @RequestMapping(value = "/{id}", method = RequestMethod.PUT, headers = "Accept=application/json")
    public ResponseEntity<String> updateFromJson(@RequestBody String json, @PathVariable("id") Long id) {
        HttpHeaders headers = new HttpHeaders();
        headers.add("Content-Type", "application/json");
        Userinfo userinfo = Userinfo.fromJsonToUserinfo(json);
        if (userService.updateUserinfo(userinfo) == null) {
            return new ResponseEntity<String>(headers, HttpStatus.NOT_FOUND);
        }
        return new ResponseEntity<String>(headers, HttpStatus.OK);
    }
View Full Code Here

        return new ResponseEntity<String>(headers, HttpStatus.OK);
    }

  @RequestMapping(value = "/{id}", method = RequestMethod.DELETE, headers = "Accept=application/json")
    public ResponseEntity<String> deleteFromJson(@PathVariable("id") Long id) {
        Userinfo userinfo = userService.findUserinfo(id);
        HttpHeaders headers = new HttpHeaders();
        headers.add("Content-Type", "application/json");
        if (userinfo == null) {
            return new ResponseEntity<String>(headers, HttpStatus.NOT_FOUND);
        }
View Full Code Here

TOP

Related Classes of com.getit.todoapp.domain.Userinfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.