当前位置: 首页>>代码示例>>Java>>正文


Java ResultSet.isExhausted方法代码示例

本文整理汇总了Java中com.datastax.driver.core.ResultSet.isExhausted方法的典型用法代码示例。如果您正苦于以下问题:Java ResultSet.isExhausted方法的具体用法?Java ResultSet.isExhausted怎么用?Java ResultSet.isExhausted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.datastax.driver.core.ResultSet的用法示例。


在下文中一共展示了ResultSet.isExhausted方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: userLikedPost

import com.datastax.driver.core.ResultSet; //导入方法依赖的package包/类
/**
 * userLikedPost
 * @param postId
 * @param userId
 * @return true if param userId liked param postId and false otherwise
 * @throws Exception
 */
public static boolean userLikedPost (
  UUID postId,
  UUID userId) throws Exception {
  
  ResultSet resultSet =
    PostLikesTime.i().executeSyncSelect(
      postId,
      userId);
  
  if (resultSet.isExhausted() == true) {
    
    return false;
  }
  
  return true;
}
 
开发者ID:vangav,项目名称:vos_instagram,代码行数:24,代码来源:CheckersInl.java

示例2: doHealthCheck

import com.datastax.driver.core.ResultSet; //导入方法依赖的package包/类
@Override
protected void doHealthCheck(Health.Builder builder) throws Exception {
    log.debug("Initializing Cassandra health indicator");
    try {
        ResultSet results = session.execute(validationStmt.bind());
        if (results.isExhausted()) {
            builder.up();
        } else {
            builder.up().withDetail("version", results.one().getString(0));
        }
    } catch (Exception e) {
        log.debug("Cannot connect to Cassandra cluster. Error: {}", e);
        builder.down(e);
    }
}
 
开发者ID:xm-online,项目名称:xm-ms-timeline,代码行数:16,代码来源:CassandraHealthIndicator.java

示例3: authenticateRequest

import com.datastax.driver.core.ResultSet; //导入方法依赖的package包/类
@Override
protected void authenticateRequest (
  final Request request) throws Exception {
  
  // TODO: implement
  
  // get request's body
  RequestSignupEmail requestSignupEmail =
    (RequestSignupEmail)request.getRequestJsonBody();
  
  ResultSet resultSet =
    EmailCreds.i().executeSyncSelect(requestSignupEmail.email);
  
  // email already signed up?
  if (resultSet.isExhausted() == false) {
    
    throw new BadRequestException(
      427,
      1,
      "Email ["
        + requestSignupEmail.email
        + "] is already signed up, request issued from device_token ["
        + requestSignupEmail.device_token
        + "]",
      ExceptionClass.AUTHENTICATION);
  }
}
 
开发者ID:vangav,项目名称:vos_instagram,代码行数:28,代码来源:HandlerSignupEmail.java

示例4: userFacebookIdExists

import com.datastax.driver.core.ResultSet; //导入方法依赖的package包/类
/**
 * userFacebookIdExists
 * @param facebookId
 * @return true if user with param facebookId exists in the database and
 *           false otherwise
 * @throws Exception
 */
public static boolean userFacebookIdExists (
  String facebookId) throws Exception {
  
  ResultSet resultSet =
    FacebookIds.i().executeSyncSelect(facebookId);
  
  if (resultSet.isExhausted() == true) {
    
    return false;
  }
  
  return true;
}
 
开发者ID:vangav,项目名称:vos_instagram,代码行数:21,代码来源:CheckersInl.java

示例5: loadCityBots

import com.datastax.driver.core.ResultSet; //导入方法依赖的package包/类
/**
 * loadCityBots
 * loads city bots
 * @throws Exception
 */
