Project#apply#
Writes edits into the accepted state of a Project and marks it unsolved. It doesn't schedule anything: call solve(null, …) or level afterwards to get the new dates.
Signature#
public ApplyReport
Synchronous and CPU-only. Changes the project's state. Not synchronized: serialize calls on one instance.
Parameters#
| Name | Type | Description |
|---|---|---|
changes |
SchedulingChanges |
The edits to commit. Must not be null |
Behavior#
- Operations run in order and are partially accepted. A rejected operation goes into
ApplyReport.rejectedand isn't thrown. - Any rejection sets
needsResync. From then onsolve(null, …),applyandlevelthrowNEEDS_RESYNCuntil a fullsolve(data, …). changes.baselineId, when set, must name the current baseline.nullskips the check.- The project is unsolved afterwards.
preview,loadProfile,evaluate,suggestAssignmentsandrosterneed a solve first. - Tasks added or updated by successful operations accumulate across calls. The next acyclic
solve(null, …)orlevelreports each one as a direct update. - An explicit start that falls on non-working time is kept unsnapped when the task has no predecessor. The end is computed forward from it on the working calendar.
Returns#
An ApplyReport with the applied and rejected operations, their side effects and the new revision.
Errors#
All exceptions are unchecked.
| Error | When |
|---|---|
ProjectException with code == ProjectError.NEEDS_RESYNC |
An earlier apply rejected an operation and no solve(data, …) followed. Checked first |
ProjectException with code == ProjectError.STALE_BASELINE |
changes.baselineId doesn't name the current baseline |
NullPointerException |
changes is null |
Example#
Commit an edit, resync with the full data if part of it is rejected, and reschedule.
;
;
Related#
SchedulingChanges- the change set it commitsApplyReport- applied and rejected operations and the new revisionProject#solve- reschedules the committed edits- Data updates - change sets, patches, rejections and resync
- Recover from rejected changes - resyncing after a rejected operation