wangting
2025-01-16 18c43123b51a1688ab4ae01fe3d171c7d92e619b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
 * JBoss, Home of Professional Open Source
 * Copyright 2005, JBoss Inc., and individual contributors as indicated
 * by the @authors tag. See the copyright.txt in the distribution for a
 * full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.jbpm.api.task;
 
import java.io.Serializable;
import java.util.Date;
 
import org.jbpm.api.JbpmException;
import org.jbpm.api.TaskService;
import org.jbpm.api.history.HistoryTask;
 
/** a runtime task.
 * 
 * In contrast to {@link HistoryTask}, a Task only represents the runtime 
 * state of a task and hence it will be deleted after it is completed.
 * 
 * @author Tom Baeyens
 */
public interface Task extends Serializable {
  
  /** task is waiting for someone to work on it and completed it */
  public static final String STATE_OPEN = "open";
  
  /** task is done */
  public static final String STATE_COMPLETED = "completed";
  
  /** task doesn't show up in task lists as something is wrong 
   * with the related process instance that requires manual 
   * intervention first. */
  public static final String STATE_SUSPENDED = "suspended";
  
  /** the unique id for this task that is used as a reference in the service methods */
  String getId();
 
  /** the short display name of this task.  Originally, this might come 
   * from the process file, but it can be changed at runtime for individual 
   * tasks. */
  String getName();
  
  /** change the short display name of this tasks. 
   * Updates require you to invoke {@link TaskService#saveTask(Task)} afterwards. */
  void setName(String name);
 
  /** longer description of this task */
  String getDescription();
 
  /** update the longer description of this task.
   * Updates like this require you to invoke {@link TaskService#saveTask(Task)} afterwards. */
  void setDescription(String description);
 
  /** the person responsible for completion of this task. */
  String getAssignee();
  
  /** update the assignee of this task.
   * Updates like this require you to invoke {@link TaskService#saveTask(Task)} afterwards. */
  void setAssignee(String assignee);
 
  /** date and time when this task was created */
  Date getCreateTime();
 
  /** date and time when this task must be completed. This might be null. */
  Date getDuedate();
 
  /** update the date and time when this task must be completed.
   * Updates like this require you to invoke {@link TaskService#saveTask(Task)} afterwards. */
  void setDuedate(Date duedate);
 
  /** the priority of this task.  This is only a data item for user purposes.  
   * The engine doesn't do anything different for different priorities. */
  int getPriority();
 
  /** update the priority.
   * Updates like this require you to invoke {@link TaskService#saveTask(Task)} afterwards. */
  void setPriority(int priority);
  
  /** 
   * The progress of this task. This is a data item for user purposes and 
   * doesn't influence the functionality of the engine.
   */
  Integer getProgress();
  
  /**
   * Change the progress of this task.
   * Updates like this require you to invoke {@link TaskService#saveTask(Task)} afterwards.
   * 
   * <b>IMPORTANT</b>: Only values between 0 and 100 are accepted. 
   *                   Using other values will cause a {@link JbpmException}.
   */
  void setProgress(Integer progress);
  
  /** reference to the execution or null if this task is unrelated to an execution */
  String getExecutionId();
  
  /** reference to the activity or null if this task is unrelated to an activity */
  String getActivityName();
  
  /** name of the resource in the deployment for the form that is associated 
   * to this task. */
  String getFormResourceName();
}