private void loadCityBots () throws Exception {
  
  ResultSet resultSet = Cities.i().executeSyncSelectAll();
  
  if (resultSet.isExhausted() == true) {
    
    return;
  }
  
  Calendar startCalendar = CalendarAndDateOperationsInl.getCurrentCalendar();
  
  startCalendar =
    RoundedOffCalendarInl.getRoundedCalendar(
      startCalendar,
      RoundingType.FUTURE,
      RoundingFactor.DAY_OF_MONTH);
  
  for (Row row : resultSet) {
    
    this.airportCodes.add(row.getString(Cities.kAirportCodeColumnName) );
    
    PeriodicJobsManager.i().registerNewPeriodicJob(
      new CityBot(
        startCalendar,
        row.getString(Cities.kAirportCodeColumnName),
        row.getDouble(Cities.kLatitudeColumnName),
        row.getDouble(Cities.kLongitudeColumnName),
        row.getInt(Cities.kPopulationInMillionsColumnName),
        row.getString(Cities.kAddedYearMonthDayColumnName) ) );
  }
}
 
开发者ID:vangav,项目名称:vos_instagram_bots,代码行数:37,代码来源:CityBotsLoader.java

示例6: process

import com.datastax.driver.core.ResultSet; //导入方法依赖的package包/类
@Override
protected void process(CycleLog cycleLog) throws Exception {
  
  // get cycle's planned start calendar
  Calendar plannedStartCalendar =
    CalendarAndDateOperationsInl.getCalendarFromUnixTime(
      cycleLog.getPlannedStartTime() );
  
  // -1 hour -- this cycle should check for the jobs from the past hour
  plannedStartCalendar.set(Calendar.HOUR_OF_DAY, -1);
  
  // query all jobs within cycle's hour
  ResultSet resultSet =
    HourlyCurrentJobs.i().executeSyncSelect(
      CalendarFormatterInl.concatCalendarFields(
        plannedStartCalendar,
        Calendar.YEAR,
        Calendar.MONTH,
        Calendar.DAY_OF_MONTH,
        Calendar.HOUR_OF_DAY) );
  
  // to to fetch each job
  ResultSet currJobResultSet;
  
  String currSerializedJob;
  Job currJob;
  
  // retry executing every found job (failed to execute job)
  for (Row row : resultSet) {
    
    if (resultSet.getAvailableWithoutFetching() <=
        Constants.kCassandraPrefetchLimit &&
        resultSet.isFullyFetched() == false) {
      
      // this is asynchronous
      resultSet.fetchMoreResults();
    }
    
    // select job
    currJobResultSet =
      CurrentJobs.i().executeSyncSelect(
        row.getUUID(HourlyCurrentJobs.kJobIdColumnName) );
    
    // couldn't get job?
    if (currJobResultSet.isExhausted() == true) {
      
      // may need to log an exception here depending how how this service,
      //   the main service and the dispense work together - in terms of sync
      continue;
    }
    
    // get serialized job
    currSerializedJob =
      EncodingInl.decodeStringFromByteBuffer(
        currJobResultSet.one().getBytes(
          CurrentJobs.kJobColumnName) );
    
    // deserialize
    currJob = SerializationInl.<Job>deserializeObject(currSerializedJob);
    
    // execute job (retry)
    JobsExecutorInl.executeJobsAsync(currJob);
  }
}
 
开发者ID:vangav,项目名称:vos_instagram_jobs,代码行数:65,代码来源:RestJobs.java

示例7: processRequest

import com.datastax.driver.core.ResultSet; //导入方法依赖的package包/类
@Override
protected void processRequest (final Request request) throws Exception {

  // use the following request Object to process the request and set
  //   the response to be returned
  RequestGetPhoto requestGetPhoto =
    (RequestGetPhoto)request.getRequestJsonBody();
  
  // select photo from database
  
  ResultSet resultSet =
    PhotosBlobs.i().executeSyncSelect(
      UUID.fromString(requestGetPhoto.photo_id) );
  
  if (resultSet.isExhausted() == true) {
    
    throw new BadRequestException(
      408,
      1,
      "Photo with photo_id ["
        + requestGetPhoto.photo_id
        + "] doesn't exist, request issued by user_id ["
        + requestGetPhoto.user_id
        + "] from device_token ["
        + requestGetPhoto.device_token
        + "]",
      ExceptionClass.INVALID);
  }
  
  // Extract photo
  ByteBuffer photoByteBuffer =
    resultSet.one().getBytes(PhotosBlobs.kPhotoColumnName);
  
  // decode photo
  String photoString =
    EncodingInl.decodeStringFromByteBuffer(photoByteBuffer);

  // set response
  ((ResponseGetPhoto)request.getResponseBody() ).set(
    requestGetPhoto.request_tracking_id,
    photoString);
}
 
