private void checkData(RoomTransfer t) throws RoomAppServicesException {
    int numRoom = t.getnumRoom();
    int numBeds = t.getnumBeds();
    float price = t.getPrice();

    if (price < 0) throw new RoomAppServicesException("Precio invalido");
    if (numBeds <= 0) throw new RoomAppServicesException("Numero camas invalido");
    if (numRoom <= 0) throw new RoomAppServicesException("Numero habitacion invalido");
  }
  @Override
  public void modRoom(RoomTransfer t) throws RoomAppServicesException {
    DAOFactory fac = DAOFactory.getInstance();
    RoomDAO dao = fac.getRoomDAO();

    checkData(t);

    try {
      if (dao.searchRoomByID(t.getId())) {
        if (dao.checkNumRoom(t.getId(), t.getnumRoom())) {
          dao.updateRoom(t);
        } else {
          throw new RoomAppServicesException(
              "la habitacion a modificar intenta cambiar a un número de habitación ya existente");
        }
      } else {
        throw new RoomAppServicesException("la habitacion a modificar no existe");
      }
    } catch (RoomIntegrationException e) {
      throw new RoomAppServicesException(e.getMessage());
    }
  }
  @Override
  public void addRoom(RoomTransfer t) throws RoomAppServicesException {
    DAOFactory fac = DAOFactory.getInstance();
    RoomDAO dao = fac.getRoomDAO();

    checkData(t);

    try {
      if (!dao.searchRoomByRoomID(t.getnumRoom())) {
        dao.createRoom(t);
      } else {
        throw new RoomAppServicesException("La habitacion ya existe");
      }
    } catch (RoomIntegrationException e) {
      throw new RoomAppServicesException(e.getMessage());
    }
  }