001/*
002 * (C) Copyright 2006-2012 Nuxeo SA (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Nicolas Ulrich, Antoine Taillefer
016 *
017 */
018
019package org.nuxeo.ecm.platform.task;
020
021import java.io.Serializable;
022import java.util.Date;
023import java.util.List;
024import java.util.Map;
025
026import org.nuxeo.ecm.core.api.CoreSession;
027import org.nuxeo.ecm.core.api.DocumentModel;
028
029/**
030 * @since 5.5
031 */
032public interface Task extends Serializable {
033
034    /**
035     * @since 5.6
036     */
037    String TASK_PROVIDER_KEY = "taskProviderId";
038
039    DocumentModel getDocument();
040
041    String getId();
042
043    /**
044     * @deprecated
045     * @since 5.8, getTargetDocumentsIds() should be used instead
046     */
047    String getTargetDocumentId();
048
049    List<String> getActors();
050
051    String getInitiator();
052
053    String getName();
054
055    /**
056     * @since 5.6
057     */
058    String getType();
059
060    /**
061     * @since 5.6
062     */
063    String getProcessId();
064
065    /**
066     * @since 7.4
067     */
068    String getProcessName();
069
070    String getDescription();
071
072    String getDirective();
073
074    List<TaskComment> getComments();
075
076    String getVariable(String key);
077
078    Date getDueDate();
079
080    Date getCreated();
081
082    Boolean isCancelled();
083
084    Boolean isOpened();
085
086    Boolean hasEnded();
087
088    Boolean isAccepted();
089
090    Map<String, String> getVariables();
091
092    void setActors(List<String> actors);
093
094    void setInitiator(String initiator);
095
096    /**
097     * @deprecated
098     * @since 5.8, setTargetDocumentsIds(List<String> ids) should be used instead
099     */
100    void setTargetDocumentId(String targetDocumentId);
101
102    void setName(String name);
103
104    /**
105     * @since 5.6
106     */
107    void setType(String type);
108
109    /**
110     * @since 5.6
111     */
112    void setProcessId(String processId);
113
114    /**
115     * @since 7.4
116     */
117    void setProcessName(String processName);
118
119    void setDescription(String description);
120
121    void setDirective(String directive);
122
123    void setVariable(String key, String value);
124
125    void setDueDate(Date dueDate);
126
127    void setCreated(Date created);
128
129    void setAccepted(Boolean accepted);
130
131    void setVariables(Map<String, String> variables);
132
133    void addComment(String author, String text);
134
135    void cancel(CoreSession coreSession);
136
137    void end(CoreSession coreSession);
138
139    enum TaskVariableName {
140        needi18n, taskType
141    };
142
143    /**
144     * @since 5.8
145     */
146    List<String> getDelegatedActors();
147
148    /**
149     * @since 5.8
150     */
151    void setDelegatedActors(List<String> delegatedActors);
152
153    /**
154     * @since 5.8
155     */
156    List<String> getTargetDocumentsIds();
157
158    /**
159     * The first id on the list is also set as 'targetDocumentId'
160     *
161     * @since 5.8
162     */
163    void setTargetDocumentsIds(List<String> ids);
164}