Class DefaultValidationErrorsProvider
- java.lang.Object
-
- de.hybris.platform.cmsfacades.common.validator.impl.DefaultValidationErrorsProvider
-
- All Implemented Interfaces:
ValidationErrorsProvider
public class DefaultValidationErrorsProvider extends java.lang.Object implements ValidationErrorsProvider
Default implementation ofValidationErrorsProvider. Stores theValidationErrorsinstance on the current Session.
-
-
Constructor Summary
Constructors Constructor Description DefaultValidationErrorsProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcollectValidationErrors(ValidationException e, java.util.Optional<java.lang.String> language, java.util.Optional<java.lang.Integer> position)Collects the errors in the validation exception and adds to the global validation context.voidfinalizeValidationErrors()Finalizes the latestValidationErrorsinstance for this transaction.ValidationErrorsgetCurrentValidationErrors()Provides the currentValidationErrorsinstance for this transaction.protected SessionServicegetSessionService()protected org.springframework.beans.factory.ObjectFactory<ValidationErrors>getValidationErrorsObjectFactory()protected java.util.Deque<ValidationErrors>getWrappedStack(java.lang.Object rawValue)Values stored in the session service must be wrapped in AtomicReference objects to protect them from being altered during serialization.ValidationErrorsinitializeValidationErrors()Initializes a newValidationErrorsinstance for this transaction.voidsetSessionService(SessionService sessionService)voidsetValidationErrorsObjectFactory(org.springframework.beans.factory.ObjectFactory<ValidationErrors> validationErrorsObjectFactory)
-
-
-
Method Detail
-
initializeValidationErrors
public ValidationErrors initializeValidationErrors()
Description copied from interface:ValidationErrorsProviderInitializes a newValidationErrorsinstance for this transaction.- Specified by:
initializeValidationErrorsin interfaceValidationErrorsProvider- Returns:
- the current
ValidationErrors
-
getCurrentValidationErrors
public ValidationErrors getCurrentValidationErrors()
Description copied from interface:ValidationErrorsProviderProvides the currentValidationErrorsinstance for this transaction.- Specified by:
getCurrentValidationErrorsin interfaceValidationErrorsProvider- Returns:
- the current
ValidationErrors
-
finalizeValidationErrors
public void finalizeValidationErrors()
Description copied from interface:ValidationErrorsProviderFinalizes the latestValidationErrorsinstance for this transaction.- Specified by:
finalizeValidationErrorsin interfaceValidationErrorsProvider
-
collectValidationErrors
public void collectValidationErrors(ValidationException e, java.util.Optional<java.lang.String> language, java.util.Optional<java.lang.Integer> position)
Description copied from interface:ValidationErrorsProviderCollects the errors in the validation exception and adds to the global validation context.- Specified by:
collectValidationErrorsin interfaceValidationErrorsProvider- Parameters:
e- the exceptionlanguage- optional; the validated languageposition- optional; the position in which the object value in the collection
-
getWrappedStack
protected java.util.Deque<ValidationErrors> getWrappedStack(java.lang.Object rawValue)
Values stored in the session service must be wrapped in AtomicReference objects to protect them from being altered during serialization. When values are read from the session service, they must be unwrapped. Thus, this method is used to retrieve the original value (stack) stored in the AtomicReference wrapper.- Parameters:
rawValue- Object retrieved from the session service. The object must be an AtomicReference. Otherwise, an IllegalStateException is thrown.- Returns:
- stack stored within the AtomicReference.
-
getSessionService
protected SessionService getSessionService()
-
setSessionService
public void setSessionService(SessionService sessionService)
-
getValidationErrorsObjectFactory
protected org.springframework.beans.factory.ObjectFactory<ValidationErrors> getValidationErrorsObjectFactory()
-
setValidationErrorsObjectFactory
public void setValidationErrorsObjectFactory(org.springframework.beans.factory.ObjectFactory<ValidationErrors> validationErrorsObjectFactory)
-
-