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 end date of the frequency.
124     * @return the end date of the frequency.
125     */
126    public ZonedDateTime getRepeatUntil();
127    
128    /**
129     * Retrieves the list of excluded event date.
130     * @return the list of excluded event date.
131     */
132    public List<ZonedDateTime> getExcludedOccurences();
133    
134    /**
135     * Retrieves the list of all event date between startDate and endDate.
136     * @param startDate the start date
137     * @param endDate the end date
138     * @return the list of all event date between startDate and endDate.
139     */
140    public List<CalendarEventOccurrence> getOccurrences(ZonedDateTime startDate, ZonedDateTime endDate);
141    
142    /**
143     * Retrieves the start date of the first Event which end after the date
144     * @param date the date
145     * @return the start date of the first Event which end after the date
146     */
147    public Optional<CalendarEventOccurrence> getFirstOccurrence(ZonedDateTime date);
148    
149    /**
150     * Retrieves the date of the next event after the date
151     * @param occurrence the current occurrence
152     * @return the occurrence of the next event after the date
153     */
154    public Optional<CalendarEventOccurrence> getNextOccurrence(CalendarEventOccurrence occurrence);
155    
156    /**
157     * Retrieves the organiser.
158     * @return the organiser.
159     * @throws AmetysRepositoryException if an error occurs.
160     */
161    public UserIdentity getOrganiser();
162
163    /**
164     * Retrieves the resource list.
165     * @return the resource list.
166     */
167    public List<String> getResources();
168    
169}