Пример #1
0
 @Override
 public void cancelAlert(
     Alert alert, EventHandler<Void> successHandler, EventHandler<ErrorEvent> failureHandler) {
   try {
     alertDao.delete(alert);
     successHandler.handle(null);
   } catch (SQLException e) {
     Log.e(LOG_TAG, SQL_EXCEPTION_LOG, e);
     failureHandler.handle(new ErrorEvent(ErrorType.SQL_EXCEPTION));
   }
 }
Пример #2
0
 @Override
 public void getAllAlerts(
     EventHandler<ModelListEvent<Alert>> successHandler, EventHandler<ErrorEvent> failureHandler) {
   try {
     List<Alert> allAlerts = alertDao.findAll();
     successHandler.handle(new ModelListEvent<Alert>(allAlerts));
   } catch (SQLException e) {
     Log.e(LOG_TAG, SQL_EXCEPTION_LOG, e);
     failureHandler.handle(new ErrorEvent(ErrorType.SQL_EXCEPTION));
   }
 }
Пример #3
0
 @Override
 public void saveAlert(
     Alert alert,
     EventHandler<ModelEvent<Alert>> successHandler,
     EventHandler<ErrorEvent> failureHandler) {
   try {
     Alert result = alertDao.save(alert);
     successHandler.handle(new ModelEvent<Alert>(result));
   } catch (SQLException e) {
     Log.e(LOG_TAG, SQL_EXCEPTION_LOG, e);
     failureHandler.handle(new ErrorEvent(ErrorType.SQL_EXCEPTION));
   }
 }
Пример #4
0
  @Override
  public void getAlert(
      Long id,
      EventHandler<ModelEvent<Alert>> successHandler,
      EventHandler<ErrorEvent> failureHandler) {

    try {
      Alert alert = alertDao.findById(id);
      successHandler.handle(new ModelEvent<Alert>(alert));
    } catch (Exception e) {
      Log.e(LOG_TAG, SQL_EXCEPTION_LOG, e);
      failureHandler.handle(new ErrorEvent(ErrorType.SQL_EXCEPTION));
    }
  }