Class BaseParameterConstraint
- java.lang.Object
-
- org.alfresco.repo.action.constraint.BaseParameterConstraint
-
- All Implemented Interfaces:
ParameterConstraint,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware
- Direct Known Subclasses:
AspectParameterConstraint,EnumParameterConstraint,FolderContentsParameterConstraint,MimetypeParameterConstraint,PropertyParameterConstraint,TypeParameterConstraint
public abstract class BaseParameterConstraint extends java.lang.Object implements ParameterConstraint, org.springframework.beans.factory.BeanNameAware
Base implementation of a parameter constraint- Author:
- Roy Wetherall
-
-
Field Summary
Fields Modifier and Type Field Description protected RuntimeActionServiceactionServiceRuntime action serviceprotected java.util.Map<java.lang.String,java.lang.String>allowableValuesMap of allowable valuesprotected booleancacheFlag to determine whether the allowable values should be cachedprotected java.lang.StringnameConstraint name
-
Constructor Summary
Constructors Constructor Description BaseParameterConstraint()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,java.lang.String>getAllowableValues()The implementers are expected to return allowed values in the insertion order.protected abstract java.util.Map<java.lang.String,java.lang.String>getAllowableValuesImpl()Gets the list of allowable values, calculating them every time it is called.protected java.lang.StringgetI18NLabel(java.lang.String key)Get the I18N display label for a particular keyjava.lang.StringgetName()Gets the unique name of the constraintjava.lang.StringgetValueDisplayLabel(java.lang.String value)voidinit()Init methodbooleanisValidValue(java.lang.String value)Indicates whether the provided value satisfies the constraint.voidsetActionService(RuntimeActionService actionService)Set the action servicevoidsetBeanName(java.lang.String name)voidsetCacheAllowableValues(boolean cache)Determines whether the allowable values should be cached, default is true.
-
-
-
Field Detail
-
name
protected java.lang.String name
Constraint name
-
actionService
protected RuntimeActionService actionService
Runtime action service
-
cache
protected boolean cache
Flag to determine whether the allowable values should be cached
-
allowableValues
protected java.util.Map<java.lang.String,java.lang.String> allowableValues
Map of allowable values
-
-
Method Detail
-
init
public void init()
Init method
-
setActionService
public void setActionService(RuntimeActionService actionService)
Set the action service- Parameters:
actionService- action service
-
setCacheAllowableValues
public void setCacheAllowableValues(boolean cache)
Determines whether the allowable values should be cached, default is true.- Parameters:
cache- boolean
-
getName
public java.lang.String getName()
Description copied from interface:ParameterConstraintGets the unique name of the constraint- Specified by:
getNamein interfaceParameterConstraint- Returns:
- String constraint name
- See Also:
ParameterConstraint.getName()
-
setBeanName
public void setBeanName(java.lang.String name)
- Specified by:
setBeanNamein interfaceorg.springframework.beans.factory.BeanNameAware- See Also:
BeanNameAware.setBeanName(java.lang.String)
-
getAllowableValues
public java.util.Map<java.lang.String,java.lang.String> getAllowableValues()
Description copied from interface:ParameterConstraintThe implementers are expected to return allowed values in the insertion order.- Specified by:
getAllowableValuesin interfaceParameterConstraint- See Also:
ParameterConstraint.getAllowableValues()
-
getAllowableValuesImpl
protected abstract java.util.Map<java.lang.String,java.lang.String> getAllowableValuesImpl()
Gets the list of allowable values, calculating them every time it is called.- Returns:
- map of allowable values
-
getI18NLabel
protected java.lang.String getI18NLabel(java.lang.String key)
Get the I18N display label for a particular key- Parameters:
key- String- Returns:
- String I18N value
-
getValueDisplayLabel
public java.lang.String getValueDisplayLabel(java.lang.String value)
- Specified by:
getValueDisplayLabelin interfaceParameterConstraint- Parameters:
value- String- Returns:
- String
- See Also:
ParameterConstraint.getValueDisplayLabel(String)
-
isValidValue
public boolean isValidValue(java.lang.String value)
Description copied from interface:ParameterConstraintIndicates whether the provided value satisfies the constraint. True if it does, false otherwise.- Specified by:
isValidValuein interfaceParameterConstraint- Returns:
- boolean true if valid, false otherwise
- See Also:
ParameterConstraint.isValidValue(String)
-
-