@SuppressWarnings("unchecked")
  public List<FormaPagamentoModel> pesquisar(final FormaPagamentoModel model) {

    TSDataBaseBrokerIf broker = TSDataBaseBrokerFactory.getDataBaseBrokerIf();

    StringBuilder sql =
        new StringBuilder(
            "SELECT A.ID, A.DESCRICAO, A.FLAG_ATIVO, A.FLAG_EXIBIR_ORIGEM FROM FORMA_PAGAMENTO A WHERE A.FLAG_ATIVO = ?");

    if (!TSUtil.isEmpty(model.getDescricao())) {

      sql.append(" AND SEM_ACENTOS (A.DESCRICAO) LIKE SEM_ACENTOS (?) ");
    }

    sql.append(" ORDER BY A.DESCRICAO");

    broker.setSQL(sql.toString());

    broker.set(model.getFlagAtivo());

    if (!TSUtil.isEmpty(model.getDescricao())) {

      broker.set("%" + model.getDescricao() + "%");
    }

    return broker.getCollectionBean(
        FormaPagamentoModel.class, "id", "descricao", "flagAtivo", "flagExibirOrigem");
  }
  public void alterar(final FormaPagamentoModel model) throws TSApplicationException {

    TSDataBaseBrokerIf broker = TSDataBaseBrokerFactory.getDataBaseBrokerIf();

    broker.setPropertySQL(
        "formapagamentodao.alterar",
        model.getDescricao(),
        model.getFlagAtivo(),
        model.getFlagExibirOrigem(),
        model.getId());

    broker.execute();
  }
  public FormaPagamentoModel obter(final FormaPagamentoModel model) {

    TSDataBaseBrokerIf broker = TSDataBaseBrokerFactory.getDataBaseBrokerIf();

    broker.setPropertySQL("formapagamentodao.obter", model.getId());

    return (FormaPagamentoModel)
        broker.getObjectBean(
            FormaPagamentoModel.class, "id", "descricao", "flagAtivo", "flagExibirOrigem");
  }