Project#preview#
Applies hypothetical changes to a copy of the solved baseline of a Project and schedules the copy. The project isn't modified. Use it to show what an edit would do before committing it with apply. Needs a solved project.
Signature#
public ScheduleResult
Synchronous and CPU-only. Not synchronized: serialize calls on one Project instance.
Parameters#
| Name | Type | Description |
|---|---|---|
changes |
SchedulingChanges |
The edits to try. Not null |
options |
PreviewOptions |
Subtree, analytics, reasons, baseline check and an optional load profile. Not null; new PreviewOptions() for defaults |
Behavior#
updatesare relative to the baseline. An empty change set gives emptyupdates.- The result's
baselineIdis the baseline the preview read, so a followingpreviewaccepts it. - The change set isn't partially accepted: one rejected operation fails the whole call.
options.baselineIdandchanges.baselineIdare checked separately.nullskips a check.
Returns#
A ScheduleResult for the previewed state.
Errors#
All engine exceptions are unchecked.
| Error | When |
|---|---|
ProjectException NO_BASELINE |
The project is unsolved, including after apply |
ProjectException STALE_BASELINE |
options.baselineId or changes.baselineId doesn't name the current baseline |
InputException |
An operation in changes is rejected (the exception reports the first one, with its path and message), or the profile query is invalid |
NullPointerException |
changes or options is null |
Example#
Preview a drag of task b, guarded by the baseline token, and check that the project keeps its dates.
;
;
Related#
PreviewOptions- scope, analytics, baseline guard and load profileSchedulingChanges- the edits to tryScheduleResult- the previewed datesProject#apply- commits the same change set- Previewing changes - previews, baseline tokens and copies