com.atlassian.confluence.api.impl.model.validation
Class CoreValidationResult

java.lang.Object
  extended by com.atlassian.confluence.api.impl.model.validation.CoreValidationResult
All Implemented Interfaces:
ValidationResult

public class CoreValidationResult
extends java.lang.Object
implements ValidationResult

Adapts Confluence Core ValidationErrors to API ValidationResults.


Field Summary
static CoreValidationResult FORBIDDEN
          A singleton unauthorized result.
static CoreValidationResult VALID
          A singleton valid result.
 
Method Summary
 ServiceException convertToServiceException(java.lang.String errorMsg)
           
static CoreValidationResult create(boolean authorized, java.util.Collection<ValidationError> coreErrors)
           
static CoreValidationResult create(boolean authorized, java.util.List<ValidationError> errors)
           
static CoreValidationResult create(boolean authorized, Message message)
           
 java.util.List<ValidationError> getErrors()
           
 boolean isAuthorized()
           
 boolean isValid()
           
 ServiceException throwIfInvalid(java.lang.String msg)
          converts this validation result into an Exception and throws it
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VALID

public static final CoreValidationResult VALID
A singleton valid result.


FORBIDDEN

public static final CoreValidationResult FORBIDDEN
A singleton unauthorized result.

Method Detail

create

public static CoreValidationResult create(boolean authorized,
                                          java.util.Collection<ValidationError> coreErrors)

create

public static CoreValidationResult create(boolean authorized,
                                          java.util.List<ValidationError> errors)

create

public static CoreValidationResult create(boolean authorized,
                                          Message message)

isAuthorized

public boolean isAuthorized()
Specified by:
isAuthorized in interface ValidationResult
Returns:
true if the current user is permitted to perform the execution that the validation is for

isValid

public boolean isValid()
Specified by:
isValid in interface ValidationResult
Returns:
true if there are no errors in this result

getErrors

public java.util.List<ValidationError> getErrors()
Specified by:
getErrors in interface ValidationResult
Returns:
an iterable of the errors stored in this result

throwIfInvalid

public ServiceException throwIfInvalid(java.lang.String msg)
                                throws ServiceException
Description copied from interface: ValidationResult
converts this validation result into an Exception and throws it

Specified by:
throwIfInvalid in interface ValidationResult
Returns:
the exception that will be thrown
Throws:
ServiceException

convertToServiceException

public ServiceException convertToServiceException(java.lang.String errorMsg)


Copyright © 2003-2014 Atlassian. All Rights Reserved.