001/*
002 *  Copyright 2014 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.workspaces.calendars.events;
017
018import java.time.ZoneId;
019import java.time.ZonedDateTime;
020import java.util.List;
021import java.util.Optional;
022
023import org.ametys.cms.data.ametysobject.IndexableAmetysObject;
024import org.ametys.core.user.UserIdentity;
025import org.ametys.plugins.messagingconnector.EventRecurrenceTypeEnum;
026import org.ametys.plugins.repository.AmetysRepositoryException;
027import org.ametys.plugins.repository.tag.TaggableAmetysObject;
028import org.ametys.plugins.workspaces.calendars.Calendar;
029
030/**
031 * Calendar event interface
032 */
033public interface CalendarEvent extends TaggableAmetysObject, IndexableAmetysObject
034{
035    /**
036     * Get the title of the event
037     * @return the title of the event
038     */
039    public String getTitle();
040    
041    /**
042     * Get the calendar holding the event
043     * @return the calendar
044     */
045    public Calendar getCalendar();
046    
047    /**
048     * Get the description of the event
049     * @return the description of the event
050     */
051    public String getDescription();
052    
053    /**
054     * Get the location of the event
055     * @return the location of the event
056     */
057    public String getLocation();
058    
059    /**
060     * Get the date of the begin of the event
061     * @return the date of the event
062     */
063    public ZonedDateTime getStartDate();
064
065    /**
066     * Get the date of the end of the event
067     * @return the date of the event
068     */
069    public ZonedDateTime getEndDate();
070
071    /**
072     * Get the date zone of the event
073     * @return the date zone of the event
074     */
075    public ZoneId getZone();
076    
077    /**
078     * Get if the event last all the day
079     * @return true if the event last all the day
080     */
081    public Boolean getFullDay();
082    
083    /**
084     * Retrieves the the creator.
085     * @return the creator.
086     * @throws AmetysRepositoryException if an error occurs.
087     */
088    public UserIdentity getCreator();
089    
090    /**
091     * Retrieves the creation date.
092     * @return the creation date.
093     * @throws AmetysRepositoryException if an error occurs.
094     */
095    public ZonedDateTime getCreationDate();
096    
097    /**
098     * Retrieves the last contributor.
099     * @return the last contributor.
100     * @throws AmetysRepositoryException if an error occurs.
101     */
102    public UserIdentity getLastContributor();
103    
104    /**
105     * Retrieves the last modification date.
106     * @return the last modification date.
107     * @throws AmetysRepositoryException if an error occurs.
108     */
109    public ZonedDateTime getLastModified();
110     
111    /**
112     * Retrieves the recurrence type.
113     * @return the recurrence type.
114     */
115    public EventRecurrenceTypeEnum getRecurrenceType();
116    
117    /**
118     * Retrieves if the event is recurrent.
119     * @return true if the event is recurrent.
120     */
121    public Boolean isRecurrent();
122    
123    /**
124     * Retrieves the upper bound of the recurrence
125     * This bound is inclusive, meaning that if it is synchronized (ie on a recurrence day at the event starting hour) with the recurrence, it represents the starting date of the last occurrence
126     * @return the last possible start instant of the recurrence.
127     */
128    public ZonedDateTime getRepeatUntil();
129
130    /**
131     * Retrieves the list of excluded event date.
132     * @return the list of excluded event date as ZonedDateTime representing midnight in event timezone. No guarantee is provided for the actual timezone of the returned date, only the instant it represents is guaranteed
133     */
134    public List<ZonedDateTime> getExcludedOccurences();
135    
136    /**
137     * Retrieves the list of all event date between startDate and endDate.
138     * @param startDate the start date
139     * @param endDate the end date
140     * @return the list of all event date between startDate and endDate.
141     */
142    public List<CalendarEventOccurrence> getOccurrences(ZonedDateTime startDate, ZonedDateTime endDate);
143    
144    /**
145     * Retrieves the start date of the first Event which end after the date
146     * @param date the date
147     * @return the start date of the first Event which end after the date
148     */
149    public Optional<CalendarEventOccurrence> getFirstOccurrence(ZonedDateTime date);
150    
151    /**
152     * Retrieves the date of the next event after the date
153     * @param occurrence the current occurrence
154     * @return the occurrence of the next event after the date
155     */
156    public Optional<CalendarEventOccurrence> getNextOccurrence(CalendarEventOccurrence occurrence);
157    
158    /**
159     * Retrieves the organiser.
160     * @return the organiser.
161     * @throws AmetysRepositoryException if an error occurs.
162     */
163    public UserIdentity getOrganiser();
164
165    /**
166     * Retrieves the resource list.
167     * @return the resource list.
168     */
169    public List<String> getResources();
170    
171}