@@ -0,0 +1,2037 @@
+package io.teiler.server.persistence.entities;%0A%0Aimport java.util.List;%0Aimport java.util.stream.Collectors;%0A%0Aimport javax.persistence.Column;%0Aimport javax.persistence.DiscriminatorValue;%0Aimport javax.persistence.Entity;%0Aimport javax.persistence.FetchType;%0Aimport javax.persistence.OneToMany;%0Aimport javax.validation.constraints.NotNull;%0A%0Aimport io.teiler.server.dto.Expense;%0Aimport io.teiler.server.dto.TransactionType;%0Aimport io.teiler.server.util.TimeUtil;%0A%0A/**%0A * Entity representing an Expense-entry of the %3Ccode%3Etransaction%3C/code%3E-table.%0A * %0A * @author pbaechli%0A */%0A@Entity%0A@DiscriminatorValue(%22expense%22)%0Apublic class ExpenseEntity extends TransactionEntity %7B%0A%0A    @NotNull%0A    @Column(name = %22title%22)%0A    private String title;%0A%0A    @OneToMany(mappedBy = %22person%22, fetch = FetchType.EAGER)%0A    private List%3CProfiteerEntity%3E profiteers;%0A%0A    public ExpenseEntity() %7B /* intentionally empty */ %7D%0A%0A    public ExpenseEntity(Expense expense) %7B%0A        super.setId(expense.getId());%0A        super.setAmount(expense.getAmount());%0A        super.setPayer(new PersonEntity(expense.getPayer()));%0A        super.setUpdateTime(TimeUtil.convertToTimestamp(expense.getUpdateTime()));%0A        super.setCreateTime(TimeUtil.convertToTimestamp(expense.getCreateTime()));%0A        super.setTransactionType(TransactionType.expense);%0A%0A        this.title = expense.getTitle();%0A    %7D%0A%0A    public Expense toExpense() %7B%0A        return new Expense(getId(), getAmount(), getPayer().toPerson(),%0A                TimeUtil.convertToLocalDateTime(getUpdateTime()),%0A                TimeUtil.convertToLocalDateTime(getCreateTime()), title,%0A                profiteers.stream().map(p -%3E p.toShare()).collect(Collectors.toList()));%0A    %7D%0A%0A    public String getTitle() %7B%0A        return title;%0A    %7D%0A%0A    public void setTitle(String title) %7B%0A        this.title = title;%0A    %7D%0A%0A    public List%3CProfiteerEntity%3E getProfiteers() %7B%0A        return profiteers;%0A    %7D%0A%0A    public void setProfiteers(List%3CProfiteerEntity%3E profiteers) %7B%0A        this.profiteers = profiteers;%0A    %7D%0A%0A%7D%0A

add expense entity (#173)