Class SimpleValidationResult
java.lang.Object
com.atlassian.confluence.api.model.validation.SimpleValidationResult
- All Implemented Interfaces:
ValidationResult
Represents the simplest kind of ValidationResult.
- Since:
- 5.6
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ValidationResultA singleton unauthorized result.static final ValidationResultA singleton notAllowedInReadOnlyMode resultstatic final ValidationResultA singleton valid result. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()convertToServiceException(String errorMsg) Converts this validation result into aServiceExceptionwithout throwing.Returns an iterable of the errors (if any) stored in this result.booleanChecks for allowedInReadOnlyMode status.booleanChecks for authorization status.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.atlassian.confluence.api.model.validation.ValidationResult
isNotSuccessful, isSuccessful, isValid, throwIfInvalid, throwIfInvalid, throwIfNotSuccessful, throwIfNotSuccessful, throwIfNotValid
-
Field Details
-
VALID
A singleton valid result. -
FORBIDDEN
A singleton unauthorized result. -
NOT_ALLOWED_IN_READ_ONLY_MODE
A singleton notAllowedInReadOnlyMode result- Since:
- 6.8.0
-
-
Method Details
-
isAuthorized
public boolean isAuthorized()Description copied from interface:ValidationResultChecks for authorization status. Does NOT imply thevalidity check.- Specified by:
isAuthorizedin interfaceValidationResult- Returns:
trueif the current user is permitted to perform the execution that the validation is for,falseotherwise.- See Also:
-
isAllowedInReadOnlyMode
public boolean isAllowedInReadOnlyMode()Description copied from interface:ValidationResultChecks for allowedInReadOnlyMode status. Does NOT imply thevalidity check.- Specified by:
isAllowedInReadOnlyModein interfaceValidationResult- Returns:
trueif the current user is allowed to perform the execution in read-only mode that the validation is for,falseotherwise.- See Also:
-
getErrors
Description copied from interface:ValidationResultReturns 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 fornullvalues. Be cautious about returningnullif not using the default implementation forValidationResult.isValid().- Specified by:
getErrorsin interfaceValidationResult- Returns:
- an iterable of the errors stored in this result.
- See Also:
-
convertToServiceException
Description copied from interface:ValidationResultConverts this validation result into aServiceExceptionwithout throwing. Implementations of this method should reasonably analyze the internals of this ValidationResult and return appropriate subclass ofServiceExceptionwhich is most suitable for the case.This method is used internally in the default implementations of
ValidationResult.throwIfNotSuccessful()andValidationResult.throwIfNotSuccessful(String)- Specified by:
convertToServiceExceptionin interfaceValidationResult- Parameters:
errorMsg- message to put in the Exception returned- Returns:
- instance of appropriate
ServiceExceptionsubclass. - See Also:
-
toString
-
builder
-