Ejemplo n.º 1
0
  private CalendarEvent newCalendarEvent(
      String calendarId, String CalType, String type, boolean isPublic) {
    CalendarEvent categoryEvent = new CalendarEvent();
    categoryEvent.setCalendarId(calendarId);
    categoryEvent.setCalType(CalType);
    categoryEvent.setDescription(randomWords(20));
    if (!isPublic) {
      EventCategory eventCategory = randomEventCategory();
      categoryEvent.setEventCategoryId(eventCategory.getId());
      categoryEvent.setEventCategoryName(eventCategory.getName());
    }
    categoryEvent.setEventState(randomState());
    categoryEvent.setEventType(type);
    long time = randomDateTime(rand.nextInt(365), 0);
    categoryEvent.setFromDateTime(getTime(time));
    time = randomDateTime(rand.nextInt(5), time);
    categoryEvent.setToDateTime(getTime(time));

    categoryEvent.setLocation(DEFAULT_LOCATION);
    categoryEvent.setMessage(randomWords(30));

    categoryEvent.setInvitation(new String[] {EMPTY});
    categoryEvent.setParticipant(new String[] {currentUser});
    categoryEvent.setParticipantStatus(new String[] {currentUser + ":"});
    categoryEvent.setPriority(CalendarEvent.PRIORITY[rand.nextInt(CalendarEvent.PRIORITY.length)]);
    categoryEvent.setSendOption(CalendarSetting.ACTION_NEVER);
    categoryEvent.setStatus(EMPTY);
    categoryEvent.setTaskDelegator(EMPTY);
    categoryEvent.setRepeatType(
        CalendarEvent.REPEATTYPES[rand.nextInt(CalendarEvent.REPEATTYPES.length)]);

    categoryEvent.setSummary(calRandomWords(5));
    categoryEvent.setPrivate(!isPublic);
    return categoryEvent;
  }