Class DegreesInCategoryConsistencyValidator

All Implemented Interfaces:
ContentValidator, LogEnabled, Serviceable

Global validator for a Degree Category (entry of reference table), which checks that all its degrees are only binded to this category.
  • Field Details

  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager manager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Throws:
      ServiceException
    • validate

      public void validate(Content content, Errors errors)
      Description copied from interface: ContentValidator
      Validates a content.
      Specified by:
      validate in interface ContentValidator
      Parameters:
      content - the content to validate
      errors - the structure to populate if the validation failed.
    • validate

      public void validate(Content degreeCategory, Map<String,Object> values, View view, Errors errors)
      Description copied from interface: ContentValidator
      Validates a content being edited
      Specified by:
      validate in interface ContentValidator
      Parameters:
      degreeCategory - the content to validate
      values - the values being set
      view - the view
      errors - the structure to populate if the validation failed.
    • _isInAnotherCategory

      protected boolean _isInAnotherCategory(Content degree, Content degreeCategory)
      Check if the current degree is in another category than the current category.
      Parameters:
      degree - The current degree
      degreeCategory - The current category
      Returns:
      true if it's in another degree category
    • _getXPathQuery

      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.
      Parameters:
      degree - The degree
      currentDegreeCategory - The current degree category
      Returns:
      An XPath query
    • _getErrorLabel

      protected I18nizableText _getErrorLabel(Content degree, Content degreeCategory)
      Get the error label corresponding to the given degree and category.
      Parameters:
      degree - The degree
      degreeCategory - The degree category
      Returns:
      The error label as i18n