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