// Path: server/user-management/src/main/java/de/budgetfreak/usermanagement/domain/User.java
// @Entity(name = "BF_USER")
// public class User {
// 
//     @Id
//     @GeneratedValue(strategy = GenerationType.IDENTITY)
//     @Column(name = "ID")
//     private Long id;
// 
//     @Column(name = "NAME")
//     private String name;
// 
//     @Column(name = "CURRENCY")
//     private String currency;
// 
//     public User() {
//     }
// 
//     public User(String name, String currency) {
//         this.name = name;
//         this.currency = currency;
//     }
// 
//     public Long getId() {
//         return id;
//     }
// 
//     public User setId(Long id) {
//         this.id = id;
//         return this;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public User setName(String name) {
//         this.name = name;
//         return this;
//     }
// 
//     public String getCurrency() {
//         return currency;
//     }
// 
//     public User setCurrency(String currency) {
//         this.currency = currency;
//         return this;
//     }
// }
// 
// Path: server/user-management/src/main/java/de/budgetfreak/usermanagement/service/UserService.java
// @Service
// @EnableConfigurationProperties(UserManagementProperties.class)
// public class UserService {
// 
//     private UserRepository userRepository;
//     private UserManagementProperties userManagementProperties;
// 
//     @Autowired
//     public UserService(UserRepository userRepository, UserManagementProperties userManagementProperties) {
//         this.userRepository = userRepository;
//         this.userManagementProperties = userManagementProperties;
//     }
// 
//     /**
//      * List all users in no given order.
//      */
//     public List<User> list() {
//         return userRepository.findAll();
//     }
// 
//     /**
//      * Create and saves an user.
//      *
//      * @return The created entity.
//      */
//     public User create(String name, String currency) {
//         final User user = new User(name, currency);
//         return userRepository.save(user);
//     }
// 
//     /**
//      * Get one user by id.
//      */
//     public User get(long id) {
//         return userRepository.findOne(Example.of(new User().setId(id))).orElse(null);
//     }
// 
//     /**
//      * Reads the testProperty.
//      *
//      * @return The configured property.
//      */
//     public String getTestProperty() {
//         return userManagementProperties.getTestProperty();
//     }
// }


import de.budgetfreak.usermanagement.domain.User;
import de.budgetfreak.usermanagement.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.Resource;
import org.springframework.hateoas.Resources;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
package de.budgetfreak.usermanagement.web;




/**
 * Controller for accessing users.
 */
@RestController
@RequestMapping("/users")
public class UserController {

    private UserService userService;
    private UserResourceAssembler userResourceAssembler;

    @InitBinder
    protected void initBinder(WebDataBinder binder) {
        // TODO Maybe define global validators?
        binder.setValidator(new UserResourceValidator());
    }


    @Autowired
    public UserController(UserService userService, UserResourceAssembler userResourceAssembler) {
        this.userService = userService;
        this.userResourceAssembler = userResourceAssembler;
    }

    /**
     * List all users in no given order.
     */
    @GetMapping
    public Resources<UserResource> list() {
// Path: server/user-management/src/main/java/de/budgetfreak/usermanagement/domain/User.java
// @Entity(name = "BF_USER")
// public class User {
// 
//     @Id
//     @GeneratedValue(strategy = GenerationType.IDENTITY)
//     @Column(name = "ID")
//     private Long id;
// 
//     @Column(name = "NAME")
//     private String name;
// 
//     @Column(name = "CURRENCY")
//     private String currency;
// 
//     public User() {
//     }
// 
//     public User(String name, String currency) {
//         this.name = name;
//         this.currency = currency;
//     }
// 
//     public Long getId() {
//         return id;
//     }
// 
//     public User setId(Long id) {
//         this.id = id;
//         return this;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public User setName(String name) {
//         this.name = name;
//         return this;
//     }
// 
//     public String getCurrency() {
//         return currency;
//     }
// 
//     public User setCurrency(String currency) {
//         this.currency = currency;
//         return this;
//     }
// }
// 
// Path: server/user-management/src/main/java/de/budgetfreak/usermanagement/service/UserService.java
// @Service
// @EnableConfigurationProperties(UserManagementProperties.class)
// public class UserService {
// 
//     private UserRepository userRepository;
//     private UserManagementProperties userManagementProperties;
// 
//     @Autowired
//     public UserService(UserRepository userRepository, UserManagementProperties userManagementProperties) {
//         this.userRepository = userRepository;
//         this.userManagementProperties = userManagementProperties;
//     }
// 
//     /**
//      * List all users in no given order.
//      */
//     public List<User> list() {
//         return userRepository.findAll();
//     }
// 
//     /**
//      * Create and saves an user.
//      *
//      * @return The created entity.
//      */
//     public User create(String name, String currency) {
//         final User user = new User(name, currency);
//         return userRepository.save(user);
//     }
// 
//     /**
//      * Get one user by id.
//      */
//     public User get(long id) {
//         return userRepository.findOne(Example.of(new User().setId(id))).orElse(null);
//     }
// 
//     /**
//      * Reads the testProperty.
//      *
//      * @return The configured property.
//      */
//     public String getTestProperty() {
//         return userManagementProperties.getTestProperty();
//     }
// }


// Path: server/user-management/src/main/java/de/budgetfreak/usermanagement/web/UserController.java
import de.budgetfreak.usermanagement.domain.User;
import de.budgetfreak.usermanagement.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.hateoas.Link;
import org.springframework.hateoas.Resource;
import org.springframework.hateoas.Resources;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;

package de.budgetfreak.usermanagement.web;




/**
 * Controller for accessing users.
 */
@RestController
@RequestMapping("/users")
public class UserController {

    private UserService userService;
    private UserResourceAssembler userResourceAssembler;

    @InitBinder
    protected void initBinder(WebDataBinder binder) {
        // TODO Maybe define global validators?
        binder.setValidator(new UserResourceValidator());
    }


    @Autowired
    public UserController(UserService userService, UserResourceAssembler userResourceAssembler) {
        this.userService = userService;
        this.userResourceAssembler = userResourceAssembler;
    }

    /**
     * List all users in no given order.
     */
    @GetMapping
    public Resources<UserResource> list() {
        List<User> users = userService.list();