Package org.ametys.odf.ose.enumeration
Class DegreesInCategoryConsistencyValidator
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.cms.contenttype.validation.AbstractContentValidator
org.ametys.odf.ose.enumeration.DegreesInCategoryConsistencyValidator
- All Implemented Interfaces:
ContentValidator
,LogEnabled
,Serviceable
public class DegreesInCategoryConsistencyValidator
extends AbstractContentValidator
implements Serviceable
Global validator for a Degree Category (entry of reference table),
which checks that all its degrees are only binded to this category.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected I18nizableText
_getErrorLabel
(Content degree, Content degreeCategory) Get the error label corresponding to the given degree and category.protected String
_getXPathQuery
(Content degree, Content currentDegreeCategory) Returns the XPath query to execute to obtain the list of categories except the current category in which the degree appears.protected boolean
_isInAnotherCategory
(Content degree, Content degreeCategory) Check if the current degree is in another category than the current category.void
service
(ServiceManager manager) void
Validates a content being editedvoid
Validates a content.Methods inherited from class org.ametys.cms.contenttype.validation.AbstractContentValidator
getContentType, setContentType
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
_resolver
The Ametys object resolver
-
-
Constructor Details
-
DegreesInCategoryConsistencyValidator
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
validate
Description copied from interface:ContentValidator
Validates a content.- Specified by:
validate
in interfaceContentValidator
- Parameters:
content
- the content to validateerrors
- the structure to populate if the validation failed.
-
validate
Description copied from interface:ContentValidator
Validates a content being edited- Specified by:
validate
in interfaceContentValidator
- Parameters:
degreeCategory
- the content to validatevalues
- the values being setview
- the viewerrors
- the structure to populate if the validation failed.
-
_isInAnotherCategory
Check if the current degree is in another category than the current category.- Parameters:
degree
- The current degreedegreeCategory
- The current category- Returns:
true
if it's in another degree category
-
_getXPathQuery
Returns the XPath query to execute to obtain the list of categories except the current category in which the degree appears.- Parameters:
degree
- The degreecurrentDegreeCategory
- The current degree category- Returns:
- An XPath query
-
_getErrorLabel
Get the error label corresponding to the given degree and category.- Parameters:
degree
- The degreedegreeCategory
- The degree category- Returns:
- The error label as i18n
-