001/*
002 *  Copyright 2017 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.messagingconnector;
017
018import java.util.Date;
019
020/***
021 * 
022 * This class represents an event from a calendar.
023 * An event is represented with :<br> 
024 * - a title<br>
025 * - a start date<br> 
026 * - a end date (optional)<br> 
027 * - a location (optional)
028 */
029public class CalendarEvent
030{
031    /** Date of the beginning of the event */
032    private Date _startDate;
033
034    /** Date of the end of the event */
035    private Date _endDate;
036
037    /** Title of the event */
038    private String _title;
039
040    /** Location of the event */
041    private String _location;
042
043    /**
044     * Creates a empty calendar event
045     */
046    public CalendarEvent()
047    {
048        // Nothing
049    }
050    
051    /**
052     * Creates a new calendar event
053     * @param dateStart the date when the event starts
054     * @param dateEnd the date when the event ends
055     * @param title the title of the event
056     * @param location the location of the event
057     */
058    public CalendarEvent(Date dateStart, Date dateEnd, String title, String location)
059    {
060        this._startDate = dateStart;
061        this._endDate = dateEnd;
062        this._title = title;
063        this._location = location;
064    }
065
066    /**
067     * Get the start date of the event
068     * @return the start date
069     */
070    public Date getStartDate()
071    {
072        return _startDate;
073    }
074
075    /**
076     * Set the start date of the event
077     * @param startDate the start date
078     */
079    public void setStartDate(Date startDate)
080    {
081        this._startDate = startDate;
082    }
083
084    /**
085     * Get the end date of the event
086     * @return the end date
087     */
088    public Date getEndDate()
089    {
090        return _endDate;
091    }
092
093    /**
094     * Set the end date of the event to a new Date
095     * @param endDate the end date to set
096     */
097    public void setEndDate(Date endDate)
098    {
099        this._endDate = endDate;
100    }
101
102    /**
103     * Get the subject of the event
104     * @return the subject of the event 
105     */
106    public String getSubject()
107    {
108        return _title;
109    }
110
111    /**
112     * Set the title of the event
113     * @param title the title to set
114     */
115    public void setSubject(String title)
116    {
117        this._title = title;
118    }
119
120    /**
121     * Get the location of the event
122     * @return the location
123     */
124    public String getLocation()
125    {
126        return _location;
127    }
128
129    /**
130     * Set the location of the event
131     * @param location the location to set
132     */
133    public void setLocation(String location)
134    {
135        this._location = location;
136    }
137
138    @Override
139    public String toString()
140    {
141        return "CalendarEvent [_startDate=" + _startDate + ", _endDate=" + _endDate + ", _subject=" + _title + ", _location=" + _location + "]";
142    }
143}