コード例 #1
0
  public NSArray<AttendeeSelectedVEvent> myEventForAttendeeList() {
    NSArray<VEvent> venueEvents = venue.eventsSorted();
    NSArray<AttendeeSelectedVEvent> attendeeSelectedVEvents =
        attendee.selectedEventsForVenue(venue);

    NSMutableArray<AttendeeSelectedVEvent> results =
        attendeeSelectedVEvents.mutableClone(); // new NSMutableArray<AttendeeSelectedVEvent>();

    int attendeeSelectedVEventsCount = attendeeSelectedVEvents.count();

    for (int venueEventIndex = 0; venueEventIndex < venueEvents.count(); venueEventIndex++) {
      VEvent vEvent = venueEvents.objectAtIndex(venueEventIndex);
      boolean eventFound = false;
      // ------------
      for (int attendeeSelectedVEventIndex = 0;
          attendeeSelectedVEventIndex < attendeeSelectedVEventsCount;
          attendeeSelectedVEventIndex++) {
        VEvent attendeeSelectedVEvent =
            attendeeSelectedVEvents.objectAtIndex(attendeeSelectedVEventIndex).event();
        if (attendeeSelectedVEvent.equals(vEvent)) {
          log.debug("Not adding " + vEvent.lable());
          eventFound = true;
          break;
        }
      }
      // ------------
      if (!eventFound) {
        log.debug("Adding event " + vEvent.lable());
        AttendeeSelectedVEvent newAttendeeSelectedVEvents =
            (AttendeeSelectedVEvent)
                (EOUtilities.createAndInsertInstance(ec, AttendeeSelectedVEvent.ENTITY_NAME));
        newAttendeeSelectedVEvents.setParticipants(0);
        newAttendeeSelectedVEvents.setEventRelationship(vEvent);
        newAttendeeSelectedVEvents.setVenueRelationship(venue);
        attendee.addToSelectedEventsRelationship(newAttendeeSelectedVEvents);
        results.addObject(newAttendeeSelectedVEvents);
      }
    }
    return results; // attendee.selectedEventsForVenue(venue);
  }