Class OperationResult

java.lang.Object
com.evolveum.midpoint.schema.result.OperationResult
All Implemented Interfaces:
Visitable<OperationResult>, OperationResultBuilder, DebugDumpable, ShortDumpable, Serializable, Cloneable

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. an OperationResult 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 (see OperationsPerformanceInformationType) and shown in GUI. See also OperationsPerformanceMonitorImpl 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 into OperationResult 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 its status should be changed from the initial OperationResultStatus.UNKNOWN value to a more specific one. (Otherwise, a run-time exception is thrown in cleanupResult(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 one OperationResult "active", i.e. opened by createSubresult(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 in recordSuccess()) or _implicitly_ (e.g. in computeStatus()). All those methods invoke recordEnd() 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 each OperationResult 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 of status somewhere during the operation execution (assuming that there's non-negligible processing after that point), setStatus(OperationResultStatus) method or its variants (like setSuccess()) can be used. These fill-in status field without closing the whole operation result. === Note: Recording Exceptions The Correct Closure Principle (#1) dictates that the operation result has to be correctly closed even in the case of exception occurring. That is why we usually create a "try-catch" block for the code covered by a single operation result. Traditionally, the recordFatalError(Throwable) call was put into the `catch` code. However, there may be situations where a different handling is required: . If the exception is non-fatal or even completely benign. This may be the case of e.g. expected ("allowed") object-not-found conditions. See ObjectNotFoundException.getSeverity(). . If the exception was processed by other means. For example, a custom error message was already provided. To handle these cases, recordException(Throwable) should be used instead of recordFatalError(Throwable). The difference is that the former checks the exceptionRecorded flag to see if the exception was already processed. See also markExceptionRecorded(). NOTE: This mechanism is *experimental*. === 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.recordException(e); throw e; } finally { result.close(); } } ---- Note that the close() method (a newer form of legacy computeStatusIfUnknown()) 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 into close() method itself.
Author:
lazyman, Radovan Semancik
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • 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 interface OperationResultBuilder
    • 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. Looks only in the current result. See findAsynchronousOperationReference() for the recursive version.
    • setAsynchronousOperationReference

      public void setAsynchronousOperationReference(String asynchronousOperationReference)
    • clearAsynchronousOperationReferencesDeeply

      @VisibleForTesting public void clearAsynchronousOperationReferencesDeeply()
    • findAsynchronousOperationReference

      @Nullable public @Nullable 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.
    • findTaskOid

      @Nullable public @Nullable String findTaskOid()
      A convenience method. (Assumes we have only a single asynchronous operation reference in the tree.)
    • findCaseOid

      @Nullable public @Nullable String findCaseOid()
      A convenience method. (Assumes we have only a single asynchronous operation reference in the tree.)
    • isTaskOid

      public static boolean isTaskOid(String ref)
    • referenceToTaskOid

      public static String referenceToTaskOid(String ref)
    • referenceToCaseOid

      public static String referenceToCaseOid(String ref)
    • getOperation

      public String getOperation()
      Contains operation name. Operation name must be defined as String 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 subresults OperationResult.
    • 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 in OperationResultStatus
      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()
    • muteErrorsRecursively

      public void muteErrorsRecursively()
      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(String errorMessage, String warnMessage)
    • 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 interface OperationResultBuilder
    • getFirstTrace

      public <T> T getFirstTrace(Class<T> traceClass)
    • addReturnComment

      public void addReturnComment(String comment)
    • isTracingNormal

      public boolean isTracingNormal(Class<? extends TraceType> traceClass)
    • isTracingAny

      public boolean isTracingAny(Class<? extends TraceType> traceClass)
    • isTracingDetailed

      public boolean isTracingDetailed(Class<? extends TraceType> traceClass)
    • 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 interface Visitable<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()
    • isClosed

      public boolean isClosed()
    • computeStatusIfUnknown

      public void computeStatusIfUnknown()
    • computeStatusIfUnknownComposite

      public void computeStatusIfUnknownComposite()
    • recomputeStatus

      public void recomputeStatus()
    • recomputeStatus

      public void recomputeStatus(String errorMessage)
    • recomputeStatus

      public void recomputeStatus(String errorMessage, String warningMessage)
    • recordSuccessIfUnknown

      public void recordSuccessIfUnknown()
    • recordNotApplicableIfUnknown

      public void recordNotApplicableIfUnknown()
    • recordNotApplicable

      public void recordNotApplicable()
    • recordNotApplicable

      public void recordNotApplicable(String message)
    • setNotApplicable

      public void setNotApplicable(String message)
    • isMinor

      public boolean isMinor()
    • getParams

      @NotNull public @NotNull Map<String,Collection<String>> getParams()
      Method returns Map 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)
    • getParamSingle

      public String getParamSingle(String name)
    • addQualifier

      public OperationResult addQualifier(String value)
      Specified by:
      addQualifier in interface OperationResultBuilder
    • addParam

      public OperationResult addParam(String name, String value)
      Specified by:
      addParam in interface OperationResultBuilder
    • addParam

      public OperationResult addParam(String name, PrismObject<? extends ObjectType> value)
      Specified by:
      addParam in interface OperationResultBuilder
    • addParam

      public OperationResult addParam(String name, ObjectType value)
      Specified by:
      addParam in interface OperationResultBuilder
    • addParam

      public OperationResult addParam(String name, boolean value)
      Specified by:
      addParam in interface OperationResultBuilder
    • addParam

      public OperationResult addParam(String name, long value)
      Specified by:
      addParam in interface OperationResultBuilder
    • addParam

      public OperationResult addParam(String name, int value)
      Specified by:
      addParam in interface OperationResultBuilder
    • addParam

      public OperationResult addParam(String name, Class<?> value)
      Specified by:
      addParam in interface OperationResultBuilder
    • addParam

      public OperationResult addParam(String name, QName value)
      Specified by:
      addParam in interface OperationResultBuilder
    • addParam

      public OperationResult addParam(String name, PolyString value)
      Specified by:
      addParam in interface OperationResultBuilder
    • addParam

      public OperationResult addParam(String name, ObjectQuery value)
      Specified by:
      addParam in interface OperationResultBuilder
    • addParam

      public OperationResult addParam(String name, ObjectDelta<?> value)
      Specified by:
      addParam in interface OperationResultBuilder
    • addParam

      public OperationResult addParam(String name, String... values)
      Specified by:
      addParam in interface OperationResultBuilder
    • addArbitraryObjectAsParam

      public OperationResult addArbitraryObjectAsParam(String paramName, Object paramValue)
      Specified by:
      addArbitraryObjectAsParam in interface OperationResultBuilder
    • addArbitraryObjectCollectionAsParam

      public OperationResult addArbitraryObjectCollectionAsParam(String name, Collection<?> value)
      Specified by:
      addArbitraryObjectCollectionAsParam in interface OperationResultBuilder
    • 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 interface OperationResultBuilder
    • addContext

      public OperationResult addContext(String name, PrismObject<? extends ObjectType> value)
      Specified by:
      addContext in interface OperationResultBuilder
    • addContext

      public OperationResult addContext(String name, ObjectType value)
      Specified by:
      addContext in interface OperationResultBuilder
    • addContext

      public OperationResult addContext(String name, boolean value)
      Specified by:
      addContext in interface OperationResultBuilder
    • addContext

      public OperationResult addContext(String name, long value)
      Specified by:
      addContext in interface OperationResultBuilder
    • addContext

      public OperationResult addContext(String name, int value)
      Specified by:
      addContext in interface OperationResultBuilder
    • addContext

      public OperationResult addContext(String name, Class<?> value)
      Specified by:
      addContext in interface OperationResultBuilder
    • addContext

      public OperationResult addContext(String name, QName value)
      Specified by:
      addContext in interface OperationResultBuilder
    • addContext

      public OperationResult addContext(String name, PolyString value)
      Specified by:
      addContext in interface OperationResultBuilder
    • addContext

      public OperationResult addContext(String name, ObjectQuery value)
      Specified by:
      addContext in interface OperationResultBuilder
    • addContext

      public OperationResult addContext(String name, ObjectDelta<?> value)
      Specified by:
      addContext in interface OperationResultBuilder
    • addContext

      public OperationResult addContext(String name, String... values)
      Specified by:
      addContext in interface OperationResultBuilder
    • addArbitraryObjectAsContext

      public OperationResult addArbitraryObjectAsContext(String name, Object value)
      Specified by:
      addArbitraryObjectAsContext in interface OperationResultBuilder
    • addArbitraryObjectCollectionAsContext

      public OperationResult addArbitraryObjectCollectionAsContext(String paramName, Collection<?> paramValue)
      Specified by:
      addArbitraryObjectCollectionAsContext in interface OperationResultBuilder
    • getReturns

      @NotNull public @NotNull Map<String,Collection<String>> getReturns()
    • getReturnsBean

      @Nullable public @Nullable ParamsType getReturnsBean()
    • getReturn

      public Collection<String> getReturn(String name)
    • getReturnSingle

      public String getReturnSingle(String name)
    • addReturn

      public void addReturn(String name, String value)
    • addReturn

      public void addReturn(String name, PrismObject<? extends ObjectType> value)
    • addReturn

      public void addReturn(String name, ObjectType value)
    • addReturn

      public void addReturn(String name, Boolean value)
    • addReturn

      public void addReturn(String name, Long value)
    • addReturn

      public void addReturn(String name, Integer value)
    • addReturn

      public void addReturn(String name, Class<?> value)
    • addReturn

      public void addReturn(String name, QName 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)
    • addReturn

      public void addReturn(String name, String... values)
    • addArbitraryObjectAsReturn

      public void addArbitraryObjectAsReturn(String name, Object 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)
    • recordException

      public void recordException(String message, @NotNull @NotNull Throwable cause)
      A more sophisticated replacement for recordFatalError(String, Throwable). . Takes care not to overwrite the exception if it was already processed. . Marks the exception as processed. . Sets the appropriate result status. See the class javadoc.
    • recordException

      public void recordException(@NotNull @NotNull Throwable cause)
      Convenience version of recordException(String, Throwable) (with no custom message).
    • recordExceptionNotFinish

      public void recordExceptionNotFinish(String message, @NotNull @NotNull Throwable cause)
      As recordException(String, Throwable) but does not mark operation as finished.
    • recordExceptionNotFinish

      public void recordExceptionNotFinish(@NotNull @NotNull Throwable cause)
      Convenience version of recordExceptionNotFinish(String, Throwable) (with no custom message).
    • markExceptionRecorded

      @Experimental public void markExceptionRecorded()
      Marks the current exception (that is expected to be throws outside the context of the current operation) as already processed - so no further actions (besides closing the result) are necessary. See also the class javadoc.
      See Also:
    • unmarkExceptionRecorded

      public void unmarkExceptionRecorded()
      "Un-marks" the exception as being recorded. To be used when the code decides e.g. that the exception will not be thrown out of the context of the current operation.
    • setFatalError

      public void setFatalError(Throwable cause)
    • setFatalError

      public void setFatalError(String message, 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.
    • muteAllSubresultErrors

      public void muteAllSubresultErrors()
    • muteLastSubresultError

      public void muteLastSubresultError()
    • clearLastSubresultError

      public void clearLastSubresultError()
    • deleteLastSubresultIfError

      public void deleteLastSubresultIfError()
    • recordPartialError

      public void recordPartialError(Throwable cause)
    • recordWarning

      public void recordWarning(Throwable cause)
    • recordStatus

      public void recordStatus(OperationResultStatus status, Throwable cause)
    • recordFatalError

      public void recordFatalError(String message, Throwable cause)
    • recordPartialError

      public void recordPartialError(String message, Throwable cause)
    • recordWarning

      public void recordWarning(String message, Throwable cause)
    • recordWarningNotFinish

      public void recordWarningNotFinish(String message, Throwable cause)
    • recordHandledError

      public void recordHandledError(String message)
    • recordHandledError

      public void recordHandledError(String message, Throwable cause)
    • recordHandledError

      public void recordHandledError(Throwable cause)
    • recordStatus

      public void recordStatus(OperationResultStatus status, String message, Throwable cause)
    • setPropagateHandledErrorAsSuccess

      public void setPropagateHandledErrorAsSuccess(boolean propagateHandledErrorAsSuccess)
    • recordFatalError

      public void recordFatalError(String message)
    • recordPartialError

      public void recordPartialError(String message)
    • setPartialError

      public void setPartialError(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)
    • getDetail

      public List<String> getDetail()
    • createOperationResult

      @Contract("null -> null; !null -> !null") public static OperationResult createOperationResult(OperationResultType bean)
    • createBeanReduced

      public OperationResultType createBeanReduced()
      As createOperationResultType() 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.
    • createBeanRootOnly

      public OperationResultType createBeanRootOnly()
      As createOperationResultType() but exports only the root result.
    • 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()
    • cleanup

      public void cleanup()
      As cleanupResult(Throwable) but uses the recorded exception for diagnostics. It is more convenient than that method, as it can be used in the `finally` block - assuming that the exception was recorded in the `catch` block or earlier.
    • cleanupResult

      @Deprecated public void cleanupResult()
      Deprecated.
      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

      @Deprecated public void cleanupResult(Throwable e)
      Deprecated.
      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 interface DebugDumpable
    • dump

      public String dump(boolean withStack)
    • dumpBasicInfo

      @Experimental public void dumpBasicInfo(StringBuilder sb, String prefix, int indent)
    • 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 interface ShortDumpable
      Parameters:
      sb - StringBuilder to which to a compact one-line content of the object intended for diagnostics by system administrator should be appended.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setBackgroundTaskOid

      public void setBackgroundTaskOid(String oid)
    • setCaseOid

      public void setCaseOid(String oid)
    • operationKind

      public OperationResult operationKind(OperationKindType value)
      Specified by:
      operationKind in interface OperationResultBuilder
    • getOperationKind

      public OperationKindType getOperationKind()
    • preserve

      public OperationResultBuilder preserve()
      Specified by:
      preserve in interface OperationResultBuilder
    • isPreserve

      public boolean isPreserve()
    • setMinor

      public OperationResultBuilder setMinor()
      Specified by:
      setMinor in interface OperationResultBuilder
    • getImportance

      public OperationResultImportanceType getImportance()
    • setImportance

      public OperationResult setImportance(OperationResultImportanceType value)
      Specified by:
      setImportance in interface OperationResultBuilder
    • recordThrowableIfNeeded

      public void recordThrowableIfNeeded(Throwable t)
    • createSubResultOrNewResult

      public static OperationResult createSubResultOrNewResult(OperationResult parentResult, String operation)
    • clone

      public OperationResult clone()
      Overrides:
      clone in class Object
    • 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)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • 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()
    • getTraces

      public List<TraceType> getTraces()
    • getMonitoredOperations

      public MonitoredOperationsStatisticsType getMonitoredOperations()
    • setMonitoredOperations

      public void setMonitoredOperations(MonitoredOperationsStatisticsType operations)
    • getQualifiers

      @NotNull public @NotNull List<String> getQualifiers()
    • 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)