コード例 #1
0
 public void copySubscribers(AEntity from, AEntity to) {
   Subscription fromSubscription = subscriptionDao.getSubscriptionBySubject(from);
   if (fromSubscription == null || fromSubscription.isSubscribersEmailsEmpty()) return;
   Subscription toSubscription = subscriptionDao.getSubscriptionBySubject(to);
   if (toSubscription == null) toSubscription = subscriptionDao.postSubscription(to);
   toSubscription.addSubscribersEmails(fromSubscription.getSubscribersEmails());
 }
コード例 #2
0
 public void subscribe(String email, AEntity subject) {
   if (!Str.isEmail(email)) throw new RuntimeException("Invalid email: " + email);
   email = email.toLowerCase();
   Subscription subscription = subscriptionDao.getSubscriptionBySubject(subject);
   if (subscription == null) subscription = subscriptionDao.postSubscription(subject);
   subscription.addSubscribersEmail(email);
   log.info(email, "subscribed to", subject);
 }