Class ModelValidationScriptService

java.lang.Object
org.xwiki.model.validation.script.ModelValidationScriptService
All Implemented Interfaces:
org.xwiki.script.service.ScriptService

@Component @Named("modelvalidation") @Singleton public class ModelValidationScriptService extends Object implements org.xwiki.script.service.ScriptService
Script service for name strategies.
Since:
12.0RC1
Version:
$Id: 9e77752b6f2b033bf31ecaf4da2cd9fb9cfa04ac $
  • Field Details

  • Constructor Details

    • ModelValidationScriptService

      public ModelValidationScriptService()
  • Method Details

    • getManager

      public EntityNameValidationManager getManager()
      Return the name strategy manager if the user has programming rights only.
      Returns:
      the manager for name strategies or null.
    • getConfiguration

      public EntityNameValidationConfiguration getConfiguration()
      Return the name strategy configuration if the user has programming rights only.
      Returns:
      the configuration for name strategies or null.
    • getReplaceCharacterEntityNameValidationConfiguration

      public org.xwiki.model.validation.internal.ReplaceCharacterEntityNameValidationConfiguration getReplaceCharacterEntityNameValidationConfiguration()
      Returns:
      the configuration replace character entity name configuration
    • transformName

      public String transformName(String name)
      Transform a name according to the current name strategy, if the configuration is set to use transformation. Else it will just return the given name.
      Parameters:
      name - the name to transform.
      Returns:
      the transformed named.
    • transformEntityReference

      public EntityReference transformEntityReference(EntityReference sourceEntity)
      Transform an entity reference according to the current name strategy if the configuration is set to use transformation. Else it will just return the given source entity.
      Parameters:
      sourceEntity - the entity reference to transform.
      Returns:
      the transformed entity reference.
    • transformName

      public String transformName(String name, String hint)
      Transform a name according to the given name strategy.
      Parameters:
      name - the name to transform.
      hint - hint of the name strategy component to use.
      Returns:
      a transformed name.
    • transformEntityReference

      public EntityReference transformEntityReference(EntityReference sourceEntity, String hint)
      Transform a source entity according to the given name strategy.
      Parameters:
      sourceEntity - the source entity to transform.
      hint - hint of the name strategy component to use.
      Returns:
      a transformed source entity.
    • isValid

      public boolean isValid(String name)
      Validate a name according to the current name strategy, only if the configuration is set to use validation.
      Parameters:
      name - the name to validate.
      Returns:
      true if the name is valid, or if the configuration is set to not use validation.
    • isValid

      public boolean isValid(EntityReference sourceEntity)
      Validate a source entity according to the current name strategy, only if the configuration is set to use validation.
      Parameters:
      sourceEntity - the source entity to validate.
      Returns:
      true if the source entity is valid, or if the configuration is set to not use validation.
    • isValid

      public boolean isValid(String name, String hint)
      Validate a name according to the given name strategy.
      Parameters:
      name - the name to validate.
      hint - the hint of name strategy to use.
      Returns:
      true if the name is valid according to the name strategy.
    • isValid

      public boolean isValid(EntityReference sourceEntity, String hint)
      Validate a source entity according to the given name strategy.
      Parameters:
      sourceEntity - the source entity to validate.
      hint - the hint of name strategy to use.
      Returns:
      true if the source entity is valid according to the name strategy.
    • get

      public <S extends org.xwiki.script.service.ScriptService> S get(String serviceName)
      Type Parameters:
      S - the type of the ScriptService
      Parameters:
      serviceName - the name of the sub ScriptService
      Returns:
      the ScriptService or null of none could be found