开发者ID:vangav,项目名称:vos_instagram,代码行数:43,代码来源:HandlerGetPhoto.java

示例8: authenticateRequest

import com.datastax.driver.core.ResultSet; //导入方法依赖的package包/类
@Override
protected void authenticateRequest (
  final Request request) throws Exception {

  // get request's authenticator Object
  Authenticator authenticator =
    this.getRequestAuthenticator(request.getRequestJsonBody() );
  
  // no authentication for this controller's request?
  if (authenticator == null) {
    
    return;
  }
  
  // select user's password
  ResultSet resultSet =
    AuthCreds.i().executeSyncSelect(authenticator.getUserId() );
  
  // user isn't signed up?
  if (resultSet.isExhausted() == true) {
    
    throw new BadRequestException(
      300,
      1,
      "No password for user's id ["
        + authenticator.getUserId().toString()
        + "]",
      ExceptionClass.AUTHENTICATION);
  }
  
  // get user's password
  String password = resultSet.one().getString(AuthCreds.kPasswordColumnName);
  
  // wrong password?
  if (password.compareTo(authenticator.getPassword() ) != 0) {
    
    throw new BadRequestException(
      300,
      2,
      "Wrong password for user's id ["
        + authenticator.getUserId().toString()
        + "], expected password ["
        + password
        + "] but got password ["
        + authenticator.getPassword()
        + "]",
      ExceptionClass.AUTHENTICATION);
  }
  
  // authentication went through successfully
}
 
开发者ID:vangav,项目名称:vos_whatsapp,代码行数:52,代码来源:CommonPlayHandler.java

示例9: processRequest

import com.datastax.driver.core.ResultSet; //导入方法依赖的package包/类
@Override
protected void processRequest (final Request request) throws Exception {

  // use the following request Object to process the request and set
  //   the response to be returned
  RequestGetProfilePicture requestGetProfilePicture =
    (RequestGetProfilePicture)request.getRequestJsonBody();
  
  // set/check get_profile_picture_user_id
  
  UUID getProfilePictureUserId =
    UUID.fromString(requestGetProfilePicture.get_profile_picture_user_id);
  
  if (requestGetProfilePicture.get_profile_picture_user_id.compareTo(
        requestGetProfilePicture.user_id) != 0) {
  
    if (CheckersInl.userIdExists(getProfilePictureUserId) == false) {
      
      throw new BadRequestException(
        414,
        1,
        "User with user_id ["
          + requestGetProfilePicture.get_profile_picture_user_id
          + "] doesn't exist, request issued by user_id ["
          + requestGetProfilePicture.user_id
          + "] from device_token ["
          + requestGetProfilePicture.device_token
          + "]",
        ExceptionClass.INVALID);
    }
  }
  
  // get user's profile_picture_id
  ResultSet resultSet =
    UsersInfo.i().executeSyncSelectProfilePictureId(getProfilePictureUserId);
  
  // no profile picture for this user?
  if (resultSet.isExhausted() == true) {
    
    // set empty response
    ((ResponseGetProfilePicture)request.getResponseBody() ).set(
      requestGetProfilePicture.request_tracking_id,
      "");
    
    return;
  }
  
  // extract profile_picture_id from result
  UUID profilePictureId =
    resultSet.one().getUUID(UsersInfo.kProfilePictureIdColumnName);
  
  // get profile picture
  resultSet =
    ProfilePicturesBlobs.i().executeSyncSelect(profilePictureId);
  
  // extract profile picture
  ByteBuffer profilePictureByteBuffer =
    resultSet.one().getBytes(ProfilePicturesBlobs.kPictureColumnName);
  
  // decode profile picture
  String profilePictureString =
    EncodingInl.decodeStringFromByteBuffer(profilePictureByteBuffer);
  
  // set response
  ((ResponseGetProfilePicture)request.getResponseBody() ).set(
    requestGetProfilePicture.request_tracking_id,
    profilePictureString);
}
 
