001/*
002 *  Copyright 2020 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.tasks;
017
018import java.time.LocalDate;
019import java.time.ZonedDateTime;
020import java.util.List;
021
022import org.ametys.cms.data.ametysobject.ModifiableModelAwareDataAwareAmetysObject;
023import org.ametys.cms.repository.AttachableAmetysObject;
024import org.ametys.cms.repository.CommentableAmetysObject;
025import org.ametys.cms.repository.comment.Comment;
026import org.ametys.core.user.UserIdentity;
027import org.ametys.plugins.repository.RemovableAmetysObject;
028import org.ametys.plugins.repository.tag.TaggableAmetysObject;
029
030/**
031 * Task interface
032 */
033public interface Task extends ModifiableModelAwareDataAwareAmetysObject, RemovableAmetysObject, TaggableAmetysObject, CommentableAmetysObject<Comment>, AttachableAmetysObject
034{
035    /**
036     * The identifier of a task list
037     * @return The id
038     */
039    public String getTaskListId();
040    
041    /**
042     * Set the identifier of a tasks list
043     * @param tasksListId The tasks list id
044     */
045    public void setTasksListId(String tasksListId);
046    
047    /**
048     * The position into the task list
049     * @return The position
050     */
051    public Long getPosition();
052    
053    /**
054     * Set the position into the task list
055     * @param position The position into the task list
056     */
057    public void setPosition(Long position);
058    
059    /**
060     * The title of the task
061     * @return The title
062     */
063    public String getLabel();
064    
065    /**
066     * Set the label of the task
067     * @param label The label
068     */
069    public void setLabel(String label);
070    
071    /**
072     * The description of the task
073     * @return The description
074     */
075    public String getDescription();
076    
077    /**
078     * Set the description of the task
079     * @param description The description
080     */
081    public void setDescription(String description);
082    
083    /**
084     * The starting date of the task
085     * @return The start date
086     */
087    public LocalDate getStartDate();
088    
089    /**
090     * Set the starting date of the task
091     * @param startDate The start date
092     */
093    public void setStartDate(LocalDate startDate);
094    
095    /**
096     * The due date of the task
097     * @return The due date
098     */
099    public LocalDate getDueDate();
100    
101    /**
102     * Set the due date of the task
103     * @param dueDate The due date
104     */
105    public void setDueDate(LocalDate dueDate);
106    
107    /**
108     * True if the task is closed
109     * @return <code>true</code> if the task is closed
110     */
111    public boolean isClosed();
112    
113    /**
114     * Close the task
115     * @param isClosed <code>true</code> to close the task
116     */
117    public void close(boolean isClosed);
118    
119    /**
120     * Get the author who close the task
121     * @return the author who close the task
122     */
123    public UserIdentity getCloseAuthor();
124
125    /**
126     * Set the author who close the task.
127     * @param author the author
128     */
129    public void setCloseAuthor(UserIdentity author);
130    
131    /**
132     * Get the task's date of closure
133     * @return the task's date of closure
134     */
135    public LocalDate getCloseDate();
136    
137    /**
138     * Set the task's date of closure
139     * @param closedDate The date of closure
140     */
141    public void setCloseDate(LocalDate closedDate);
142    
143    /**
144     * Get the author of the task
145     * @return the author
146     */
147    public UserIdentity getAuthor();
148    
149    /**
150     * Set the author of this task.
151     * @param author the author
152     */
153    public void setAuthor(UserIdentity author);
154    
155    /**
156     * Get the list of user assigned to this task
157     * @return The assignment list
158     */
159    public List<UserIdentity> getAssignments();
160    
161    /**
162     * Set the list of user assigned to this task
163     * @param assignments The assignment list
164     */
165    public void setAssignments(List<UserIdentity> assignments);
166    
167    /**
168     * Get the task's creation date.
169     * @return the task's creation date.
170     */
171    public ZonedDateTime getCreationDate();
172    
173    /**
174     * Set the post's creation date.
175     * @param startDate the post's creation date.
176     */
177    public void setCreationDate(ZonedDateTime startDate);
178    
179    /**
180     * Get the task's last modification date.
181     * @return the task's last modification date.
182     */
183    public ZonedDateTime getLastModified();
184    
185    /**
186     * Set the post's modification date.
187     * @param date the last modification date to set.
188     */
189    public void setLastModified(ZonedDateTime date);
190    
191    /**
192     * Get the task's check list
193     * @return the task's check list
194     */
195    public List<CheckItem> getCheckList();
196    
197    /**
198     * Set the list of check item
199     * @param checkItems the list of check item
200     */
201    public void setCheckListItem(List<CheckItem> checkItems);
202    
203    /**
204     * Object to represent a check item
205     */
206    public class CheckItem
207    {
208        private String _label;
209        private boolean _isChecked;
210        
211        /**
212         * The constructor
213         * @param label the label
214         * @param isChecked true is the item is check
215         */
216        public CheckItem(String label, boolean isChecked)
217        {
218            _label = label;
219            _isChecked = isChecked;
220        }
221        
222        /**
223         * Get the label
224         * @return the label
225         */
226        public String getLabel()
227        {
228            return _label;
229        }
230        
231        /**
232         * <code>true</code> if the item is checked
233         * @return <code>true</code> if the item is checked
234         */
235        public boolean isChecked()
236        {
237            return _isChecked;
238        }
239    }
240}