コード例 #1
0
 @Override
 public void updateCategory(Photocategory category) {
   try {
     this.category.update(category);
   } catch (SQLException e) {
     log.setExcetion(tag, e);
   }
 }
コード例 #2
0
 public PhotocategoryImpl(Context context) {
   try {
     NfyhCloudDataOpenHelp db = NfyhCloudDataBase.getDataOpenHelp(context);
     this.category = db.getPhotocategory();
   } catch (SQLException e) {
     log.setExcetion(tag, e);
   }
 }
コード例 #3
0
 @Override
 public Photocategory getCategory(String id) {
   try {
     return this.category.queryForId(id);
   } catch (SQLException e) {
     log.setExcetion(tag, e);
   }
   return null;
 }
コード例 #4
0
 @Override
 public void addCategory(Photocategory category) {
   try {
     // 如果存在则更新
     if (this.category.queryForId(category.getPid()) != null) {
       this.category.update(category);
     } else {
       this.category.create(category);
     }
   } catch (SQLException e) {
     log.setExcetion(tag, e);
   }
 }
コード例 #5
0
 @Override
 public List<Photos> getPhotos(String categoryId) {
   if (noUid()) return null;
   try {
     return this.photo
         .queryBuilder()
         .where()
         .eq("_Users_uid", this.uid)
         .and()
         .eq("categoryid", categoryId)
         .query();
   } catch (SQLException e) {
     log.setExcetion(categoryId, e);
     return null;
   }
 }
コード例 #6
0
  @Override
  public List<Photocategory> getCategories(String id) {
    if (noUid()) {
      return null;
    }

    Where<Photocategory, String> where = this.category.queryBuilder().where();
    List<Photocategory> datas = null;
    try {

      datas = where.eq("_Users_uid", this.uid).and().eq("parentid", id).query(); // 找子类

      return datas;
    } catch (SQLException e) {
      log.setExcetion(id, e);
      return null;
    }
  }