Class SimpleMergeValidationResult
- java.lang.Object
 - 
- com.atlassian.confluence.api.model.validation.SimpleMergeValidationResult
 
 
- 
- All Implemented Interfaces:
 MergeValidationResult,ValidationResult
public class SimpleMergeValidationResult extends Object implements MergeValidationResult
- Since:
 - 5.9
 
 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSimpleMergeValidationResult.Builder 
- 
Constructor Summary
Constructors Constructor Description SimpleMergeValidationResult(SimpleMergeValidationResult.Builder builder) 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static SimpleMergeValidationResult.Builderbuilder(ValidationResult result)ServiceExceptionconvertToServiceException(@Nullable String errorMsg)Converts this validation result into aServiceExceptionwithout throwing.Iterable<ValidationError>getErrors()Returns an iterable of the errors (if any) stored in this result.booleanisAllowedInReadOnlyMode()Checks for allowedInReadOnlyMode status.booleanisAuthorized()Checks for authorization status.booleanisValid()Checks for validity.ServiceExceptionthrowIfInvalid()Deprecated.since 5.10 please usethrowIfNotSuccessful()ServiceExceptionthrowIfInvalid(String msg)Deprecated.since 5.10 please usethrowIfNotSuccessful(String)voidthrowIfNotSuccessful()Converts this validation result into aServiceExceptionand throws it.voidthrowIfNotSuccessful(String msg)Converts this validation result into aServiceExceptionand throws it.voidthrowIfNotValid(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 Detail
- 
SimpleMergeValidationResult
public SimpleMergeValidationResult(SimpleMergeValidationResult.Builder builder)
 
 - 
 
- 
Method Detail
- 
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:
 ValidationResult.isValid(),ValidationResult.isSuccessful()
 
- 
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:
 ValidationResult.isValid(),ValidationResult.isSuccessful()
 
- 
isValid
public boolean isValid()
Description copied from interface:ValidationResultChecks for validity. Does NOT imply theauthorization check.By contract implementations MUST return
falseif there are errors in this ValidationResult. Default implementation is usually enough.- Specified by:
 isValidin interfaceValidationResult- Returns:
 trueif there are no errors in this result,falseotherwise.- See Also:
 ValidationResult.getErrors(),ValidationResult.isAuthorized(),ValidationResult.isSuccessful()
 
- 
getErrors
public Iterable<ValidationError> 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:
 ValidationResult.isValid(),ValidationError
 
- 
throwIfInvalid
@Deprecated public ServiceException throwIfInvalid(String msg) throws ServiceException
Deprecated.since 5.10 please usethrowIfNotSuccessful(String)Description copied from interface:ValidationResultConverts this validation result into aServiceExceptionand 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:
 throwIfInvalidin interfaceValidationResult- Returns:
 - the exception that will be thrown
 - Throws:
 ServiceException- See Also:
 ValidationResult.throwIfNotSuccessful(String)
 
- 
throwIfNotValid
@Deprecated public void throwIfNotValid(String msg) throws ServiceException
Deprecated.since 5.10 please usethrowIfNotSuccessful(String)Description copied from interface:ValidationResultConverts this validation result into aServiceExceptionand 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:
 throwIfNotValidin interfaceValidationResult- Throws:
 ServiceException- See Also:
 ValidationResult.throwIfNotSuccessful(String)
 
- 
throwIfInvalid
@Deprecated public ServiceException throwIfInvalid() throws ServiceException
Deprecated.since 5.10 please usethrowIfNotSuccessful()Description copied from interface:ValidationResultConverts 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:
 throwIfInvalidin interfaceValidationResult- Returns:
 - the exception that will be thrown
 - Throws:
 ServiceException- See Also:
 ValidationResult.throwIfNotSuccessful()
 
- 
throwIfNotSuccessful
public void throwIfNotSuccessful(String msg) throws ServiceException
Description copied from interface:ValidationResultConverts this validation result into aServiceExceptionand throws it. By default provided string will be used as an exception message.By contract implementations MUST throw proper subclass of
ServiceExceptionwhenValidationResult.isNotSuccessful().- Specified by:
 throwIfNotSuccessfulin interfaceValidationResult- Throws:
 ServiceException- See Also:
 ValidationResult.isNotSuccessful(),ValidationResult.convertToServiceException(String)
 
- 
throwIfNotSuccessful
public void throwIfNotSuccessful() throws ServiceExceptionDescription copied from interface:ValidationResultConverts this validation result into aServiceExceptionand throws it.By default first validation error (if any) will be used as an exception message.
By contract implementations MUST throw proper subclass of
ServiceExceptionwhenValidationResult.isNotSuccessful().- Specified by:
 throwIfNotSuccessfulin interfaceValidationResult- Throws:
 ServiceException- See Also:
 ValidationResult.isNotSuccessful(),ValidationResult.convertToServiceException(String),ValidationResult.getErrors(),ValidationError
 
- 
convertToServiceException
public ServiceException convertToServiceException(@Nullable String errorMsg)
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:
 ValidationResult.throwIfNotSuccessful(),ValidationResult.throwIfNotSuccessful(String)
 
- 
builder
public static SimpleMergeValidationResult.Builder builder(ValidationResult result)
 
 - 
 
 -