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.Arrays;
019import java.util.List;
020import java.util.function.Supplier;
021
022import net.fortuna.ical4j.model.ComponentFactory;
023import net.fortuna.ical4j.model.component.Available;
024import net.fortuna.ical4j.model.component.Daylight;
025import net.fortuna.ical4j.model.component.Standard;
026import net.fortuna.ical4j.model.component.VAlarm;
027import net.fortuna.ical4j.model.component.VAvailability;
028import net.fortuna.ical4j.model.component.VEvent;
029import net.fortuna.ical4j.model.component.VFreeBusy;
030import net.fortuna.ical4j.model.component.VJournal;
031import net.fortuna.ical4j.model.component.VTimeZone;
032import net.fortuna.ical4j.model.component.VToDo;
033import net.fortuna.ical4j.model.component.VVenue;
034
035//FIXME this class has been taken from the ical4j's github repo, in a branch without the javax.mail dependency
036//to be removed as soon as ical4j 4.0 is released
037//ical4j is licensed under the BSD license
038@SuppressWarnings("all")
039public class DefaultComponentFactorySupplier implements Supplier<List<ComponentFactory<?>>> {
040
041    @Override
042    public List<ComponentFactory<?>> get() {
043        List<ComponentFactory<?>> rfc5545 = Arrays.asList(new Available.Factory(), new Daylight.Factory(), new Standard.Factory(),
044                new VAlarm.Factory(), new VAvailability.Factory(), new VEvent.Factory(),
045                new VFreeBusy.Factory(), new VJournal.Factory(), new VTimeZone.Factory(),
046                new VToDo.Factory(), new VVenue.Factory());
047
048        return rfc5545;
049    }
050}