@Inject
  public Export2iCalConverter(
      TimeZoneConverter timezoneConverter,
      RaplaLocale raplaLocale,
      Logger logger,
      ClientFacade facade)
      throws RaplaException {
    this.timezoneConverter = timezoneConverter;
    this.facade = facade;
    this.raplaLocale = raplaLocale;
    this.logger = logger;
    TimeZone zone = timezoneConverter.getImportExportTimeZone();

    calendar = raplaLocale.createCalendar();
    DynamicType[] dynamicTypes =
        facade.getDynamicTypes(DynamicTypeAnnotations.VALUE_CLASSIFICATION_TYPE_RESOURCE);
    for (DynamicType type : dynamicTypes) {
      if (type.getAnnotation(DynamicTypeAnnotations.KEY_LOCATION) != null) {
        hasLocationType = true;
      }
    }
    CompatibilityHints.setHintEnabled(CompatibilityHints.KEY_RELAXED_VALIDATION, true);

    RaplaConfiguration config =
        facade
            .getSystemPreferences()
            .getEntry(Export2iCalPlugin.ICAL_CONFIG, new RaplaConfiguration());
    global_export_attendees =
        config
            .getChild(Export2iCalPlugin.EXPORT_ATTENDEES)
            .getValueAsBoolean(Export2iCalPlugin.DEFAULT_exportAttendees);
    global_export_attendees_participation_status =
        config
            .getChild(Export2iCalPlugin.EXPORT_ATTENDEES_PARTICIPATION_STATUS)
            .getValue(Export2iCalPlugin.DEFAULT_attendee_participation_status);

    try {
      exportAttendeesAttribute =
          config.getChild(Export2iCalPlugin.EXPORT_ATTENDEES_EMAIL_ATTRIBUTE).getValue();
    } catch (ConfigurationException e) {
      exportAttendeesAttribute = "";
      getLogger().info("ExportAttendeesMailAttribute is not set. So do not export as meeting");
    }
    if (zone != null) {
      final String timezoneId = zone.getID();

      try {
        TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry();
        timeZone = registry.getTimeZone(timezoneId);
      } catch (Exception rc) {
        final VTimeZone vTimeZone = new VTimeZone();
        timeZone = new net.fortuna.ical4j.model.TimeZone(vTimeZone);
        final int rawOffset = zone.getRawOffset();
        timeZone.setRawOffset(rawOffset);
      }
    }
  }
Example #2
0
 @Override
 public boolean isEnabled() {
   return config.getAttributeAsBoolean(TimeslotPlugin.DAY_TIMESLOT + ".enabled", true);
 }
Example #3
0
 @Override
 public boolean isEnabled() {
   return config.getAttributeAsBoolean("enabled", true);
 }