public void subscribeEventType(String email, ItEventType... eventTypes) { System.out.println("User with email " + email + " was registered"); StringBuilder tagsBuilder = new StringBuilder(); for (ItEventType itEventType : eventTypes) { tagsBuilder.append(itEventType.toString()).append(","); } subscriberPersistenceService.subscribeEmail(email, tagsBuilder.toString()); }
public void addEvent(ItEvent event) { eventPersistenceService.saveEvent(event); List<Subscriber> subscribers = subscriberPersistenceService.getSybscribersByTag(event.getItEventType().toString()); for (Subscriber subscriber : subscribers) { mailSender.sendMail( subscriber.getEmail(), "New Event " + event.getDescription() + " will start on " + event.getStartDate()); } System.out.println("Event " + event + " was added"); }