ParameterDefinitionImpl - with constraint

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2014 04:14 PM
I'm using ParameterDefinitionImpl ctor that has takes a constraint as a String value. How do I specify the constraint if the constraint is defined in my model:
paramList.add(new ParameterDefinitionImpl(PARAM_MY_PARAM, DataTypeDefinition.TEXT, false,
getParamDisplayLabel(PARAM_MY_PARAM), false, "mydocument:my_constraint"));
does not work.
<constraint name="mydocument:my_constraint" type="LIST">
<parameter name="allowedValues">
<list>
<value>asdf</value>
<value>qwerty</value>
<value>zzaa1</value>
<value>1234</value>
</list>
</parameter>
</constraint>
- Labels:
-
Archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2014 02:40 AM
If you want to use property constraint to constraint the list of allowable values for a action parameter ,you can do it like this.
1.Customize a class that inherit from org.alfresco.repo.action.constraint.BaseParameterConstraint, inject DictionaryService into your class.
2.Override method of getAllowableValuesImpl().in your getAllowableValuesImpl() do following
a.Get the definition of your property constraint by calling DictionaryService.getConstraint() ;
b.Iterate the list of constrained values and construt allowable parameter constraint values map.
3.Configure you class in spring configuration file and put it in extension classpath.
4.Pass the bean name your configured in spring as parameterConstraintName to ParameterDefinitionImpl constructor
new ParameterDefinitionImpl(PARAM_MY_PARAM, DataTypeDefinition.TEXT, false, getParamDisplayLabel(PARAM_MY_PARAM), false, "bean name you configured in spring")

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-14-2014 08:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2017 06:02 AM
Hi Kayne Zhang,
I implemented the same procedure which is suggested and Iam able to get the values.This is very useful article.
But I noticed that getAllowableValuesImpl() method is called when I click on MangeRules,New Rule tab in alfresco share UI.
And I want that getAllowableValuesImpl() should be called only when I click on New Rule Tab ,as I have the requirement to display a dialog box when I click on New Rule and that logic I had configured in getAllowableValuesImpl() method.
Can you please suggest how to make getAllowableValuesImpl() to call on New Rule tab
