// Path: server/accounting/src/main/java/de/budgetfreak/accounting/domain/Account.java
// @Entity(name = "BF_ACCOUNT")
// public class Account {
// 
//     @Id
//     @GeneratedValue(strategy = GenerationType.IDENTITY)
//     @Column(name = "ID")
//     private Long id;
// 
//     @Column(name = "DESCRIPTION")
//     private String description;
// 
//     @Column(name = "ON_BUDGET")
//     private boolean onBudget;
// 
//     @ManyToOne(fetch = FetchType.LAZY)
//     @JoinColumn(name = "USER_ID")
//     private User user;
// 
//     public Account() {
//     }
// 
//     public Account(String description, boolean onBudget, User user) {
//         this.description = description;
//         this.onBudget = onBudget;
//         this.user = user;
//     }
// 
//     public Long getId() {
//         return id;
//     }
// 
//     public Account setId(Long id) {
//         this.id = id;
//         return this;
//     }
// 
//     public String getDescription() {
//         return description;
//     }
// 
//     public Account setDescription(String description) {
//         this.description = description;
//         return this;
//     }
// 
//     public boolean isOnBudget() {
//         return onBudget;
//     }
// 
//     public Account setOnBudget(boolean onBudget) {
//         this.onBudget = onBudget;
//         return this;
//     }
// 
//     public User getUser() {
//         return user;
//     }
// 
//     public Account setUser(User user) {
//         this.user = user;
//         return this;
//     }
// }
// 
// Path: server/accounting/src/main/java/de/budgetfreak/accounting/domain/AccountRepository.java
// public interface AccountRepository extends JpaRepository<Account, Long> {
// 
//     List<Account> findByUserId(long userId);
// }
// 
// 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/domain/UserRepository.java
// @Repository
// public interface UserRepository extends JpaRepository<User, Long> {
// 
//     User findByName(String name);
// }


import de.budgetfreak.accounting.domain.Account;
import de.budgetfreak.accounting.domain.AccountRepository;
import de.budgetfreak.usermanagement.domain.User;
import de.budgetfreak.usermanagement.domain.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;
import java.util.List;
package de.budgetfreak.accounting.service;



/**
 * Service for managing accounts.
 */
@Service
public class AccountService {

    private AccountRepository accountRepository;
    private UserRepository userRepository;

    @Autowired
    public AccountService(AccountRepository accountRepository, UserRepository userRepository) {
        this.accountRepository = accountRepository;
        this.userRepository = userRepository;
    }

    /**
     * Lists all accounts.
     *
     * @param userId The id of the user who's account we want to access.
     */
    public List<Account> list(long userId) {
// Path: server/accounting/src/main/java/de/budgetfreak/accounting/domain/Account.java
// @Entity(name = "BF_ACCOUNT")
// public class Account {
// 
//     @Id
//     @GeneratedValue(strategy = GenerationType.IDENTITY)
//     @Column(name = "ID")
//     private Long id;
// 
//     @Column(name = "DESCRIPTION")
//     private String description;
// 
//     @Column(name = "ON_BUDGET")
//     private boolean onBudget;
// 
//     @ManyToOne(fetch = FetchType.LAZY)
//     @JoinColumn(name = "USER_ID")
//     private User user;
// 
//     public Account() {
//     }
// 
//     public Account(String description, boolean onBudget, User user) {
//         this.description = description;
//         this.onBudget = onBudget;
//         this.user = user;
//     }
// 
//     public Long getId() {
//         return id;
//     }
// 
//     public Account setId(Long id) {
//         this.id = id;
//         return this;
//     }
// 
//     public String getDescription() {
//         return description;
//     }
// 
//     public Account setDescription(String description) {
//         this.description = description;
//         return this;
//     }
// 
//     public boolean isOnBudget() {
//         return onBudget;
//     }
// 
//     public Account setOnBudget(boolean onBudget) {
//         this.onBudget = onBudget;
//         return this;
//     }
// 
//     public User getUser() {
//         return user;
//     }
// 
//     public Account setUser(User user) {
//         this.user = user;
//         return this;
//     }
// }
// 
// Path: server/accounting/src/main/java/de/budgetfreak/accounting/domain/AccountRepository.java
// public interface AccountRepository extends JpaRepository<Account, Long> {
// 
//     List<Account> findByUserId(long userId);
// }
// 
// 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/domain/UserRepository.java
// @Repository
// public interface UserRepository extends JpaRepository<User, Long> {
// 
//     User findByName(String name);
// }


// Path: server/accounting/src/main/java/de/budgetfreak/accounting/service/AccountService.java
import de.budgetfreak.accounting.domain.Account;
import de.budgetfreak.accounting.domain.AccountRepository;
import de.budgetfreak.usermanagement.domain.User;
import de.budgetfreak.usermanagement.domain.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;
import java.util.List;

package de.budgetfreak.accounting.service;



/**
 * Service for managing accounts.
 */
@Service
public class AccountService {

    private AccountRepository accountRepository;
    private UserRepository userRepository;

    @Autowired
    public AccountService(AccountRepository accountRepository, UserRepository userRepository) {
        this.accountRepository = accountRepository;
        this.userRepository = userRepository;
    }

    /**
     * Lists all accounts.
     *
     * @param userId The id of the user who's account we want to access.
     */
    public List<Account> list(long userId) {
        return accountRepository.findByUserId(userId);