Hi all
I've been doing some custom data modelling using constraints, using Notepad++'s XML plugins to validate markup on it's own and against the modelSchema.xsd file found in WEB-INF/classes/alfresco/model and noticed some behaviour I'm not sure is correct.
I have the following in my custom data model:
<constraints> <constraint name="mg:correspondenceTypeConstraint"> <parameter name="allowedValues"> <list> <value>One</value> <value>Two</value> <value>Three</value> </list> </parameter> </constraint> </constraints>
Validating this markup against the schema results in an all clear. I started up Alfresco, no issues what so ever. I have the proper constraint reference markup in the file also (not shown) so that's working as well. After retarting Alfresco I noticed that the List constraint I want on a property doesn't exist. The solution is include type="LIST" in the tag. That's fine, but shouldn't the schema have picked up on the fact I missed decalring a type? Since out of all four constraints Alfresco uses you're always meant to define a type.
It's possible that like some options in data modelling, not declaring elements usually means they're set up with default settings that are invisible to the user, but I would've thought that something like constraint type would be something mandatory.
At first I thought it's possible that the Notepad++ plugin I was using was a bit faulty, so I tried this validator (http://tools.decisionsoft.com/schemaValidate) but again got a validated xml document.
janv
- Posts
- 352
- Achievements
- 5
- Member for
- 5 years 9 months
Alfresco Employee
Stats
Yes, you need to provide a "type" attribute for defined (re-usable) constraints. Please note, in the case of inline constraints, you can either provide a "type" or a "ref" (reference to defined constraint) attribute and no "name" attribute. See also: http://wiki.alfresco.com/wiki/Constraints
Please refer to: http://issues.alfresco.com/jira/browse/ALFCOM-1058
Thanks,
Jan
<--- If this post was helpful, please click Yes on the Post Rating, thank you --->
http://wiki.alfresco.com/ - Alfresco Wiki docs
http://issues.alfresco.com/ - JIRA bug reporting site
https://developer.alfresco.com/ - Alfresco Developer Resources
https://my.alfresco.com/ - Signup for a free account to use "Alfresco in the cloud"