We need to add a "unique" boolean to our structure>field object. If this value is checked for a specific field, then we need to validate (on contentlet save) that the value in the field is going to be unique for all contentlets in that structure.
If unique is checked for a field, then that field should only be able to be a varchar or a integer. Additionally, if unique is checked, then required and system indexed should be checked and automatically grayed out.
We will not enforce uniqueness on already existing content, meaning that if you change a field in a structure that is already populated with content, the field will be marked and unique. Then, if a user tries to edit a contentlet that does not have a unique value for the field, they will have to change the value before it will save.
Why do we need this? 2 quick reasons. 1, we need this for any kind of wiki functionality, so that we can have page URLs like:
http://www,dotcms.org/wiki/How+to+Use+Macros.dot
Where the "How to Use Macros" is the unique title of a piece of "wiki" content. Also, we need this for our blogs for the same resason - to be able to reference our blog entries by title rather than by ?id=1231235253
Also on a side not we need to change the restoreVersion method of the contentletAPIImpl to use the checkin so it validates properly
The validation fro the unique field needs to be in the contentletapiimpl validate method.