Class CandidatesValidator
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.runtime.parameter.DefaultValidator
-
- org.ametys.cms.content.referencetable.CandidatesValidator
-
- All Implemented Interfaces:
Validator
,PluginAware
,Configurable
,LogEnabled
,Serviceable
public class CandidatesValidator extends DefaultValidator
This validator does not allow a set of values only containing candidates. At least one content is expected
-
-
Field Summary
Fields Modifier and Type Field Description protected HierarchicalReferenceTablesHelper
_hierarchicalReferenceTablesHelper
The helper component for hierarchical reference tablesprotected AmetysObjectResolver
_resolver
Ametys resolver-
Fields inherited from class org.ametys.runtime.parameter.DefaultValidator
_invalidText, _isMandatory, _pluginName, _regexp, _smanager
-
-
Constructor Summary
Constructors Constructor Description CandidatesValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
_hasOnlyCandidates(Object[] values)
protected boolean
_hasOnlyContentCandidates(Content[] contents)
Indicates if the array of contents contains only candidatesprotected void
_validateSingleContent(Content content, Errors errors)
Validate a single content (true if not a candidate)void
service(ServiceManager manager)
protected void
validateArrayValues(Object[] values, Errors errors)
Validates a array of values.protected void
validateSingleValue(Object value, Errors errors)
Validates a single value.-
Methods inherited from class org.ametys.runtime.parameter.DefaultValidator
configure, getConfiguration, setPluginInfo, validate
-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_resolver
protected AmetysObjectResolver _resolver
Ametys resolver
-
_hierarchicalReferenceTablesHelper
protected HierarchicalReferenceTablesHelper _hierarchicalReferenceTablesHelper
The helper component for hierarchical reference tables
-
-
Constructor Detail
-
CandidatesValidator
public CandidatesValidator()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classDefaultValidator
- Throws:
ServiceException
-
validateSingleValue
protected void validateSingleValue(Object value, Errors errors)
Description copied from class:DefaultValidator
Validates a single value.- Overrides:
validateSingleValue
in classDefaultValidator
- Parameters:
value
- the value to validate (can benull
).errors
- the structure to populate if the validation failed.
-
_validateSingleContent
protected void _validateSingleContent(Content content, Errors errors)
Validate a single content (true if not a candidate)- Parameters:
content
- the contenterrors
- the list of errors (seeErrors
)
-
validateArrayValues
protected void validateArrayValues(Object[] values, Errors errors)
Description copied from class:DefaultValidator
Validates a array of values.- Overrides:
validateArrayValues
in classDefaultValidator
- Parameters:
values
- the values to validateerrors
- the structure to populate if the validation failed.
-
_hasOnlyCandidates
private boolean _hasOnlyCandidates(Object[] values)
-
_hasOnlyContentCandidates
protected boolean _hasOnlyContentCandidates(Content[] contents)
Indicates if the array of contents contains only candidates- Parameters:
contents
- the list of content- Returns:
- true if it contains only candidates
-
-