开发者ID:vangav,项目名称:vos_instagram,代码行数:69,代码来源:HandlerGetProfilePicture.java

示例10: processRequest

import com.datastax.driver.core.ResultSet; //导入方法依赖的package包/类
@Override
protected void processRequest (final Request request) throws Exception {

  // use the following request Object to process the request and set
  //   the response to be returned
  RequestComment requestComment =
    (RequestComment)request.getRequestJsonBody();
  
  UUID postId = UUID.fromString(requestComment.post_id);
  
  // post doesn't exist?
  if (CheckersInl.postExists(postId) == false) {
    
    throw new BadRequestException(
      401,
      1,
      "Can't comment on a post that doesn't exist, post_id ["
        + requestComment.post_id
        + "]. Request issued by user_id ["
        + requestComment.user_id
        + "] from device_token ["
        + requestComment.device_token
        + "]",
      ExceptionClass.INVALID);
  }
  
  // NOTE: vos_instagram intentionally allows only one comment for each
  //         user on a post
  //       in case a user comments more than once on the same post, the newer
  //         comment overwrites the older one
  
  // all queries must succeed
  BatchStatement batchStatement = new BatchStatement(Type.LOGGED);
  
  ResultSet resultSet =
    PostCommentsTime.i().executeSyncSelect(
      postId,
      requestComment.getUserId() );
  
  // user commented on this post before?
  if (resultSet.isExhausted() == false) {

    long oldCommentTime =
      resultSet.one().getLong(PostCommentsTime.kCommentTimeColumnName);
    
    // delete old user's comment
    batchStatement.add(
      PostComments.i().getBoundStatementDelete(
        postId,
        oldCommentTime,
        requestComment.getUserId() ) );
  } else {
    
    // first time for this user to comment on this post? increment comments
    //   count
    PostCommentsCount.i().executeSyncIncrement(postId);
  }
  
  // insert into ig_app_data.post_comments
  batchStatement.add(
    PostComments.i().getBoundStatementInsert(
      postId,
      request.getStartTime(),
      requestComment.getUserId(),
      requestComment.comment) );
  
  // insert into ig_app_data.post_comments_time
  batchStatement.add(
    PostCommentsTime.i().getBoundStatementInsert(
      postId,
      requestComment.getUserId(),
      request.getStartTime() ) );
  
  // execute batch statement
  Cassandra.i().executeSync(batchStatement);
  
  // set response
  ((ResponseComment)request.getResponseBody() ).set(
    requestComment.request_tracking_id,
    request.getStartTime() );
}
 
开发者ID:vangav,项目名称:vos_instagram,代码行数:82,代码来源:HandlerComment.java

示例11: processRequest

import com.datastax.driver.core.ResultSet; //导入方法依赖的package包/类
@Override
protected void processRequest (final Request request) throws Exception {

  // use the following request Object to process the request and set
  //   the response to be returned
  RequestDeleteComment requestDeleteComment =
    (RequestDeleteComment)request.getRequestJsonBody();
  
  // get post comment's time
  
  UUID postId = UUID.fromString(requestDeleteComment.post_id);
  
  ResultSet resultSet =
    PostCommentsTime.i().executeSyncSelect(
      postId,
      requestDeleteComment.getUserId() );
  
  // post/comment doesn't exist?
  if (resultSet.isExhausted() == true) {
    
    throw new BadRequestException(
      402,
      1,
      "User ["
        + requestDeleteComment.user_id
        + "] didn't comment on post ["
        + requestDeleteComment.post_id
        + "], then can't delete a comment that doesn't exist",
      ExceptionClass.INVALID);
  }
  
  // extract comment time
  long commentTime =
    resultSet.one().getLong(PostCommentsTime.kCommentTimeColumnName);
  
  // all queries must succeed
  BatchStatement batchStatement = new BatchStatement(Type.LOGGED);
  
  // delete from ig_app_data.post_comments
  batchStatement.add(
    PostComments.i().getBoundStatementDelete(
      postId,
      commentTime,
      requestDeleteComment.getUserId() ) );
  
  // delete from ig_app_data.post_comments_time
  batchStatement.add(
    PostCommentsTime.i().getBoundStatementDelete(
      postId,
      requestDeleteComment.getUserId() ) );
  
  // execute batch statement
  Cassandra.i().executeSync(batchStatement);
  
  // decrement ig_app_data.post_comments_count
  PostCommentsCount.i().executeSyncDecrement(postId);
  
  // set response
  ((ResponseDeleteComment)request.getResponseBody() ).set(
    requestDeleteComment.request_tracking_id);
}
 
