@SuppressWarnings("rawtypes")
  @Override
  public boolean processEvents(List<AsyncEvent> events) {
    LOG.info("processEvents: events.size={}", events.size());

    try {
      for (AsyncEvent event : events) {
        LOG.info("processEvents: event={}", event);

        Operation op = event.getOperation();
        Account acct = (Account) event.getDeserializedValue();

        if ((op.isCreate() || op.isUpdate()) && !op.isLoad()) {
          LOG.info("processEvents: save: acct={}", acct);
          mapper.save(acct);
        } else if (op.isDestroy() && !op.isEviction() && !op.isExpiration()) {
          LOG.info("processEvents: delete: acct={}", acct);
          mapper.delete(acct);
        }
      }
    } catch (Exception x) {
      LOG.error("processEvents: x={}", x.toString(), x);
    }

    return true;
  }
 public ProjectRegionMilestone save(ProjectRegionMilestone projectRegionMilestone) {
   if (projectRegionMilestone.getId() == null) {
     projectRegionMilestone.setId(UUID.randomUUID());
   }
   mapper.save(projectRegionMilestone);
   return projectRegionMilestone;
 }
 public void saveConnection(SocialUserConnection socialUserConnection) {
   try {
     mapper.save(socialUserConnection);
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
 public void removeConnection(String userId, String providerId, String providerUserId) {
   try {
     SocialUserConnection socialUserConnection = getConnection(userId, providerId, providerUserId);
     if (socialUserConnection != null) {
       mapper.delete(socialUserConnection);
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
  public List<SocialUserConnection> findConnectionsByUserId(String userId) {
    try {
      Statement selectConnections =
          QueryBuilder.select()
              .all()
              .from(keyspace, table)
              .where(QueryBuilder.eq("userid", userId));

      ResultSet rs = session.execute(selectConnections);
      return mapper.map(rs).all();
    } catch (Exception e) {
      e.printStackTrace();
    }
    return null;
  }
  public List<SocialUserConnection> findPrimaryConnections(String userId, String providerId) {
    try {
      Statement selectConnections =
          QueryBuilder.select()
              .all()
              .from(keyspace, table)
              .where(QueryBuilder.eq("userid", userId))
              .and(
                  QueryBuilder.eq(
                      "providerid", providerId)) /*.orderBy(QueryBuilder.desc("rank"))*/;

      ResultSet rs = session.execute(selectConnections);
      return mapper.map(rs).all();
    } catch (Exception e) {
      e.printStackTrace();
    }
    return null;
  }
 @Override
 public UUID saveSum(DBCheckSum dbCheckSum) {
   dbCheckSumMapper.save(dbCheckSum);
   return dbCheckSum.getId();
 }
 public void delete(UUID id) {
   mapper.delete(id);
 }
 public ProjectRegionMilestone findOne(UUID id) {
   return mapper.get(id);
 }
 public void removeConnections(String userId, String providerId) {
   for (SocialUserConnection socialUserConnection : findPrimaryConnections(userId, providerId)) {
     mapper.delete(socialUserConnection);
   }
 }
 public SocialUserConnection getConnection(
     String userId, String providerId, String providerUserId) {
   return mapper.get(userId, providerId, providerUserId);
 }