示例#1
0
  // only used for topics
  public String getObjectId() {
    String title = getTitle();
    // fetches topic as well
    if (title == null) return null;

    if (type == TYPE_FORUM_TOPIC) {
      BaseForum forum = topic.getBaseForum();
      return "forum_topic/" + id + "/" + title + "\n" + forum.getTitle();
    } else {
      return "forum_forum/" + id + "/" + title;
    }
  }
示例#2
0
  // properties of entities
  public String getTitle() {

    if (type == TYPE_FORUM_TOPIC) {
      if (topic == null) topic = getTopicById(true, id);
      if (topic == null) return null;
      return topic.getTitle();
    } else {
      if (forum == null) forum = getForumById(true, id);
      if (forum == null) return null;
      return forum.getTitle();
    }
  }
示例#3
0
 public int compare(BaseForum forum, BaseForum otherForum) {
   if (forum != null && otherForum != null) {
     Integer index1 = forum.getSortIndex();
     Integer index2 = otherForum.getSortIndex();
     if (index1.intValue() != index2.intValue()) return index1.intValue() - index2.intValue();
     Date date1 = forum.getCreated();
     Date date2 = otherForum.getCreated();
     int rval = date2.compareTo(date1);
     if (rval == 0) {
       return otherForum.getId().compareTo(forum.getId());
     } else {
       return rval;
     }
   }
   return -1;
 }