// METODDO ATUALIZAR
  public void atualizarCarro(Carro carro)
      throws CarroNaoEncontradoException, CampoObrigatorioException, IllegalArgumentException {

    if (carro == null) throw new IllegalArgumentException("Carro invalido");
    if (carro.getPlaca().equals("")) throw new CampoObrigatorioException("placa");
    if (carro.getNome().equals("")) throw new CampoObrigatorioException("nome");
    this.repositorioCarro.atualizarCarro(carro);
  }
  // METODO CADASTRAR
  public void cadastarCarro(Carro carro)
      throws CarroJaCadastradoException, CampoObrigatorioException, IllegalArgumentException,
          SQLException {

    if (carro == null) throw new IllegalAccessError("Carro Invalido");
    if (carro.getPlaca().equals("")) throw new CampoObrigatorioException("placa");
    if (carro.getNome().equals("")) throw new CampoObrigatorioException("nome");
    this.repositorioCarro.cadastrarCarro(carro);
  }
Exemplo n.º 3
0
 public static Box localizarCarro(String placa) {
   Box box = null;
   for (int i = 0; i < 50; i++) {
     for (int j = 0; j < 10; j++) {
       box = vagas[i][j];
       Carro carro = box.getCarro();
       if (carro != null && carro.getPlaca().compareTo(placa) == 0) return box;
     }
   }
   return null;
 }
  public void listar() throws SQLException, CarroNaoEncontradoException {
    limparTabelaCarro();
    ArrayList<Carro> carros = fachada.listarCarro();

    try {
      for (Carro carro : carros) {
        Vector vector = new Vector();
        vector.add(carro.getNome());
        vector.add(carro.getPlaca());

        defaultTableModelCarro.addRow(vector);
      } // fim do for
    } catch (Exception e) {

    } // fim do try/catch
  } // fim do metodo listar
Exemplo n.º 5
0
 public static void desocuparVaga(Carro carro, int hora, int minuto) {
   Box box = localizarCarro(carro.getPlaca());
   box.setHorarioSaida(hora, minuto);
 }