TaskData#
One task in ProjectData.tasks or in the add list of SchedulingChanges.tasks. Create it with new TaskData(id) and set the other fields with the fluent withX setters. To change a task that a project already holds, send a TaskUpdate instead.
Declaration#
Every field is public and mutable, and has a withX(value) setter that assigns it and returns this: new TaskData(Id.str("a")).withStartDate(start).withDuration(2.0). Optional fields use reference types (Id, Moment, Double, enums), and null means absent.
A leaf task needs two of startDate, endDate and duration. A summary takes both dates or neither, and a milestone takes one date. Project data explains these date rules, and Validation rules lists the input that strict validation rejects.
Constructors#
TaskData(Id)#
public
Creates an auto-scheduled task of type TASK with priority 500, no dates and every other field at its default.
| Name | Type | Description |
|---|---|---|
id |
Id |
Task id, e.g. Id.num(1) or Id.str("design"). |
Fields#
| Field | Type | Default | Description |
|---|---|---|---|
id |
Id |
constructor argument | Task id. Unique among the project's tasks. |
parent |
Id |
null |
Id of the parent summary. null, Id.str("") and a value equal to SchedulingConfig.rootId all mean a root task. |
taskType |
TaskType |
TaskType.TASK |
Leaf task, summary or milestone. Wire name type. |
startDate |
Moment |
null |
Start date. |
endDate |
Moment |
null |
End date. |
duration |
Double |
null |
Working time in durationUnit. |
durationUnit |
TimeUnit |
null |
Unit of duration, levelingDelay and pauses. null uses SchedulingConfig.durationUnit. |
constraintType |
ConstraintType |
null |
Scheduling constraint. null means no constraint. Constraints act only when SchedulingConfig.applyConstraints is true. |
constraintDate |
Moment |
null |
Date of a dated constraint. Required when constraintType is a dated constraint. |
autoScheduling |
boolean |
true |
false makes the task fixed: the planner never moves it. |
unscheduled |
boolean |
false |
true keeps the task in the data but out of the plan. An unscheduled task needs no dates and isn't reported. |
progress |
double |
0.0 |
Completed fraction, from 0 to 1. With SchedulingConfig.useProgress on, 1 marks the task as completed. |
priority |
int |
500 |
Leveling priority, 0 to 1000. 1000 means the task is never leveled. A value outside the range fails validation at tasks[i].priority. |
levelingDelay |
double |
0.0 |
Delay added by leveling, as elapsed (wall-clock) time in the task's duration unit. Rounded to whole minutes on use. |
pauses |
Vec<Pause> |
empty | Leveling splits in the task's work, sorted by at and non-overlapping. Empty means uninterrupted work. Ignored on summaries, milestones and unscheduled tasks. |
calendarId |
Id |
null |
The task's own calendar. null uses the global calendar, or the parent's calendar in CalendarMode.TASK_INHERITED. |
levelingDelay and pauses normally come from Project#level. Setting pauses to an empty list and levelingDelay to 0 clears a task's leveling. See Leveling resources.
pauses has two setters. withPauses(Vec<Pause>) stores the list it's given. withPauses(Collection<? extends Pause>) copies the elements into a new Vec, so List.of(...) works; null sets the field to null.
Methods#
deepClone#
public TaskData
Returns a copy that shares no list or nested record with this task, including pauses.
Returns: a new TaskData with the same values.
copy#
public TaskData
Returns a shallow copy. The copy shares the pauses list with this task.
Returns: a new TaskData with the same field values.
equals / hashCode / toString#
Inherited from ValueRecord. equals and hashCode compare all public fields by value. toString returns a field dump, e.g. TaskData{id=a, parent=null, taskType=TASK, …}.
TaskType#
The kind of a task, set in TaskData.taskType.
| Value | Description |
|---|---|
TASK |
A leaf task. The default. |
SUMMARY |
A summary task whose span covers its children. Wire value "summary"; "project" also reads as SUMMARY. |
MILESTONE |
A zero-duration milestone. |
ConstraintType#
A task's scheduling constraint, set in TaskData.constraintType. All values except ASAP and ALAP are dated and need constraintDate.
| Value | Description |
|---|---|
ASAP |
As soon as possible. |
ALAP |
As late as possible. |
SNET |
Start no earlier than constraintDate. |
SNLT |
Start no later than constraintDate. |
FNET |
Finish no earlier than constraintDate. |
FNLT |
Finish no later than constraintDate. |
MSO |
Must start on constraintDate. |
MFO |
Must finish on constraintDate. |
Wire spellings are the lowercase names ("snet", "mfo"). See Links, constraints and summaries for how the planner applies each constraint.
Example#
;
;
Related#
ProjectData- where tasks are listedLinkData- dependencies between tasksTaskUpdate- editing a task in a live project- Tasks - date rules for tasks, summaries and milestones
- Constraints - constraint types and how they bind