Beispiel #1
0
  @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");
  }
Beispiel #2
0
  public UnidadeModel obter(final UnidadeModel model) {

    TSDataBaseBrokerIf broker = TSDataBaseBrokerFactory.getDataBaseBrokerIf();

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

    return (UnidadeModel) broker.getObjectBean(UnidadeModel.class, "id", "descricao");
  }
Beispiel #3
0
  public void alterar(final UnidadeModel model) throws TSApplicationException {

    TSDataBaseBrokerIf broker = TSDataBaseBrokerFactory.getDataBaseBrokerIf();

    broker.setPropertySQL("unidadedao.alterar", model.getDescricao(), model.getId());

    broker.execute();
  }
Beispiel #4
0
 public List<Edificio> pesquisarSugestoes(Edificio model, EmpresaModel empresa) {
   TSDataBaseBrokerIf base = TSDataBaseBrokerFactory.getDataBaseBrokerIf();
   base.setPropertySQL(
       "edificiodao.pesquisarsugestoes",
       (TSUtil.isEmpty(model.getNome()) ? null : "%" + model.getNome() + "%"),
       empresa.getId());
   return base.getCollectionBean(Edificio.class, "id", "nome", "flagAtivo");
 }
Beispiel #5
0
  public EstadoModel obterPorEndereco(final EnderecoClienteModel model) {

    TSDataBaseBrokerIf broker = TSDataBaseBrokerFactory.getDataBaseBrokerIf();

    broker.setPropertySQL("estadodao.obterPorEndereco", model.getId());

    return (EstadoModel) broker.getObjectBean(EstadoModel.class, "id", "sigla");
  }
Beispiel #6
0
  @SuppressWarnings("unchecked")
  public List<EstadoModel> pesquisar() {

    TSDataBaseBrokerIf broker = TSDataBaseBrokerFactory.getDataBaseBrokerIf();

    broker.setPropertySQL("estadodao.pesquisar");

    return broker.getCollectionBean(EstadoModel.class, "id", "sigla");
  }
  public ContatoEmpreiteiraModel obter(ContatoEmpreiteiraModel contatoEmpreiteiraModel) {

    TSDataBaseBrokerIf broker = TSDataBaseBrokerFactory.getDataBaseBrokerIf();

    broker.setPropertySQL("contatoempreiteiradao.obter", contatoEmpreiteiraModel.getId());

    return (ContatoEmpreiteiraModel)
        broker.getObjectBean(
            ContatoEmpreiteiraModel.class, "id", "nome", "email", "telefone", "empreiteira.id");
  }
Beispiel #8
0
  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");
  }
  public List<ContatoEmpreiteiraModel> pesquisarPorEmpreiteira(EmpreiteiraModel empreiteiraModel) {

    TSDataBaseBrokerIf broker = TSDataBaseBrokerFactory.getDataBaseBrokerIf();

    broker.setPropertySQL(
        "contatoempreiteiradao.pesquisarporempreiteira", empreiteiraModel.getId());

    return broker.getCollectionBean(
        ContatoEmpreiteiraModel.class, "id", "nome", "email", "telefone");
  }
Beispiel #10
0
 public void alterar(Edificio model) throws TSApplicationException {
   TSDataBaseBrokerIf base = TSDataBaseBrokerFactory.getDataBaseBrokerIf();
   base.setPropertySQL(
       "edificiodao.alterar",
       model.getNome(),
       model.getFlagAtivo(),
       model.getCondominio().getId(),
       model.getId());
   base.execute();
 }
Beispiel #11
0
  public UnidadeModel inserir(final UnidadeModel model) throws TSApplicationException {

    TSDataBaseBrokerIf broker = TSDataBaseBrokerFactory.getDataBaseBrokerIf();

    broker.setPropertySQL("unidadedao.inserir", model.getDescricao());

    broker.execute();

    return model;
  }
Beispiel #12
0
  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();
  }
Beispiel #13
0
 public Edificio inserir(Edificio model, EmpresaModel empresa) throws TSApplicationException {
   TSDataBaseBrokerIf base = TSDataBaseBrokerFactory.getDataBaseBrokerIf();
   model.setId(base.getSequenceNextValue(OSSConstantes.Sequence.CONDOMINIO_ID_SEQ));
   base.setPropertySQL(
       "edificiodao.inserir",
       model.getId(),
       model.getNome(),
       model.getFlagAtivo(),
       model.getCondominio().getId(),
       empresa.getId());
   base.execute();
   return model;
 }
Beispiel #14
0
  public void alterar(final UsuarioModel model) throws TSApplicationException {

    TSDataBaseBrokerIf broker = TSDataBaseBrokerFactory.getDataBaseBrokerIf();

    broker.setPropertySQL(
        "usuariodao.alterar",
        model.getNome(),
        model.getLogin(),
        model.getSenha(),
        model.getFlagAtivo(),
        model.getGrupoModel().getId(),
        Utilitarios.getOrigemAtual().getId(),
        model.getId());

    broker.execute();
  }
Beispiel #15
0
  public UsuarioModel obterPorLogin(final UsuarioModel model) {

    TSDataBaseBrokerIf broker = TSDataBaseBrokerFactory.getDataBaseBrokerIf();

    broker.setPropertySQL("usuariodao.obterporlogin", model.getLogin());

    return (UsuarioModel)
        broker.getObjectBean(
            UsuarioModel.class,
            "id",
            "nome",
            "login",
            "senha",
            "flagAtivo",
            "grupoModel.id",
            "origemModel.id");
  }
