Class EssBatchOutlineEditResult
This class exists because a batch outline edit that fails returns HTTP 200.
Asking to update a member that does not exist comes back as a perfectly ordinary success whose body
says Error[1370271]: ... member [NoSuchMember] not exist and Total member updated : 0.
So does asking to delete one. Anything that checks the status code and moves on has just silently
not edited the outline, which for the one API whose whole purpose is changing an outline in bulk is
the worst possible failure mode. isSuccessful() is the check that means anything here.
Worse, an action the server does not recognise - a misspelled element name - is skipped in
silence: no error, no warning, and counts of zero. That is why getTotalChanged() is worth
asserting on in a test even when there were no errors.
The log is free text and Oracle may reword it. Everything here degrades to "no messages parsed,
counts of -1" rather than throwing, and getMessages() always has the server's own words -
so a future wording change costs you the structure, never the information.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classOne labelled line of the log, kept whole alongside the bits worth reading separately.static enumHow the server labels a line:Info[1370001]:,Warn[1370101]:,Error[1370271]:. -
Constructor Summary
ConstructorsConstructorDescriptionPublic so a caller that already has a log - one captured from a job, or replayed from a file - can read it with the same parsing the live call uses. -
Method Summary
-
Constructor Details
-
EssBatchOutlineEditResult
Public so a caller that already has a log - one captured from a job, or replayed from a file - can read it with the same parsing the live call uses.- Parameters:
log- the server's message log, which may be empty
-
-
Method Details
-
isSuccessful
public boolean isSuccessful()Whether the server reported no errors.The check to make on every batch edit, because the HTTP status will not make it for you. Warnings do not count against this: the commonest one is "member already exist", which is how a re-run of an add reports that there was nothing to do - see
hasWarnings()if that matters to you.- Returns:
- true if no message came back labelled Error or Fatal
-
hasWarnings
public boolean hasWarnings()- Returns:
- whether anything came back labelled Warn
-
getErrors
-
getWarnings
-
getMessages
Every labelled line, in the order the server wrote them. -
getAdded
public int getAdded()- Returns:
- members added, or -1 if the log did not say
-
getUpdated
public int getUpdated()- Returns:
- members updated, or -1 if the log did not say
-
getDeleted
public int getDeleted()- Returns:
- members deleted, or -1 if the log did not say
-
getTotalChanged
public int getTotalChanged()Everything the edit changed.Worth checking even when
isSuccessful()is true: an action the server did not recognise is skipped without a word, so a document that changes nothing and reports nothing is the signature of a misspelled action.- Returns:
- added plus updated plus deleted, or -1 if the log did not carry the counts
-
getLog
The server's log, whole and unparsed. -
toString
-