开发者ID:vangav,项目名称:vos_instagram,代码行数:62,代码来源:HandlerDeleteComment.java

示例12: authenticateRequest

import com.datastax.driver.core.ResultSet; //导入方法依赖的package包/类
@Override
protected void authenticateRequest (
  final Request request) throws Exception {
  
  // get request's body
  RequestLoginEmail requestLoginEmail =
    (RequestLoginEmail)request.getRequestJsonBody();
  
  // select user's password
  ResultSet resultSet =
    EmailCreds.i().executeSyncSelect(requestLoginEmail.email);
  
  // email isn't registered?
  if (resultSet.isExhausted() == true) {
    
    throw new BadRequestException(
      421,
      1,
      "Email ["
        + requestLoginEmail.email
        + "] isn't registered, request sent from device_token ["
        + requestLoginEmail.device_token
        + "]",
      ExceptionClass.AUTHENTICATION);
  }
  
  // extract password
  Row row = resultSet.one();
  
  String password = row.getString(EmailCreds.kPasswordColumnName);
  
  // wrong password?
  if (requestLoginEmail.password.compareTo(password) != 0) {
    
    throw new BadRequestException(
      421,
      2,
      "Wrong password ["
        + requestLoginEmail.password
        + "], expected password ["
        + password
        + "] for email ["
        + requestLoginEmail.email
        + "], request sent from device_token ["
        + requestLoginEmail.device_token
        + "]",
      ExceptionClass.AUTHENTICATION);
  }
}
 
开发者ID:vangav,项目名称:vos_instagram,代码行数:50,代码来源:HandlerLoginEmail.java

示例13: processRequest

import com.datastax.driver.core.ResultSet; //导入方法依赖的package包/类
@Override
protected void processRequest (final Request request) throws Exception {

  // use the following request Object to process the request and set
  //   the response to be returned
  RequestLoginEmail requestLoginEmail =
    (RequestLoginEmail)request.getRequestJsonBody();

  // select user's password and user_id
  ResultSet resultSet =
    EmailCreds.i().executeSyncSelect(requestLoginEmail.email);
  
  // email isn't registered? -- in case authentication is disabled
  if (resultSet.isExhausted() == true) {
    
    throw new BadRequestException(
      421,
      3,
      "Email ["
        + requestLoginEmail.email
        + "] isn't registered, request sent from device_token ["
        + requestLoginEmail.device_token
        + "]",
      ExceptionClass.AUTHENTICATION);
  }
  
  // extract user_id
  Row row = resultSet.one();
  
  UUID userId = row.getUUID(EmailCreds.kUserIdColumnName);
  
  // set user's id
  request.setUserId(userId);

  // generate new authentication tokens
  OAuth2Tokens oAuth2Tokens = new OAuth2Tokens();
  
  // insert into ig_auth.auth_codes
  AuthCodes.i().executeSyncInsert(
    userId,
    requestLoginEmail.device_token,
    oAuth2Tokens.getAuthorizationCode(),
    oAuth2Tokens.getAccessToken(),
    oAuth2Tokens.getRefreshToken(),
    ((int)Constants.kAuthCodeLifeTime.getAs(
      TimeUnitType.SECOND).getValue() ) );
  
  // set response
  ((ResponseLoginEmail)request.getResponseBody() ).set(
    requestLoginEmail.request_tracking_id,
    userId.toString(),
    oAuth2Tokens.getAuthorizationCode() );
}
 