Beispiel #16
0
  public EstadoModel obterProximo(final EquipamentoModel model, Date data) {

    TSDataBaseBrokerIf broker = TSDataBaseBrokerFactory.getDataBaseBrokerIf();

    broker.setPropertySQL(
        "estadodao.obterProximo",
        model.getId(),
        TSParseUtil.stringToTimestamp(
            TSParseUtil.dateToString(
                TSDateUtil.addDayDate(data, +1), TSDateUtil.DD_MM_YYYY_HH_MM_SS),
            TSDateUtil.DD_MM_YYYY_HH_MM_SS),
        TSParseUtil.stringToTimestamp(
            TSParseUtil.dateToString(
                TSDateUtil.addDayDate(data, +3), TSDateUtil.DD_MM_YYYY_HH_MM_SS),
            TSDateUtil.DD_MM_YYYY_HH_MM_SS));

    return (EstadoModel) broker.getObjectBean(EstadoModel.class, "id", "sigla");
  }
Beispiel #17
0
  public void inserir(final UsuarioModel model) throws TSApplicationException {

    TSDataBaseBrokerIf broker = TSDataBaseBrokerFactory.getDataBaseBrokerIf();

    model.setId(broker.getSequenceNextValue("usuario_id_seq"));

    broker.setPropertySQL(
        "usuariodao.inserir",
        model.getId(),
        model.getNome(),
        model.getLogin(),
        model.getSenha(),
        model.getFlagAtivo(),
        model.getGrupoModel().getId(),
        Utilitarios.getOrigemAtual().getId());

    broker.execute();
  }
Beispiel #18
0
  public List<Edificio> pesquisar(Edificio model, EmpresaModel empresa) {

    String cep = null;

    if (!TSUtil.isEmpty(model.getCondominio())
        && !TSUtil.isEmpty(model.getCondominio().getLogradouro())) {

      cep =
          TSUtil.isEmpty(model.getCondominio().getLogradouro().getCep())
              ? null
              : model.getCondominio().getLogradouro().getCep();
    }

    String condominio =
        TSUtil.isEmpty(model.getCondominio()) || TSUtil.isEmpty(model.getCondominio().getNome())
            ? null
            : "%" + model.getCondominio().getNome() + "%";

    TSDataBaseBrokerIf base = TSDataBaseBrokerFactory.getDataBaseBrokerIf();
    base.setPropertySQL(
        "edificiodao.pesquisar",
        (TSUtil.isEmpty(model.getNome()) ? null : model.getNome()),
        model.getFlagAtivo(),
        TSUtil.isEmpty(model.getCondominio()) ? null : model.getCondominio().getId(),
        condominio,
        cep,
        empresa.getId());
    return base.getCollectionBean(
        Edificio.class,
        "id",
        "nome",
        "flagAtivo",
        "condominio.id",
        "condominio.nome",
        "condominio.logradouro.bairro.nome",
        "condominio.logradouro.bairro.cidade.nome",
        "condominio.logradouro.bairro.cidade.estado.sigla");
  }
Beispiel #19
0
  @SuppressWarnings("unchecked")
  public List<UnidadeModel> pesquisar(final UnidadeModel model) {

    TSDataBaseBrokerIf broker = TSDataBaseBrokerFactory.getDataBaseBrokerIf();

    StringBuilder sql = new StringBuilder("SELECT A.ID, A.DESCRICAO FROM UNIDADE A");

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

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

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

    broker.setSQL(sql.toString());

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

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

    return broker.getCollectionBean(UnidadeModel.class, "id", "descricao");
  }
Beispiel #20
0
 public Edificio obter(Edificio model) {
   TSDataBaseBrokerIf base = TSDataBaseBrokerFactory.getDataBaseBrokerIf();
   base.setPropertySQL("edificiodao.obter", model.getId());
   return (Edificio)
       base.getObjectBean(Edificio.class, "id", "nome", "flagAtivo", "condominio.id");
 }
Beispiel #21
0
 public void excluir(Edificio model) throws TSApplicationException {
   TSDataBaseBrokerIf base = TSDataBaseBrokerFactory.getDataBaseBrokerIf();
   base.setPropertySQL("edificiodao.excluir", model.getId());
   base.execute();
 }
Beispiel #22
0
  @SuppressWarnings("unchecked")
  public List<UsuarioModel> pesquisar(final UsuarioModel model) {

    TSDataBaseBrokerIf broker = TSDataBaseBrokerFactory.getDataBaseBrokerIf();

    StringBuilder sql =
        new StringBuilder(
            "SELECT A.ID, A.NOME, A.LOGIN, A.SENHA, A.FLAG_ATIVO, A.GRUPO_ID, B.NOME, A.ORIGEM_ID FROM USUARIO A, GRUPO B WHERE A.GRUPO_ID = B.ID AND A.FLAG_ATIVO = ?");

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

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

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

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

    if (!TSUtil.isEmpty(model.getGrupoModel().getId())) {

      sql.append(" AND A.GRUPO_ID = ? ");
    }

    if (!TSUtil.isEmpty(model.getOrigemModel().getId())) {

      sql.append(" AND A.ORIGEM_ID = ? ");
    }

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

    broker.setSQL(sql.toString());

    broker.set(model.getFlagAtivo());

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

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

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

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

    if (!TSUtil.isEmpty(model.getGrupoModel().getId())) {

      broker.set(model.getGrupoModel().getId());
    }

    if (!TSUtil.isEmpty(model.getOrigemModel().getId())) {

      broker.set(Utilitarios.getOrigemAtual().getId());
    }

    return broker.getCollectionBean(
        UsuarioModel.class,
        "id",
        "nome",
        "login",
        "senha",
        "flagAtivo",
        "grupoModel.id",
        "grupoModel.nome",
        "origemModel.id");
  }