001/* 002 * Copyright 2022 Anyware Services 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.ametys.plugins.calendar.icsreader.ical4j; 017 018import java.util.ArrayList; 019import java.util.Arrays; 020import java.util.List; 021import java.util.function.Supplier; 022 023import net.fortuna.ical4j.model.Property; 024import net.fortuna.ical4j.model.PropertyFactory; 025import net.fortuna.ical4j.model.property.Acknowledged; 026import net.fortuna.ical4j.model.property.Action; 027import net.fortuna.ical4j.model.property.Attach; 028import net.fortuna.ical4j.model.property.Attendee; 029import net.fortuna.ical4j.model.property.BusyType; 030import net.fortuna.ical4j.model.property.CalScale; 031import net.fortuna.ical4j.model.property.Categories; 032import net.fortuna.ical4j.model.property.Clazz; 033import net.fortuna.ical4j.model.property.Color; 034import net.fortuna.ical4j.model.property.Comment; 035import net.fortuna.ical4j.model.property.Completed; 036import net.fortuna.ical4j.model.property.Conference; 037import net.fortuna.ical4j.model.property.Contact; 038import net.fortuna.ical4j.model.property.Country; 039import net.fortuna.ical4j.model.property.Created; 040import net.fortuna.ical4j.model.property.Description; 041import net.fortuna.ical4j.model.property.DtEnd; 042import net.fortuna.ical4j.model.property.DtStamp; 043import net.fortuna.ical4j.model.property.DtStart; 044import net.fortuna.ical4j.model.property.Due; 045import net.fortuna.ical4j.model.property.Duration; 046import net.fortuna.ical4j.model.property.ExDate; 047import net.fortuna.ical4j.model.property.ExRule; 048import net.fortuna.ical4j.model.property.ExtendedAddress; 049import net.fortuna.ical4j.model.property.FreeBusy; 050import net.fortuna.ical4j.model.property.Geo; 051import net.fortuna.ical4j.model.property.Image; 052import net.fortuna.ical4j.model.property.LastModified; 053import net.fortuna.ical4j.model.property.Locality; 054import net.fortuna.ical4j.model.property.Location; 055import net.fortuna.ical4j.model.property.LocationType; 056import net.fortuna.ical4j.model.property.Method; 057import net.fortuna.ical4j.model.property.Name; 058import net.fortuna.ical4j.model.property.Organizer; 059import net.fortuna.ical4j.model.property.PercentComplete; 060import net.fortuna.ical4j.model.property.Postalcode; 061import net.fortuna.ical4j.model.property.Priority; 062import net.fortuna.ical4j.model.property.ProdId; 063import net.fortuna.ical4j.model.property.RDate; 064import net.fortuna.ical4j.model.property.RRule; 065import net.fortuna.ical4j.model.property.RecurrenceId; 066import net.fortuna.ical4j.model.property.RefreshInterval; 067import net.fortuna.ical4j.model.property.Region; 068import net.fortuna.ical4j.model.property.RelatedTo; 069import net.fortuna.ical4j.model.property.Repeat; 070import net.fortuna.ical4j.model.property.RequestStatus; 071import net.fortuna.ical4j.model.property.Resources; 072import net.fortuna.ical4j.model.property.Sequence; 073import net.fortuna.ical4j.model.property.Source; 074import net.fortuna.ical4j.model.property.Status; 075import net.fortuna.ical4j.model.property.StreetAddress; 076import net.fortuna.ical4j.model.property.Summary; 077import net.fortuna.ical4j.model.property.Tel; 078import net.fortuna.ical4j.model.property.Transp; 079import net.fortuna.ical4j.model.property.Trigger; 080import net.fortuna.ical4j.model.property.TzId; 081import net.fortuna.ical4j.model.property.TzName; 082import net.fortuna.ical4j.model.property.TzOffsetFrom; 083import net.fortuna.ical4j.model.property.TzOffsetTo; 084import net.fortuna.ical4j.model.property.TzUrl; 085import net.fortuna.ical4j.model.property.Uid; 086import net.fortuna.ical4j.model.property.Url; 087import net.fortuna.ical4j.model.property.Version; 088 089//FIXME this class has been taken from the ical4j's github repo, in a branch without the javax.mail dependency 090//to be removed as soon as ical4j 4.0 is released 091//ical4j is licensed under the BSD license 092@SuppressWarnings("all") 093public class DefaultPropertyFactorySupplier implements Supplier<List<PropertyFactory<?>>> { 094 095 @Override 096 public List<PropertyFactory<?>> get() { 097 List<PropertyFactory<?>> rfc5545 = Arrays.<PropertyFactory<?>>asList(new Acknowledged.Factory(), 098 new Action.Factory(), new Attach.Factory(), new Attendee.Factory(), new BusyType.Factory(), 099 new CalScale.Factory(), new Categories.Factory(), new Clazz.Factory(), new Comment.Factory(), 100 new Completed.Factory(), new Contact.Factory(), new Country.Factory(), new Created.Factory(), 101 new Description.Factory(), new DtEnd.Factory(), new DtStamp.Factory(), new DtStart.Factory(), 102 new Due.Factory(), new Duration.Factory(), new ExDate.Factory(), new ExRule.Factory(), 103 new ExtendedAddress.Factory(), new FreeBusy.Factory(), new Geo.Factory(), new LastModified.Factory(), 104 new Locality.Factory(), new Location.Factory(), new LocationType.Factory(), new Method.Factory(), 105 new Name.Factory(), new Organizer.Factory(), new PercentComplete.Factory(), new Postalcode.Factory(), 106 new Priority.Factory(), new ProdId.Factory(), new RDate.Factory(), new RecurrenceId.Factory(), 107 new Region.Factory(), new RelatedTo.Factory(), new Repeat.Factory(), new RequestStatus.Factory(), 108 new Resources.Factory(), new RRule.Factory(), new Sequence.Factory(), new Status.Factory(), 109 new StreetAddress.Factory(), new Summary.Factory(), new Tel.Factory(), new Transp.Factory(), 110 new Trigger.Factory(), new TzId.Factory(), new TzName.Factory(), new TzOffsetFrom.Factory(), 111 new TzOffsetTo.Factory(), new TzUrl.Factory(), new Uid.Factory(), new Url.Factory(), 112 new Version.Factory()); 113 114 List<PropertyFactory<?>> rfc7986 = Arrays.<PropertyFactory<?>>asList(new Color.Factory(), new Conference.Factory(), new Image.Factory(), 115 new RefreshInterval.Factory(), new Source.Factory()); 116 117 List<PropertyFactory<?>> factories = new ArrayList<>(rfc5545); 118 factories.addAll(rfc7986); 119 return factories; 120 } 121}