Validating values of custom aspects with a dynamic constrain

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2008 06:43 AM
I need to define a custom Aspect that can have a list of allowed values.
If the list of allowed values is fixed, this can be done easily by modifying the customModel.xml file and adding a <constraint> tag, as show below:
So far, so good… but is there an easy way to dynamically retrieve the list of valid contstrain values from an external source (for instance a database table, via JDBC)?
Has anyone done something similar, and can post a description of how this can be done?
Does this require the development of a custom Java component?
If the list of allowed values is fixed, this can be done easily by modifying the customModel.xml file and adding a <constraint> tag, as show below:
<constraints> <constraint name="custom:VerticalMarketAllowedValuesList" type="LIST"> <parameter name="allowedValues"> <list> <value>Telco</value> <value>Finance</value> <value>Insurance</value> <value>Government</value> </list> </parameter> </constraint> </constraints> <types>… <property name="custom:VerticalMarket"> <title>Settore</title> <type>d:text</type> <mandatory>true</mandatory> <constraints> <constraint ref="custom:VerticalMarketAllowedValuesList"/> </constraints> </property>
So far, so good… but is there an easy way to dynamically retrieve the list of valid contstrain values from an external source (for instance a database table, via JDBC)?
Has anyone done something similar, and can post a description of how this can be done?
Does this require the development of a custom Java component?
Labels:
- Labels:
-
Archive
6 REPLIES 6
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2008 05:23 PM

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2008 05:43 PM
http://forums.alfresco.com/en/viewtopic.php?f=5&t=10101&p=38060#p38060
It would require java coding
Thanks Richard!

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2008 04:39 AM
The code is ok, but the list is static , i must restart the alfresco to reload the record from database. Have you suggestion for resolve this ?
Thank you
Alex–70
Thank you
Alex–70

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2008 08:42 AM
If one could found a solution for dynamically load the constraints values/labels, it would be a solution to solve the lack of multilingualism for constraints.
I would like the constraints lists to be localized. Any idea?
Another solution to my problem would be that the categories could be multilingual like a simple cm:mltext. Meaning that the category applied to a node would be shown (in CRUD) by its translated label and not by its (unilingual) value. Engineers please help!
Thanks in advance.
Gilles
I would like the constraints lists to be localized. Any idea?
Another solution to my problem would be that the categories could be multilingual like a simple cm:mltext. Meaning that the category applied to a node would be shown (in CRUD) by its translated label and not by its (unilingual) value. Engineers please help!
Thanks in advance.
Gilles

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2008 10:35 AM
Here is a sample with dynamic values and code (java):
http://blogs.alfresco.com/jbarmash/?p=6
the general idea is to create the values as nodes in a space and to have the code dynamically reading the values and showing them in the constraint. Very clever and very useful since it not only provides dynamic data. It also provides the possibility of data security and data filtering based on user roles and permissions.
http://blogs.alfresco.com/jbarmash/?p=6
the general idea is to create the values as nodes in a space and to have the code dynamically reading the values and showing them in the constraint. Very clever and very useful since it not only provides dynamic data. It also provides the possibility of data security and data filtering based on user roles and permissions.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2012 01:38 PM
Hi guys!, I guess I get a little outdated, but to complete this post, for those arriving now, I would like to mention that there is a component in Alfresco Addons that does this and more in a simple, intuitive and powerful way (Zero Code).
https://addons.alfresco.com/addons/alfresco-metadbconnector-component
I hope this helps the community.
Greetings!
https://addons.alfresco.com/addons/alfresco-metadbconnector-component
I hope this helps the community.
Greetings!
