Пример #1
0
 public static void checkAuthor(Author author) {
   AuthorUpdateEvent event = null;
   switch (author.getTypeSite()) {
     case LITERA:
       event = litera.checkUpdateAuthor(author);
       break;
     case SAMLIB:
       for (Date d : SamLibUpdater.getDaysFrom(author.getLastCheck(), new Date())) {
         event = getSamlib(d).checkUpdateAuthor(author);
         if (event != null) break;
       }
       if (event == null) event = getSamlib(new Date()).checkUpdateAuthor(author);
   }
   author.setLastCheck(new Date());
   if (event != null) {
     author.setLastUpdate(event.getUpdateTime());
     Logger.getLogger()
         .print(
             "Обнаруженно обновление автора " + author.getName() + " от " + event.getUpdateTime());
     subscribe.sendUpdateEvent(event);
   }
 }
Пример #2
0
 @Override
 public void authorUpdate(AuthorUpdateEvent e) {
   e.getAuthor().setLastUpdate(e.getUpdateTime()).setLastCheck(new Date());
 }