コード例 #1
0
 public Object getHistoricalObject(History event) throws HibernateException {
   if (event.getAction().equals(History.DELETED)) {
     return null;
   }
   return DomainMetaDataRepository.getInstance()
       .getObject(event.getObjectType(), event.getTargetId());
 }
コード例 #2
0
 private boolean isEventThrottled(Session session, History event) throws HibernateException {
   if (event.getAction().equals(History.UPDATED)) {
     History previousEvent =
         (History)
             session
                 .createQuery(
                     "from event in "
                         + History.class
                         + " where event.targetId = :oid and event.action = :action order by event.whenHappened desc")
                 .setInteger("oid", event.getTargetId())
                 .setString("action", History.UPDATED)
                 .setMaxResults(1)
                 .uniqueResult();
     return previousEvent != null
         && (event.getWhenHappened().getTime() - previousEvent.getWhenHappened().getTime())
             < FIFTEEN_MINUTES;
   } else {
     return false;
   }
 }