001/*
002 *  Copyright 2020 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;
017
018import java.time.ZonedDateTime;
019
020import org.ametys.cms.tag.Tag;
021
022import net.fortuna.ical4j.model.component.VEvent;
023
024/**
025 * A holder created principally for recurrent events, so we can have one iteration of this event, using a start and end date of this iteration
026 */
027public class LocalVEvent
028{
029    private VEvent _event;
030    private ZonedDateTime _start;
031    private ZonedDateTime _end;
032    private Tag _tag;
033    
034    /**
035     * Store an event and a start/end date, the currentDay is used when an event is on multiple days, so we know which day is the one used here
036     * @param event the event
037     * @param start start of the iteration of this event (around the current day)
038     * @param end end of the iteration of this event (around the current day)
039     * @param tag the tag used for this ICS
040     */
041    public LocalVEvent(VEvent event, ZonedDateTime start, ZonedDateTime end, Tag tag)
042    {
043        _event = event;
044        _start = start;
045        _end = end;
046        _tag = tag;
047    }
048
049    /**
050     * return the event
051     * @return the event
052     */
053    public VEvent getEvent()
054    {
055        return _event;
056    }
057
058    /**
059     * return the start date of this iteration
060     * @return the start date of this iteration
061     */
062    public ZonedDateTime getStart()
063    {
064        return _start;
065    }
066
067    /**
068     * return the end date of this iteration
069     * @return the end date of this iteration
070     */
071    public ZonedDateTime getEnd()
072    {
073        return _end;
074    }
075
076    /**
077     * return the tag used for this ICS
078     * @return the tag used for this ICS
079     */
080    public Tag getTag()
081    {
082        return _tag;
083    }
084}