开发者ID:vangav,项目名称:vos_instagram,代码行数:54,代码来源:HandlerLoginEmail.java

示例14: processRequest

import com.datastax.driver.core.ResultSet; //导入方法依赖的package包/类
@Override
protected void processRequest (final Request request) throws Exception {

  // use the following request Object to process the request and set
  //   the response to be returned
  RequestGetPhotoThumbnail requestGetPhotoThumbnail =
    (RequestGetPhotoThumbnail)request.getRequestJsonBody();
  
  // select photo thumbnail from database
  
  ResultSet resultSet =
    PhotosThumnbnailsBlobs.i().executeSyncSelect(
      UUID.fromString(requestGetPhotoThumbnail.photo_id) );
  
  if (resultSet.isExhausted() == true) {
    
    throw new BadRequestException(
      409,
      1,
      "Photo with photo_id ["
        + requestGetPhotoThumbnail.photo_id
        + "] doesn't exist, request issued by user_id ["
        + requestGetPhotoThumbnail.user_id
        + "] from device_token ["
        + requestGetPhotoThumbnail.device_token
        + "]",
      ExceptionClass.INVALID);
  }
  
  // Extract photo thumbnail
  ByteBuffer photoThumbnailByteBuffer =
    resultSet.one().getBytes(
      PhotosThumnbnailsBlobs.kPhotoThumbnailColumnName);
  
  // decode photo thumbnail
  String photoThumbnailString =
    EncodingInl.decodeStringFromByteBuffer(photoThumbnailByteBuffer);
  
  // set response
  ((ResponseGetPhotoThumbnail)request.getResponseBody() ).set(
    requestGetPhotoThumbnail.request_tracking_id,
    photoThumbnailString);
}
 
开发者ID:vangav,项目名称:vos_instagram,代码行数:44,代码来源:HandlerGetPhotoThumbnail.java

示例15: processRequest

import com.datastax.driver.core.ResultSet; //导入方法依赖的package包/类
@Override
protected void processRequest (final Request request) throws Exception {

  // use the following request Object to process the request and set
  //   the response to be returned
  RequestGetUserInfo requestGetUserInfo =
    (RequestGetUserInfo)request.getRequestJsonBody();
  
  // get user's id
  ResultSet resultSet =
    PhoneNumbers.i().executeSyncSelect(
      requestGetUserInfo.get_user_info_phone_number);
  
  // user not registered?
  if (resultSet.isExhausted() == true) {
    
    throw new BadRequestException(
      302,
      1,
      "User with phone number ["
        + requestGetUserInfo.get_user_info_phone_number
        + "] is not registered",
      ExceptionClass.INVALID);
  }
  
  // get user's id
  UUID userId = resultSet.one().getUUID(PhoneNumbers.kUserIdColumnName);
  
  // get user's name
  resultSet =
    UsersInfo.i().executeSyncSelectName(userId);
  
  // not user info?
  if (resultSet.isExhausted() == true) {
    
    throw new CodeException(
      302,
      2,
      "Didn't find user_info for user_id ["
        + userId.toString()
        + "] and phone_number ["
        + requestGetUserInfo.get_user_info_phone_number
        + "]",
      ExceptionClass.MISSING_ITEM);
  }
  
  // get user's name
  String name = resultSet.one().getString(UsersInfo.kNameColumnName);
  
  // set response
  ((ResponseGetUserInfo)request.getResponseBody() ).set(
    userId.toString(),
    name);
}
 
开发者ID:vangav,项目名称:vos_whatsapp,代码行数:55,代码来源:HandlerGetUserInfo.java


注:本文中的com.datastax.driver.core.ResultSet.isExhausted方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。