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 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 Map<String,String>allowableValuesMap of allowable valuesprotected booleancacheFlag to determine whether the allowable values should be cachedprotected StringnameConstraint name
-
Constructor Summary
Constructors Constructor Description BaseParameterConstraint()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Map<String,String>getAllowableValues()The implementers are expected to return allowed values in the insertion order.protected abstract Map<String,String>getAllowableValuesImpl()Gets the list of allowable values, calculating them every time it is called.protected StringgetI18NLabel(String key)Get the I18N display label for a particular keyStringgetName()Gets the unique name of the constraintStringgetValueDisplayLabel(String value)voidinit()Init methodbooleanisValidValue(String value)Indicates whether the provided value satisfies the constraint.voidsetActionService(RuntimeActionService actionService)Set the action servicevoidsetBeanName(String name)voidsetCacheAllowableValues(boolean cache)Determines whether the allowable values should be cached, default is true.
-
-
-
Field Detail
-
name
protected 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
-
-
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 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(String name)
- Specified by:
setBeanNamein interfaceorg.springframework.beans.factory.BeanNameAware- See Also:
BeanNameAware.setBeanName(java.lang.String)
-
getAllowableValues
public Map<String,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 Map<String,String> getAllowableValuesImpl()
Gets the list of allowable values, calculating them every time it is called.- Returns:
- map of allowable values
-
getI18NLabel
protected String getI18NLabel(String key)
Get the I18N display label for a particular key- Parameters:
key- String- Returns:
- String I18N value
-
getValueDisplayLabel
public String getValueDisplayLabel(String value)
- Specified by:
getValueDisplayLabelin interfaceParameterConstraint- Parameters:
value- String- Returns:
- String
- See Also:
ParameterConstraint.getValueDisplayLabel(String)
-
isValidValue
public boolean isValidValue(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)
-
-