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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<S extends org.xwiki.script.service.ScriptService>
SReturn the name strategy configuration if the user has programming rights only.Return the name strategy manager if the user has programming rights only.org.xwiki.model.validation.internal.ReplaceCharacterEntityNameValidationConfiguration
boolean
Validate a name according to the current name strategy, only if the configuration is set to use validation.boolean
Validate a name according to the given name strategy.boolean
isValid
(EntityReference sourceEntity) Validate a source entity according to the current name strategy, only if the configuration is set to use validation.boolean
isValid
(EntityReference sourceEntity, String hint) Validate a source entity according to the given name strategy.transformEntityReference
(EntityReference sourceEntity) Transform an entity reference according to the current name strategy if the configuration is set to use transformation.transformEntityReference
(EntityReference sourceEntity, String hint) Transform a source entity according to the given name strategy.transformName
(String name) Transform a name according to the current name strategy, if the configuration is set to use transformation.transformName
(String name, String hint) Transform a name according to the given name strategy.
-
Field Details
-
ID
The id of this script service.- See Also:
-
-
Constructor Details
-
ModelValidationScriptService
public ModelValidationScriptService()
-
-
Method Details
-
getManager
Return the name strategy manager if the user has programming rights only.- Returns:
- the manager for name strategies or null.
-
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
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
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
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
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
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
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
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
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
- Type Parameters:
S
- the type of theScriptService
- Parameters:
serviceName
- the name of the subScriptService
- Returns:
- the
ScriptService
or null of none could be found
-