Package br.com.colegio.dao.storage

Source Code of br.com.colegio.dao.storage.LancamentoParcelaData

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();
  }
}
TOP

Related Classes of br.com.colegio.dao.storage.LancamentoParcelaData

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.