Class OperationResult
- java.lang.Object
-
- com.evolveum.midpoint.schema.result.OperationResult
-
- All Implemented Interfaces:
Visitable<OperationResult>
,OperationResultBuilder
,DebugDumpable
,ShortDumpable
,Serializable
,Cloneable
public class OperationResult extends Object implements Serializable, DebugDumpable, ShortDumpable, Cloneable, OperationResultBuilder, Visitable<OperationResult>
Provides rich information about an operation being executed; mainly for the sake of error reporting and functional/performance troubleshooting. == Information Collected There is a lot of information collected, but the following properties are the most important: - result *status* (OperationResultStatus
): success, partial/fatal error, warning, ..., along with an optional *message* and *Java exception*, - operation invocation *parameters*, *return value(s)*, and sometimes information about the execution *context* (e.g. implementation class name), - *performance-related information*, like start/end timestamps, or duration (for performance diagnostics), -TraceType
records (for troubleshooting), - *logfile lines* produced during the operation execution (for troubleshooting). The structure is hierarchical, i.e. anOperationResult
instance contains a set of results of inner operations. == Typical Uses - This object can be used by GUI to display smart (and interactive) error information. - It can also be used by the client code (Java or REST) to detect deeper problems in the invocations, retry or otherwise compensate for the errors or decide how severe the error was and whether it is possible to proceed. - The performance information collected is recorded in tasks (seeOperationsPerformanceInformationType
) and shown in GUI. See alsoOperationsPerformanceMonitorImpl
class. - The functional and performance data collected are used for (experimental) link:https://docs.evolveum.com/midpoint/reference/diag/troubleshooting/troubleshooting-with-traces/[troubleshooting with traces]. == Developer's Guidelines In order to ensure that all necessary information is correctly captured, a developer of any method that writes intoOperationResult
instances has to follow a couple of basic principles: === Principle 1: Correct Closure Any operation result created has to be correctly _closed_. This means that itsstatus
should be changed from the initialOperationResultStatus.UNKNOWN
value to a more specific one. (Otherwise, a run-time exception is thrown incleanupResult(Throwable)
method.) Also, to ensure correct fulfillment of the other duties,recordEnd()
method has be - directly or indirectly - called as well (see below). === Principle 2: Single Result Per Thread At any instant, in any thread, there should be at most oneOperationResult
"active", i.e. opened bycreateSubresult(String)
or its variants (e.g.createMinorSubresult(String)
,subresult(String)
, ...), and not yet closed nor "superseded" by creating its own child result. This is to ensure that logfile lines will be correctly captured, if tracing is enabled. It is also required for correct collection of performance data. === Principle 3: Opening-Closure Pairing Because the operation result is used also to troubleshoot performance issues, it should be clear where (in the code) the result is created and where it is closed. When is result closed, anyway? The result is automatically closed when the status is recorded: either _explicitly_ (like inrecordSuccess()
) or _implicitly_ (e.g. incomputeStatus()
). All those methods invokerecordEnd()
that does all the magic related to performance information capturing, log records capturing, and (occasionally used) method call logging. To ensure easy, clear and unambiguous interpretation of the performance data, the developer should make sure that for eachOperationResult
created, it is obvious _where_ the result is closed. The best way how to ensure this is to create the result at the beginning (or near the beginning) of a related method, and close it - including writing the status - at the end (or near the end) of the same method. No recording of the status should be done between these points. If there's a need to set the value ofstatus
somewhere during the operation execution (assuming that there's non-negligible processing after that point),setStatus(OperationResultStatus)
method or its variants (likesetSuccess()
) can be used. These fill-instatus
field without closing the whole operation result. === Suggested Use Stemming from the above, the following can be seen as a suggested way how to use the operation result: [source,java] ---- private static final OP_SOME_METHOD = ThisClass.class.getName() + ".someMethod"; void someMethod(String param1, Object param2, OperationResult parentResult) throws SomeException { OperationResult result = parentResult.subresult(OP_SOME_METHOD) .addParam("param1", param1) .addArbitraryObjectAsParam("param2", param2) .build(); try { // ... some meat here ... } catch (SomeException | RuntimeException e) { result.recordFatalError(e); throw e; } finally { result.close(); } } ---- Note that theclose()
method (a newer form of legacycomputeStatusIfUnknown()
) automatically computes the result based on subresults (assuming success if there's no indication of a failure). In theory we could put it inside the `try` block (because `recordFatalError` effectively closes the result as well), but using `finally` is perhaps more explicit. It may be also more future-proof if we would decide to add some extra functionality right intoclose()
method itself.- Author:
- lazyman, Radovan Semancik
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OperationResult.PreviewResult
-
Field Summary
Fields Modifier and Type Field Description static String
CONTEXT_IMPLEMENTATION_CLASS
static String
CONTEXT_ITEM
static String
CONTEXT_OBJECT
static String
CONTEXT_OID
static String
CONTEXT_PROGRESS
static String
CONTEXT_REASON
static String
DEFAULT
static String
PARAM_LANGUAGE
static String
PARAM_NAME
static String
PARAM_OBJECT
static String
PARAM_OID
static String
PARAM_OPTIONS
static String
PARAM_PROJECTION
static String
PARAM_QUERY
static String
PARAM_RESOURCE
static String
PARAM_TASK
static String
PARAM_TYPE
static String
RETURN_COMMENT
static String
RETURN_COUNT
-
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
-
Constructor Summary
Constructors Constructor Description OperationResult(String operation)
OperationResult(String operation, OperationResultStatus status, LocalizableMessage userFriendlyMessage)
OperationResult(String operation, OperationResultStatus status, String message)
OperationResult(String operation, Map<String,Collection<String>> params, OperationResultStatus status, long token, String messageCode, String message, LocalizableMessage userFriendlyMessage, Throwable cause, List<OperationResult> subresults)
OperationResult(String operation, Map<String,Collection<String>> params, Map<String,Collection<String>> context, Map<String,Collection<String>> returns, OperationResultStatus status, long token, String messageCode, String message, LocalizableMessage userFriendlyMessage, Throwable cause, List<OperationResult> subresults)
-
Method Summary
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.evolveum.midpoint.util.DebugDumpable
debugDump, debugDumpLazily, debugDumpLazily
-
Methods inherited from interface com.evolveum.midpoint.util.ShortDumpable
shortDump, shortDumpLazily
-
-
-
-
Field Detail
-
CONTEXT_IMPLEMENTATION_CLASS
public static final String CONTEXT_IMPLEMENTATION_CLASS
- See Also:
- Constant Field Values
-
CONTEXT_PROGRESS
public static final String CONTEXT_PROGRESS
- See Also:
- Constant Field Values
-
CONTEXT_OID
public static final String CONTEXT_OID
- See Also:
- Constant Field Values
-
CONTEXT_OBJECT
public static final String CONTEXT_OBJECT
- See Also:
- Constant Field Values
-
CONTEXT_ITEM
public static final String CONTEXT_ITEM
- See Also:
- Constant Field Values
-
CONTEXT_REASON
public static final String CONTEXT_REASON
- See Also:
- Constant Field Values
-
PARAM_OID
public static final String PARAM_OID
- See Also:
- Constant Field Values
-
PARAM_NAME
public static final String PARAM_NAME
- See Also:
- Constant Field Values
-
PARAM_TYPE
public static final String PARAM_TYPE
- See Also:
- Constant Field Values
-
PARAM_OPTIONS
public static final String PARAM_OPTIONS
- See Also:
- Constant Field Values
-
PARAM_RESOURCE
public static final String PARAM_RESOURCE
- See Also:
- Constant Field Values
-
PARAM_TASK
public static final String PARAM_TASK
- See Also:
- Constant Field Values
-
PARAM_OBJECT
public static final String PARAM_OBJECT
- See Also:
- Constant Field Values
-
PARAM_QUERY
public static final String PARAM_QUERY
- See Also:
- Constant Field Values
-
PARAM_PROJECTION
public static final String PARAM_PROJECTION
- See Also:
- Constant Field Values
-
PARAM_LANGUAGE
public static final String PARAM_LANGUAGE
- See Also:
- Constant Field Values
-
RETURN_COUNT
public static final String RETURN_COUNT
- See Also:
- Constant Field Values
-
RETURN_COMMENT
public static final String RETURN_COMMENT
- See Also:
- Constant Field Values
-
DEFAULT
public static final String DEFAULT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
OperationResult
public OperationResult(String operation)
-
OperationResult
public OperationResult(String operation, OperationResultStatus status, LocalizableMessage userFriendlyMessage)
-
OperationResult
public OperationResult(String operation, OperationResultStatus status, String message)
-
OperationResult
public OperationResult(String operation, Map<String,Collection<String>> params, OperationResultStatus status, long token, String messageCode, String message, LocalizableMessage userFriendlyMessage, Throwable cause, List<OperationResult> subresults)
-
OperationResult
public OperationResult(String operation, Map<String,Collection<String>> params, Map<String,Collection<String>> context, Map<String,Collection<String>> returns, OperationResultStatus status, long token, String messageCode, String message, LocalizableMessage userFriendlyMessage, Throwable cause, List<OperationResult> subresults)
-
-
Method Detail
-
keepRootOnly
public static OperationResult keepRootOnly(OperationResult result)
-
keepRootOnly
public OperationResult keepRootOnly()
-
subresult
public OperationResultBuilder subresult(String operation)
-
createFor
public static OperationResultBuilder createFor(String operation)
-
build
public OperationResult build()
- Specified by:
build
in interfaceOperationResultBuilder
-
createSubresult
public OperationResult createSubresult(String operation)
-
createMinorSubresult
public OperationResult createMinorSubresult(String operation)
-
recordEnd
public void recordEnd()
-
checkLogRecorderFlushed
public void checkLogRecorderFlushed()
Checks if the recorder was correctly flushed. Used before writing the trace file.
-
getAsynchronousOperationReference
public String getAsynchronousOperationReference()
Reference to an asynchronous operation that can be used to retrieve the status of the running operation. This may be a task identifier, identifier of a ticket in ITSM system or anything else. The exact format of this reference depends on the operation which is being executed.
-
setAsynchronousOperationReference
public void setAsynchronousOperationReference(String asynchronousOperationReference)
-
findAsynchronousOperationReference
public String findAsynchronousOperationReference()
This method partially duplicates functionality of computeStatus. However, computeStatus currently does not propagate taskOid from tasks switched to background, because switchToBackground sets its result to SUCCESS (not IN_PROGRESS) because of some historical reasons. So, until this is fixed somehow, this is a bit of hack to fetch asynchronous operation reference even in such cases.
-
isTaskOid
public static boolean isTaskOid(String ref)
-
getOperation
public String getOperation()
Contains operation name. Operation name must be defined asString
constant in module interface with description and possible parameters. It can be used for further processing. It will be used as key for translation in admin-gui.- Returns:
- always return non null, non empty string
-
getCount
public int getCount()
-
setCount
public void setCount(int count)
-
incrementCount
public void incrementCount()
-
getHiddenRecordsCount
public int getHiddenRecordsCount()
-
setHiddenRecordsCount
public void setHiddenRecordsCount(int hiddenRecordsCount)
-
representsHiddenRecords
public boolean representsHiddenRecords()
-
isSummarizeErrors
public boolean isSummarizeErrors()
-
setSummarizeErrors
public void setSummarizeErrors(boolean summarizeErrors)
-
isSummarizePartialErrors
public boolean isSummarizePartialErrors()
-
setSummarizePartialErrors
public void setSummarizePartialErrors(boolean summarizePartialErrors)
-
isSummarizeSuccesses
public boolean isSummarizeSuccesses()
-
setSummarizeSuccesses
public void setSummarizeSuccesses(boolean summarizeSuccesses)
-
isEmpty
public boolean isEmpty()
-
getSubresults
@NotNull public @NotNull List<OperationResult> getSubresults()
Method returns list of operation subresultsOperationResult
.
-
getLastSubresult
public OperationResult getLastSubresult()
- Returns:
- last subresult, or null if there are no subresults.
-
removeLastSubresult
public void removeLastSubresult()
-
getLastSubresultStatus
public OperationResultStatus getLastSubresultStatus()
- Returns:
- last subresult status, or null if there are no subresults.
-
addSubresult
public void addSubresult(OperationResult subresult)
-
findSubresult
public OperationResult findSubresult(String operation)
-
findSubresultsDeeply
@NotNull public @NotNull List<OperationResult> findSubresultsDeeply(@NotNull @NotNull String operation)
Finds given operation in a subtree rooted by the current op. result. Includes this one!
-
findSubresults
public List<OperationResult> findSubresults(String operation)
Finds given operation among subresults of the current op. result.
-
getStatus
public OperationResultStatus getStatus()
Contains operation status as defined inOperationResultStatus
- Returns:
- never returns null
-
getStatusBean
public OperationResultStatusType getStatusBean()
-
setStatus
public void setStatus(OperationResultStatus status)
Sets the status _without_ recording operation end.
-
isSuccess
public boolean isSuccess()
Returns true if the result is success.This returns true if the result is absolute success. Presence of partial failures or warnings fail this test.
- Returns:
- true if the result is success.
-
isWarning
public boolean isWarning()
-
isAcceptable
public boolean isAcceptable()
Returns true if the result is acceptable for further processing.In other words: if there were no fatal errors. Warnings and partial errors are acceptable. Yet, this test also fails if the operation state is not known.
- Returns:
- true if the result is acceptable for further processing.
-
isUnknown
public boolean isUnknown()
-
isInProgress
public boolean isInProgress()
-
isError
public boolean isError()
-
isFatalError
public boolean isFatalError()
-
isPartialError
public boolean isPartialError()
-
isHandledError
public boolean isHandledError()
-
isNotApplicable
public boolean isNotApplicable()
-
setErrorsHandled
public void setErrorsHandled()
Set all error status in this result and all subresults as handled.
-
computeStatus
public void computeStatus(String errorMessage)
Computes operation result status based on subtask status and sets an error message if the status is FATAL_ERROR.- Parameters:
errorMessage
- error message
-
computeStatus
public void computeStatus()
Computes operation result status based on subtask status.
-
computeStatus
public void computeStatus(boolean skipFinish)
-
computeStatusComposite
public void computeStatusComposite()
Used when the result contains several composite sub-result that are of equivalent meaning. If all of them fail the result will be fatal error as well. If only some of them fail the result will be partial error. Handled error is considered a success.
-
addTrace
public void addTrace(TraceType trace)
-
tracingProfile
public OperationResultBuilder tracingProfile(CompiledTracingProfile profile)
- Specified by:
tracingProfile
in interfaceOperationResultBuilder
-
getFirstTrace
public <T> T getFirstTrace(Class<T> traceClass)
-
addReturnComment
public void addReturnComment(String comment)
-
isTracing
public boolean isTracing(Class<? extends TraceType> traceClass, TracingLevelType threshold)
-
getTracingLevel
@NotNull public @NotNull TracingLevelType getTracingLevel(Class<? extends TraceType> traceClass)
-
clearTracingProfile
public void clearTracingProfile()
-
accept
public void accept(Visitor<OperationResult> visitor)
- Specified by:
accept
in interfaceVisitable<OperationResult>
-
getResultStream
public Stream<OperationResult> getResultStream()
-
findSubResultStrictly
public OperationResult findSubResultStrictly(String operation)
-
switchHandledErrorToSuccess
@Experimental public void switchHandledErrorToSuccess()
This is used in situations where handled error is actually the success. For example, when writing an operation execution record to an object which we expect to be deleted, we consider such an operation to be a success. We do not want to bother user or administrator with the information that there was something that went wrong - when, in fact, it was really expected.
-
computePreview
public OperationResult.PreviewResult computePreview()
-
getComputeStatus
public OperationResultStatus getComputeStatus()
-
close
public void close()
-
closeAndCleanup
public void closeAndCleanup()
-
closeAndCleanup
public void closeAndCleanup(@Nullable @Nullable Throwable t)
Closes the result and cleans it up. BEWARE: It does *NOT* record theThrowable
as a fatal error! Its value is used only for debugging potential problems during result cleanup.
-
computeStatusIfUnknown
public void computeStatusIfUnknown()
-
computeStatusIfUnknownComposite
public void computeStatusIfUnknownComposite()
-
recomputeStatus
public void recomputeStatus()
-
recomputeStatus
public void recomputeStatus(String errorMessage)
-
recordSuccessIfUnknown
public void recordSuccessIfUnknown()
-
recordNotApplicableIfUnknown
public void recordNotApplicableIfUnknown()
-
recordNotApplicable
public void recordNotApplicable()
-
recordNotApplicable
public void recordNotApplicable(String message)
-
isMinor
public boolean isMinor()
-
getParams
@NotNull public @NotNull Map<String,Collection<String>> getParams()
Method returnsMap
with operation parameters. Parameters keys are described in module interface for every operation.
-
getParamsBean
@Nullable public @Nullable ParamsType getParamsBean()
-
getParam
public Collection<String> getParam(String name)
-
addQualifier
public OperationResult addQualifier(String value)
- Specified by:
addQualifier
in interfaceOperationResultBuilder
-
addParam
public OperationResult addParam(String name, String value)
- Specified by:
addParam
in interfaceOperationResultBuilder
-
addParam
public OperationResult addParam(String name, PrismObject<? extends ObjectType> value)
- Specified by:
addParam
in interfaceOperationResultBuilder
-
addParam
public OperationResult addParam(String name, ObjectType value)
- Specified by:
addParam
in interfaceOperationResultBuilder
-
addParam
public OperationResult addParam(String name, boolean value)
- Specified by:
addParam
in interfaceOperationResultBuilder
-
addParam
public OperationResult addParam(String name, long value)
- Specified by:
addParam
in interfaceOperationResultBuilder
-
addParam
public OperationResult addParam(String name, int value)
- Specified by:
addParam
in interfaceOperationResultBuilder
-
addParam
public OperationResult addParam(String name, Class<?> value)
- Specified by:
addParam
in interfaceOperationResultBuilder
-
addParam
public OperationResult addParam(String name, QName value)
- Specified by:
addParam
in interfaceOperationResultBuilder
-
addParam
public OperationResult addParam(String name, PolyString value)
- Specified by:
addParam
in interfaceOperationResultBuilder
-
addParam
public OperationResult addParam(String name, ObjectQuery value)
- Specified by:
addParam
in interfaceOperationResultBuilder
-
addParam
public OperationResult addParam(String name, ObjectDelta<?> value)
- Specified by:
addParam
in interfaceOperationResultBuilder
-
addParam
public OperationResult addParam(String name, String... values)
- Specified by:
addParam
in interfaceOperationResultBuilder
-
addArbitraryObjectAsParam
public OperationResult addArbitraryObjectAsParam(String paramName, Object paramValue)
- Specified by:
addArbitraryObjectAsParam
in interfaceOperationResultBuilder
-
addArbitraryObjectCollectionAsParam
public OperationResult addArbitraryObjectCollectionAsParam(String name, Collection<?> value)
- Specified by:
addArbitraryObjectCollectionAsParam
in interfaceOperationResultBuilder
-
getContext
@NotNull public @NotNull Map<String,Collection<String>> getContext()
-
getContextBean
@Nullable public @Nullable ParamsType getContextBean()
-
addContext
public OperationResult addContext(String name, String value)
- Specified by:
addContext
in interfaceOperationResultBuilder
-
addContext
public OperationResult addContext(String name, PrismObject<? extends ObjectType> value)
- Specified by:
addContext
in interfaceOperationResultBuilder
-
addContext
public OperationResult addContext(String name, ObjectType value)
- Specified by:
addContext
in interfaceOperationResultBuilder
-
addContext
public OperationResult addContext(String name, boolean value)
- Specified by:
addContext
in interfaceOperationResultBuilder
-
addContext
public OperationResult addContext(String name, long value)
- Specified by:
addContext
in interfaceOperationResultBuilder
-
addContext
public OperationResult addContext(String name, int value)
- Specified by:
addContext
in interfaceOperationResultBuilder
-
addContext
public OperationResult addContext(String name, Class<?> value)
- Specified by:
addContext
in interfaceOperationResultBuilder
-
addContext
public OperationResult addContext(String name, QName value)
- Specified by:
addContext
in interfaceOperationResultBuilder
-
addContext
public OperationResult addContext(String name, PolyString value)
- Specified by:
addContext
in interfaceOperationResultBuilder
-
addContext
public OperationResult addContext(String name, ObjectQuery value)
- Specified by:
addContext
in interfaceOperationResultBuilder
-
addContext
public OperationResult addContext(String name, ObjectDelta<?> value)
- Specified by:
addContext
in interfaceOperationResultBuilder
-
addContext
public OperationResult addContext(String name, String... values)
- Specified by:
addContext
in interfaceOperationResultBuilder
-
addArbitraryObjectAsContext
public OperationResult addArbitraryObjectAsContext(String name, Object value)
- Specified by:
addArbitraryObjectAsContext
in interfaceOperationResultBuilder
-
addArbitraryObjectCollectionAsContext
public OperationResult addArbitraryObjectCollectionAsContext(String paramName, Collection<?> paramValue)
- Specified by:
addArbitraryObjectCollectionAsContext
in interfaceOperationResultBuilder
-
getReturns
@NotNull public @NotNull Map<String,Collection<String>> getReturns()
-
getReturnsBean
@Nullable public @Nullable ParamsType getReturnsBean()
-
getReturn
public Collection<String> getReturn(String name)
-
addReturn
public void addReturn(String name, PrismObject<? extends ObjectType> value)
-
addReturn
public void addReturn(String name, ObjectType value)
-
addReturn
public void addReturn(String name, PolyString value)
-
addReturn
public void addReturn(String name, ObjectQuery value)
-
addReturn
public void addReturn(String name, ObjectDelta<?> value)
-
addArbitraryObjectCollectionAsReturn
public void addArbitraryObjectCollectionAsReturn(String paramName, Collection<?> paramValue)
-
getToken
public long getToken()
- Returns:
- Contains random long number, for better searching in logs.
-
getMessageCode
public String getMessageCode()
Contains message code based on module error catalog.- Returns:
- Can return null.
-
getMessage
public String getMessage()
- Returns:
- Method returns operation result message. Message is required. It will be key for translation in admin-gui.
-
setMessage
public void setMessage(String message)
-
getUserFriendlyMessage
public LocalizableMessage getUserFriendlyMessage()
-
setUserFriendlyMessage
public void setUserFriendlyMessage(LocalizableMessage userFriendlyMessage)
-
getCause
public Throwable getCause()
- Returns:
- Method returns operation result exception. Not required, can be null.
-
recordSuccess
public void recordSuccess()
-
setSuccess
public void setSuccess()
-
recordInProgress
public void recordInProgress()
-
setInProgress
public void setInProgress()
-
setInProgress
public void setInProgress(String message)
-
setUnknown
public void setUnknown()
-
recordFatalError
public void recordFatalError(Throwable cause)
-
recordFatalErrorIfNeeded
@Experimental public void recordFatalErrorIfNeeded(Throwable t)
Records a fatal error if it was not recorded before. TODO Not 100% safe, because the fatal error could be recorded for some other reason. We have to improve error reporting in general.
-
recordFatalErrorNotFinish
public void recordFatalErrorNotFinish(Throwable cause)
-
muteError
public void muteError()
If the operation is an error then it will switch the status to HANDLED_ERROR. This is used if the error is expected and properly handled.
-
muteLastSubresultError
public void muteLastSubresultError()
-
deleteLastSubresultIfError
public void deleteLastSubresultIfError()
-
recordPartialError
public void recordPartialError(Throwable cause)
-
recordWarning
public void recordWarning(Throwable cause)
-
recordStatus
public void recordStatus(OperationResultStatus status, Throwable cause)
-
recordHandledError
public void recordHandledError(String message)
-
recordHandledError
public void recordHandledError(Throwable cause)
-
recordStatus
public void recordStatus(OperationResultStatus status, String message, Throwable cause)
-
recordFatalError
public void recordFatalError(String message)
-
recordPartialError
public void recordPartialError(String message)
-
recordWarning
public void recordWarning(String message)
-
record
public void record(CommonException exception)
Records result from a common exception type. This automatically determines status and also sets appropriate message.- Parameters:
exception
- common exception
-
recordStatus
public void recordStatus(OperationResultStatus status)
-
recordStatus
public void recordStatus(OperationResultStatus status, String message)
-
hasUnknownStatus
public boolean hasUnknownStatus()
Returns true if result status is UNKNOWN or any of the subresult status is unknown (recursive).May come handy in tests to check if all the operations fill out the status as they should.
-
appendDetail
public void appendDetail(String detailLine)
-
createOperationResult
@Contract("null -> null; !null -> !null") public static OperationResult createOperationResult(OperationResultType bean)
-
createBeanReduced
public OperationResultType createBeanReduced()
AscreateOperationResultType()
but does not export minor success entries. This is needed to reduce the size of e.g.ShadowType
objects with fetchResult that includes full traced clockwork processing.
-
createOperationResultType
@NotNull public @NotNull OperationResultType createOperationResultType()
-
createOperationResultType
@NotNull public @NotNull OperationResultType createOperationResultType(Function<LocalizableMessage,String> resolveKeys)
-
summarize
public void summarize()
-
summarize
public void summarize(boolean alsoSubresults)
-
cleanupResultDeeply
public void cleanupResultDeeply()
-
cleanupResult
public void cleanupResult()
Removes all the successful minor results. Also checks if the result is roughly consistent and complete. (e.g. does not have unknown operation status, etc.)
-
cleanupResult
public void cleanupResult(Throwable e)
Removes all the successful minor results. Also checks if the result is roughly consistent and complete. (e.g. does not have unknown operation status, etc.)The argument "e" is for easier use of the cleanup in the exceptions handlers. The original exception is passed to the IAE that this method produces for easier debugging.
-
canBeCleanedUp
public boolean canBeCleanedUp()
-
isLesserThan
public static boolean isLesserThan(OperationResultImportanceType x, @NotNull @NotNull OperationResultImportanceType y)
- Returns:
- true if x < y
-
debugDump
public String debugDump(int indent)
- Specified by:
debugDump
in interfaceDebugDumpable
-
dump
public String dump(boolean withStack)
-
shortDump
public void shortDump(StringBuilder sb)
Description copied from interface:ShortDumpable
Show the content of the object intended for diagnostics. This method is supposed to append a compact, human-readable output in a single line. Unlike toString() method, there is no requirement to identify the actual class or type of the object. It is assumed that the class/type will be obvious from the context in which the output is used.- Specified by:
shortDump
in interfaceShortDumpable
- Parameters:
sb
- StringBuilder to which to a compact one-line content of the object intended for diagnostics by system administrator should be appended.
-
setBackgroundTaskOid
public void setBackgroundTaskOid(String oid)
-
setCaseOid
public void setCaseOid(String oid)
-
operationKind
public OperationResult operationKind(OperationKindType value)
- Specified by:
operationKind
in interfaceOperationResultBuilder
-
getOperationKind
public OperationKindType getOperationKind()
-
preserve
public OperationResultBuilder preserve()
- Specified by:
preserve
in interfaceOperationResultBuilder
-
isPreserve
public boolean isPreserve()
-
setMinor
public OperationResultBuilder setMinor()
- Specified by:
setMinor
in interfaceOperationResultBuilder
-
getImportance
public OperationResultImportanceType getImportance()
-
setImportance
public OperationResult setImportance(OperationResultImportanceType value)
- Specified by:
setImportance
in interfaceOperationResultBuilder
-
recordThrowableIfNeeded
public void recordThrowableIfNeeded(Throwable t)
-
createSubResultOrNewResult
public static OperationResult createSubResultOrNewResult(OperationResult parentResult, String operation)
-
clone
public OperationResult clone()
-
clone
public OperationResult clone(Integer maxDepth, boolean full)
-
applyOperationResultHandlingStrategy
public static void applyOperationResultHandlingStrategy(@NotNull @NotNull List<OperationResultHandlingStrategyType> configuredStrategies)
-
setThreadLocalHandlingStrategy
public static void setThreadLocalHandlingStrategy(@Nullable @Nullable String strategyName)
-
getStart
public Long getStart()
-
setStart
public void setStart(Long start)
-
getEnd
public Long getEnd()
-
setEnd
public void setEnd(Long end)
-
getMicroseconds
public Long getMicroseconds()
-
setMicroseconds
public void setMicroseconds(Long microseconds)
-
getCpuMicroseconds
public Long getCpuMicroseconds()
-
setCpuMicroseconds
public void setCpuMicroseconds(Long cpuMicroseconds)
-
getInvocationId
public Long getInvocationId()
-
setInvocationId
public void setInvocationId(Long invocationId)
-
isTraced
public boolean isTraced()
-
getTracingProfile
public CompiledTracingProfile getTracingProfile()
-
getMonitoredOperations
public MonitoredOperationsStatisticsType getMonitoredOperations()
-
setMonitoredOperations
public void setMonitoredOperations(MonitoredOperationsStatisticsType operations)
-
getCallerReason
public String getCallerReason()
-
setCallerReason
public void setCallerReason(String callerReason)
-
getLogSegments
public List<LogSegmentType> getLogSegments()
-
getExtractedDictionary
public TraceDictionaryType getExtractedDictionary()
-
setExtractedDictionary
public void setExtractedDictionary(TraceDictionaryType extractedDictionary)
-
-