Package com.appspot.piment.api.tqq.model

Examples of com.appspot.piment.api.tqq.model.MessageResponse


    log.info("DEBUG --->" + singleStatusResponse);

    tempParams.clear();

    MessageResponse msgResponse = JSON.decode(singleStatusResponse, MessageResponse.class);
    if (msgResponse.isOK()) {
    if (msgResponse.getData() != null) {
      Date sinceDate = msgResponse.getData().getTimestamp();
      tempParams.putAll(params);
      tempParams.put("pageflag", "2");
      //tempParams.put("reqnum", "0");
      //tempParams.put("lastid", "0");
      tempParams.put("pagetime", Long.toString(sinceDate.getTime()));
    } else {
      //FIXME
      tempParams.putAll(params);
      tempParams.put("reqnum", "1");
    }
    } else {
    throw new RuntimeException(singleStatusResponse);
    }
  } else {
    tempParams.putAll(params);
    tempParams.put("reqnum", this.configMap.get("qq.broadcast.timeline.reqnum"));
  }
  tempParams.put("type", "1");

  String timeline_url = "http://open.t.qq.com/api/statuses/broadcast_timeline_ids";
  String final_timeline_url = getSignedURL(Constants.HTTP_GET, timeline_url, tempParams);
  log.info("final_timeline_url -->" + final_timeline_url);
  String response = HttpClient.doGet(final_timeline_url);
 
  log.info("DEBUG --> " + response);

  TimelineResponse timelineResponse = JSON.decode(response, TimelineResponse.class);

  if (timelineResponse != null && timelineResponse.isOK()) {
    for (TimelineData.Info timelineInfo : timelineResponse.getData().getInfo()) {
    tempParams.clear();
    tempParams.put("format", "json");
    tempParams.put("id", timelineInfo.getId());
    tempParams.putAll(getFixedParams());

    String url = "http://open.t.qq.com/api/t/show";
    String final_url = getSignedURL(Constants.HTTP_GET, url, tempParams);
    log.info("final_url -->" + final_url);
    String singleStatusResponse = HttpClient.doGet(final_url);
   
    log.info("DEBUG --> " + singleStatusResponse);

    MessageResponse msgResponse = JSON.decode(singleStatusResponse, MessageResponse.class);
    if (msgResponse.isOK()) {
      result.add(msgResponse);
    } else {
      MessageData data = new MessageData();
      data.setId(timelineInfo.getId());
      data.setTimestamp(timelineInfo.getTimestamp());
      msgResponse.setData(data);
      result.add(msgResponse);
    }
    }
  }
View Full Code Here


    List<MessageResponse> newUserMessages = tqqWeiboApi.getUserTimeline(lastestCreateWeiboMap != null ? lastestCreateWeiboMap.getTqqWeiboId() : null);

    log.info("Tqq message --> 同期化件数:" + newUserMessages.size());

    // メッセージ単位で同期化処理を行う
    MessageResponse msgResponse = null;
    for (int i = newUserMessages.size() - 1; i >= 0; i--) {
    msgResponse = newUserMessages.get(i);

    if (this.weiboMapDao.getByTqqWeiboId(Long.valueOf(msgResponse.getData().getId())) == null) {
      syncTqqUserMessage(user, msgResponse, new WeiboMap());
    } else {
      log.info("Tqq message --> [" + msgResponse.getData().getId() + "] 同期化済みでスキップする。");
    }
    }

    return null;
View Full Code Here

TOP

Related Classes of com.appspot.piment.api.tqq.model.MessageResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.