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