Пример #1
0
 /**
  * Called by the {@link org.yestech.event.multicaster.IEventMulticaster} when the Event is fired.
  *
  * @param occasionRsvpEvent Event registered
  * @param result The result to return
  */
 @Override
 public void handle(OccasionRsvpEvent occasionRsvpEvent, ResultReference<Occasion> result) {
   OccasionRequest request = occasionRsvpEvent.getType();
   String occasionGuid = request.getOccasionGuid();
   String attendeeGuid = request.getAttendeeUserGuid();
   Attendee attendee = occasionDao.loadAttendeeByGuidAndOccasionGuid(occasionGuid, attendeeGuid);
   if (attendee != null) {
     attendee.setAttendingStatus(request.getAttendingStatus());
     attendee.setAcknowledged(true);
     occasionDao.update(attendee);
   } else {
     // check to see if occasion is open...
     Occasion occasion = occasionDao.loadByGuid(occasionGuid);
     if (OccasionType.OPEN.equals(occasion.getOccasionType())) {
       User user = userDao.loadUserByGuid(attendeeGuid);
       attendee = new Attendee();
       Utils.applyGuid(attendee);
       PersistenceUtil.setDates(attendee);
       attendee.setAttendingStatus(request.getAttendingStatus());
       attendee.setBbxUserGuid(attendeeGuid);
       attendee.setAttendeeSource(AttendeeSource.BBOX_NETWORK);
       attendee.setBbxUserName(user.getUsername());
       attendee.setEmail(user.getEmail());
       attendee.setAcknowledged(true);
       List<Occasion> occasions = attendee.getOccasions();
       if (occasions == null) {
         occasions = newArrayList();
         attendee.setOccasions(occasions);
       }
       occasions.add(occasion);
       List<Attendee> attendees = occasion.getAttendees();
       if (attendees == null) {
         attendees = newArrayList();
         occasion.setAttendees(attendees);
       }
       attendees.add(attendee);
       occasionDao.save(occasion);
     }
   }
 }
Пример #2
0
 @Override
 public void handle(DeleteUserEvent deleteUserEvent, ResultReference<IUser> result) {
   userDao.delete(deleteUserEvent.getType());
 }