RejectedOperation#
One operation of a change set that Project#apply didn't apply: where it sits in the change set, and why it was rejected. Instances come from ApplyReport.rejected, and from CandidateResult.error when Project#evaluate can't score a candidate.
Declaration#
;
Constructors#
RejectedOperation()#
public
Creates an instance with path and message set to null. The library fills both fields on every instance it returns.
Fields#
| Field | Type | Default | Description |
|---|---|---|---|
path |
String |
null |
Position of the operation in the change set, as {group}.{verb}[{index}]. |
message |
String |
null |
Why the operation was rejected. |
path#
public String path ;
group is tasks, links, resources or assignments. verb is add, update or remove. index is the zero-based position in that list of SchedulingChanges. For example, links.add[0] is the first entry of changes.links.add. AppliedOperation.path uses the same form, so every operation of a change set shows up exactly once, in either applied or rejected.
In CandidateResult.error, a failure while solving or leveling the candidate carries the input path of that error instead, such as a field path. When that error has no path, path is an empty string.
message#
public String message ;
The validation message, without the path, e.g. duplicate link id or lag must be finite. Each change-set type lists the messages its operations can produce; see LinkAdd for an example. The text is for logs and diagnostics, not for matching in code.
Methods#
withPath, withMessage#
public RejectedOperation
public RejectedOperation
Each setter assigns its field and returns this instance.
Returns: this RejectedOperation.
deepClone#
public RejectedOperation
Returns a new instance with the same path and message.
Returns: a new RejectedOperation.
copy#
public RejectedOperation
Returns a shallow copy. Both fields are strings, so it's equivalent to deepClone().
Returns: a new RejectedOperation.
equals, hashCode, toString#
public boolean
public int
public String
Inherited from ValueRecord. Two instances are equal when path and message are equal. toString() prints both fields, e.g. RejectedOperation{path=links.add[0], message=duplicate link id}, for logging.
Example#
Add a link whose id already exists, and read the rejection:
;
;
Output:
links.add[0]: duplicate link id
A rejection sets ApplyReport.needsResync. To continue, see Recover from rejected changes.
Related#
ApplyReport- the report that lists rejectionsCandidateResult- the other place aRejectedOperationappearsProject#apply- what a rejection does to the project- Recover from rejected changes - resyncing after a rejection