Пример #1
0
 /**
  * 博客详情
  *
  * @param blog_id
  * @return
  * @throws AppException
  */
 public Blog getBlog(int blog_id, boolean isRefresh) throws AppException {
   Blog blog = null;
   String key = "blog_" + blog_id;
   if (isNetworkConnected() && (!isReadDataCache(key) || isRefresh)) {
     try {
       blog = ApiClient.getBlogDetail(this, blog_id);
       if (blog != null) {
         Notice notice = blog.getNotice();
         blog.setNotice(null);
         blog.setCacheKey(key);
         saveObject(blog, key);
         blog.setNotice(notice);
       }
     } catch (AppException e) {
       blog = (Blog) readObject(key);
       if (blog == null) throw e;
     }
   } else {
     blog = (Blog) readObject(key);
     if (blog == null) blog = new Blog();
   }
   return blog;
 }