| 1 | package net.sourceforge.finmodel.ui.action; |
| 2 | |
| 3 | import java.util.Map; |
| 4 | |
| 5 | import org.apache.struts2.interceptor.ParameterAware; |
| 6 | |
| 7 | import net.sourceforge.finmodel.plan.FinancialPlan; |
| 8 | |
| 9 | import com.opensymphony.xwork2.ActionSupport; |
| 10 | |
| 11 | public class PlanAction extends ActionSupport implements ParameterAware { |
| 12 | public static final long serialVersionUID = 1L; |
| 13 | private Map<String, String[]> parameters = null; |
| 14 | |
| 15 | private FinancialPlan plan; |
| 16 | |
| 17 | public String load() throws Exception { |
| 18 | String idStr = parameters.get("plan_id")[0]; |
| 19 | long id = Long.parseLong(idStr); |
| 20 | plan = FinancialPlan.load(id); |
| 21 | |
| 22 | if (plan == null) { |
| 23 | return NONE; |
| 24 | } else { |
| 25 | return SUCCESS; |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | public FinancialPlan getPlan() { |
| 30 | return plan; |
| 31 | } |
| 32 | |
| 33 | public void setPlan(FinancialPlan plan) { |
| 34 | this.plan = plan; |
| 35 | } |
| 36 | |
| 37 | @Override |
| 38 | public void setParameters(Map<String, String[]> parameters) { |
| 39 | this.parameters = parameters; |
| 40 | } |
| 41 | } |