Example #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);
     }
   }
 }
Example #2
0
File: Vouch.java Project: ayax79/bb
 /**
  * Creates a new instance of Vouch with the guid populated.
  *
  * @return a new instance of Vouch
  */
 public static Vouch createVouch() {
   Vouch vouch = new Vouch();
   Utils.applyGuid(vouch);
   return vouch;
 }
Example #3
0
 public static MediaLibrary createMediaLibrary() {
   MediaLibrary ml = new MediaLibrary();
   Utils.applyGuid(ml);
   return ml;
 }