Class SimpleMergeValidationResult
- All Implemented Interfaces:
MergeValidationResult
,ValidationResult
- Since:
- 5.9
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuilder
(ValidationResult result) convertToServiceException
(@Nullable String errorMsg) Converts this validation result into aServiceException
without throwing.Returns an iterable of the errors (if any) stored in this result.boolean
Checks for allowedInReadOnlyMode status.boolean
Checks for authorization status.boolean
isValid()
Checks for validity.Deprecated.throwIfInvalid
(String msg) Deprecated.since 5.10 please usethrowIfNotSuccessful(String)
void
Converts this validation result into aServiceException
and throws it.void
Converts this validation result into aServiceException
and throws it.void
throwIfNotValid
(String msg) Deprecated.since 5.10 please usethrowIfNotSuccessful(String)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.atlassian.confluence.api.model.validation.ValidationResult
isNotSuccessful, isSuccessful
-
Constructor Details
-
SimpleMergeValidationResult
-
-
Method Details
-
isAuthorized
public boolean isAuthorized()Description copied from interface:ValidationResult
Checks for authorization status. Does NOT imply thevalidity check
.- Specified by:
isAuthorized
in interfaceValidationResult
- Returns:
true
if the current user is permitted to perform the execution that the validation is for,false
otherwise.- See Also:
-
isAllowedInReadOnlyMode
public boolean isAllowedInReadOnlyMode()Description copied from interface:ValidationResult
Checks for allowedInReadOnlyMode status. Does NOT imply thevalidity check
.- Specified by:
isAllowedInReadOnlyMode
in interfaceValidationResult
- Returns:
true
if the current user is allowed to perform the execution in read-only mode that the validation is for,false
otherwise.- See Also:
-
isValid
public boolean isValid()Description copied from interface:ValidationResult
Checks for validity. Does NOT imply theauthorization check
.By contract implementations MUST return
false
if there are errors in this ValidationResult. Default implementation is usually enough.- Specified by:
isValid
in interfaceValidationResult
- Returns:
true
if there are no errors in this result,false
otherwise.- See Also:
-
getErrors
Description copied from interface:ValidationResult
Returns an iterable of the errors (if any) stored in this result. By contract having any errors here MUST also result inValidationResult.isValid()
returningfalse
.Default implementation of
ValidationResult.isValid()
is safe fornull
values. Be cautious about returningnull
if not using the default implementation forValidationResult.isValid()
.- Specified by:
getErrors
in interfaceValidationResult
- Returns:
- an iterable of the errors stored in this result.
- See Also:
-
throwIfInvalid
Deprecated.since 5.10 please usethrowIfNotSuccessful(String)
Description copied from interface:ValidationResult
Converts this validation result into aServiceException
and throws it. Checks for both:ValidationResult.isValid()
andValidationResult.isAuthorized()
.Issues:
- Should always throw and never return anything, even though return type is declared.
- Method name suggests only validation check even though two checks are actually performed.
This method is deprecated since 5.10, please use
ValidationResult.throwIfNotSuccessful(String)
- Specified by:
throwIfInvalid
in interfaceValidationResult
- Returns:
- the exception that will be thrown
- Throws:
ServiceException
- See Also:
-
throwIfNotValid
Deprecated.since 5.10 please usethrowIfNotSuccessful(String)
Description copied from interface:ValidationResult
Converts this validation result into aServiceException
and throws it. Checks for both:ValidationResult.isValid()
andValidationResult.isAuthorized()
.Issues:
- Method name suggests only validation check even though two checks are actually performed.
This method is deprecated since 5.10, please use
ValidationResult.throwIfNotSuccessful(String)
- Specified by:
throwIfNotValid
in interfaceValidationResult
- Throws:
ServiceException
- See Also:
-
throwIfInvalid
Deprecated.since 5.10 please usethrowIfNotSuccessful()
Description copied from interface:ValidationResult
Converts this validation result into an Exception and throws it. Should always throw and never return anything, even though return type is declared. Deprecated for that reason.First validation error will be used as message string
This method is deprecated since 5.10, please use
ValidationResult.throwIfNotSuccessful()
- Specified by:
throwIfInvalid
in interfaceValidationResult
- Returns:
- the exception that will be thrown
- Throws:
ServiceException
- See Also:
-
throwIfNotSuccessful
Description copied from interface:ValidationResult
Converts this validation result into aServiceException
and throws it. By default provided string will be used as an exception message.By contract implementations MUST throw proper subclass of
ServiceException
whenValidationResult.isNotSuccessful()
.- Specified by:
throwIfNotSuccessful
in interfaceValidationResult
- Throws:
ServiceException
- See Also:
-
throwIfNotSuccessful
Description copied from interface:ValidationResult
Converts this validation result into aServiceException
and throws it.By default first validation error (if any) will be used as an exception message.
By contract implementations MUST throw proper subclass of
ServiceException
whenValidationResult.isNotSuccessful()
.- Specified by:
throwIfNotSuccessful
in interfaceValidationResult
- Throws:
ServiceException
- See Also:
-
convertToServiceException
Description copied from interface:ValidationResult
Converts this validation result into aServiceException
without throwing. Implementations of this method should reasonably analyze the internals of this ValidationResult and return appropriate subclass ofServiceException
which is most suitable for the case.This method is used internally in the default implementations of
ValidationResult.throwIfNotSuccessful()
andValidationResult.throwIfNotSuccessful(String)
- Specified by:
convertToServiceException
in interfaceValidationResult
- Parameters:
errorMsg
- message to put in the Exception returned- Returns:
- instance of appropriate
ServiceException
subclass. - See Also:
-
builder
-
throwIfNotSuccessful()