public Master createTemp(int category) { Master master = new Master(); master.setCategory(category); master.setId(-1); master.setCode(""); master.setName(""); return master; }
public Master getMaster(Integer category, String code) { List<Master> ms = getMasters(category); for (Master m : ms) { if (m.getCode().equals(code)) { return m; } } return null; }
public String getMasterName(String id) { if (id == null || id.length() == 0) { return ""; } Master m = orignals.get(Integer.parseInt(id)); if (m != null) { return m.getName(); } return ""; }
public String getMasterName(Integer id) { if (id == null) { return ""; } Master m = orignals.get(id); if (m != null) { return m.getName(); } return ""; }
public String getMasterName(int category, String code) { List<Master> ms = masters.get(category); if (ms != null) { for (Master m : ms) { if (m.getCode().equals(code)) { return m.getName(); } } } return ""; }
public void init(List<Master> ms) { for (Master m : ms) { orignals.put(m.getId(), m); List<Master> cms = masters.get(m.getCategory()); if (cms == null) { cms = new ArrayList<Master>(); masters.put(m.getCategory(), cms); } cms.add(m); } }