package br.com.colegio.dao.storage;
import java.util.Collection;
import java.util.Map;
import java.util.TreeMap;
import br.com.colegio.dao.LancamentoParcelaDAO;
import br.com.colegio.vo.LancamentoParcela;
public class LancamentoParcelaData
{
private static LancamentoParcelaData instance;
private Map<Long, LancamentoParcela> data = new TreeMap<Long, LancamentoParcela>();
private LancamentoParcelaData()
{
}
public static LancamentoParcelaData getInstance()
{
if (instance == null)
instance = new LancamentoParcelaData();
return instance;
}
private Map<Long, LancamentoParcela> getData()
{
if (data.size() == 0)
{
Collection<Object> r = LancamentoParcelaDAO.list();
if (r != null)
for (Object o : r)
{
LancamentoParcela a = (LancamentoParcela)o;
data.put(a.getKey().getId(), a);
}
}
return data;
}
public LancamentoParcela getLancamentoParcela(Long id)
{
return getData().get(id);
}
public Collection<LancamentoParcela> getLancamentosParcela()
{
return getData().values();
}
}