36 lines
865 B
Java
36 lines
865 B
Java
package com.stephenschafer.budget;
|
|
|
|
import java.math.BigDecimal;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
|
|
import lombok.Getter;
|
|
import lombok.Setter;
|
|
import lombok.ToString;
|
|
|
|
@Getter
|
|
@Setter
|
|
@ToString
|
|
public class BudgetAmounts {
|
|
private String year = null;
|
|
private Integer categoryId;
|
|
private BigDecimal yearBudget;
|
|
private Map<Integer, BigDecimal> monthBudgets = new HashMap<>();
|
|
|
|
public void setMonthBudget(final int monthNum, final BigDecimal amount) {
|
|
monthBudgets.put(Integer.valueOf(monthNum), amount);
|
|
}
|
|
|
|
@JsonIgnore
|
|
public Object[] getInsertObjects() {
|
|
final Object[] objects = new Object[14];
|
|
objects[0] = Integer.valueOf(categoryId);
|
|
objects[1] = yearBudget;
|
|
for (int i = 0; i < 12; i++) {
|
|
objects[2 + i] = monthBudgets.get(Integer.valueOf(i));
|
|
}
|
|
return objects;
|
|
}
|
|
}
|