Beispiel #1
0
 public boolean equals(Object other) {
   if ((this == other)) return true;
   if ((other == null)) return false;
   if (!(other instanceof Topic)) return false;
   Topic t = (Topic) other;
   return (t.getTopicID() == this.getTopicID());
 }
Beispiel #2
0
  public static boolean needsHighlight(Topic t, User u) {
    boolean highlight = true;
    Transaction tx = null;
    Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    try {
      tx = session.getTransaction();
      Query q =
          session.createQuery(
              "select ls "
                  + "  from LastseenTopic as ls "
                  + " where ls.userID = :userID "
                  + "   and ls.topicID = :topicID "
                  + "   and ls.lasttime > :lastedit");
      q.setInteger("userID", u.getId());
      q.setInteger("topicID", t.getTopicID());
      q.setDate("lastedit", t.getLastedit());
      List<LastseenTopic> lsts = q.list();
      if (lsts.size() > 0) {
        highlight = lsts.get(0).getLasttime().before(t.getLastedit());
      }

    } catch (HibernateException e) {
      e.printStackTrace();
      if (tx != null && tx.isActive()) tx.rollback();
    }
    return highlight;
  }