Java 类org.codehaus.jackson.map.util.ISO8601DateFormat 实例源码

项目:watchoverme-server    文件:SparkPostEventLogger.java   
public List<EmailLogVO> saveTransmissionLog(String transmissionId) throws JSONException {
    int perPage = 1000;
    int page = 0;
    int total = 0;

    do {
        page++;
        JSONObject jsonResponse = getTransmissionLog(transmissionId, page, perPage);

        JSONArray jsonLogs = jsonResponse.getJSONArray("results");
        for (int i = 0, len = jsonLogs.length(); i < len; i++) {
            JSONObject jsonLog = jsonLogs.getJSONObject(i);

            EmailLogVO emailLogVO = emailLogDAO.findByProviderAndMessageId(SparkPostEmailService.EMAIL_SERVICE_NAME, jsonLog.getString("message_id"));
            if (emailLogVO != null) {
                emailLogDAO.update(emailLogVO);
            } else {
                emailLogVO = new EmailLogVO();

                ISO8601DateFormat dateFormat = new ISO8601DateFormat();
                dateFormat.parse(jsonLog.getString("tdate"), new ParsePosition(0));

                emailLogDAO.create(emailLogVO);
            }
        }

        total = jsonResponse.optInt("total_count", 0);
    } while(page * perPage < total);

    return null;
}