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