コード例 #1
0
  public String getCategoryDescription() {
    String description = "";

    ArrayList<String> nameList = new ArrayList<String>();
    if (getChildCategoryIdList().size() > 0) {
      for (Long id : getChildCategoryIdList()) {
        CPDecksContentCategory subcategory = CPDecksContentManager.getContentCategory(id);
        if (subcategory != null) {
          nameList.add(subcategory.getTitle());
        }
      }
    } else {
      for (Long id : getContentIdList()) {
        CPDecksContent content = CPDecksContentManager.getContent(id);
        if (content != null & content.getTarget() != null && !content.getTarget().isEmpty()) {
          nameList.add(content.getTarget());
        }
      }
    }
    if (nameList.size() > 0) {
      String delim = "";
      for (String name : nameList) {
        description += delim + name;
        delim = "; ";
      }
    } else {
      description = "<EMPTY>";
    }

    return description;
  }
コード例 #2
0
 public int getCategoryContentCount() {
   int count = getContentIdList().size();
   for (Long id : getChildCategoryIdList()) {
     CPDecksContentCategory subcategory = CPDecksContentManager.getContentCategory(id);
     if (subcategory != null) {
       count += subcategory.getCategoryContentCount();
     }
   }
   return count;
 }
コード例 #3
0
  public String getImageUrl() {
    if (mImageUrl == null || mImageUrl.isEmpty()) {
      for (Long id : getContentIdList()) {
        CPDecksContent content = CPDecksContentManager.getContent(id);
        if (content != null && content.getImageUrl() != null && !content.getImageUrl().isEmpty()) {
          return content.getImageUrl();
        }
      }
      for (Long id : getChildCategoryIdList()) {
        CPDecksContentCategory subcategory = CPDecksContentManager.getContentCategory(id);
        if (subcategory != null
            && subcategory.getImageUrl() != null
            && !subcategory.getImageUrl().isEmpty()) {
          return subcategory.getImageUrl();
        }
      }
    }

    return mImageUrl;
  }
コード例 #4
0
 public int compareTo(CPDecksContentCategory category) {
   if (category == null) {
     return -1;
   }
   return getTitle().compareTo(category.getTitle());
 }