org.alfresco.repo.action.constraint
Class BaseParameterConstraint

java.lang.Object
  extended by org.alfresco.repo.action.constraint.BaseParameterConstraint
All Implemented Interfaces:
ParameterConstraint, 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


Field Summary
protected  RuntimeActionService actionService
          Runtime action service
protected  java.util.Map allowableValues
          Map of allowable values
protected  boolean cache
          Flag to determine whether the allowable values should be cached
protected  java.lang.String name
          Constraint name
 
Constructor Summary
BaseParameterConstraint()
           
 
Method Summary
 java.util.Map getAllowableValues()
           
protected abstract  java.util.Map getAllowableValuesImpl()
          Gets the list of allowable values, calculating them every time it is called.
protected  java.lang.String getI18NLabel(java.lang.String key)
          Get the I18N display label for a particular key
 java.lang.String getName()
          Gets the unique name of the constraint
 java.lang.String getValueDisplayLabel(java.lang.String value)
           
 void init()
          Init method
 boolean isValidValue(java.lang.String value)
          Indicates whether the provided value satisfies the constraint.
 void setActionService(RuntimeActionService actionService)
          Set the action service
 void setBeanName(java.lang.String name)
           
 void setCacheAllowableValues(boolean cache)
          Determines whether the allowable values should be cached, default is true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 allowableValues
Map of allowable values

Constructor Detail

BaseParameterConstraint

public BaseParameterConstraint()
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 -

getName

public java.lang.String getName()
Description copied from interface: ParameterConstraint
Gets the unique name of the constraint

Specified by:
getName in interface ParameterConstraint
Returns:
String constraint name
See Also:
ParameterConstraint.getName()

setBeanName

public void setBeanName(java.lang.String name)
Specified by:
setBeanName in interface org.springframework.beans.factory.BeanNameAware
See Also:
BeanNameAware.setBeanName(java.lang.String)

getAllowableValues

public java.util.Map getAllowableValues()
Specified by:
getAllowableValues in interface ParameterConstraint
See Also:
ParameterConstraint.getAllowableValues()

getAllowableValuesImpl

protected abstract java.util.Map getAllowableValuesImpl()
Gets the list of allowable values, calculating them every time it is called.

Returns:
Map 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 -
Returns:
String I18N value

getValueDisplayLabel

public java.lang.String getValueDisplayLabel(java.lang.String value)
Specified by:
getValueDisplayLabel in interface ParameterConstraint
Returns:
See Also:
org.alfresco.service.cmr.action.ParameterConstraint#getValueDisplayLabel(java.io.Serializable)

isValidValue

public boolean isValidValue(java.lang.String value)
Description copied from interface: ParameterConstraint
Indicates whether the provided value satisfies the constraint. True if it does, false otherwise.

Specified by:
isValidValue in interface ParameterConstraint
Returns:
boolean true if valid, false otherwise
See Also:
org.alfresco.service.cmr.action.ParameterConstraint#isValidValue(java.io.Serializable)


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.