cancel
Showing results for 
Search instead for 
Did you mean: 

Custom content type with LIST constraint

zliu
Champ in-the-making
Champ in-the-making
As a practice, I am trying to extend the custom content model in "Working with Custom Content Types", 2nd edition by Jeff Potts, which BTW is a must read.

Basically, I created an aspect sc:reviewable with a multi-value property sc:reviewer. I also created a LIST constraint sc:reviewerList - the list of allowed values are hard-coded in scModel.xml for now. The LIST constraint sc:reviewerList was applied to sc:reviewer property. The configuration was loaded to Alfresco and tomcat was restarted.

In SomeCoCMISDataCreator.java, I tried to create a document as below


properties.put(PropertyIds.OBJECT_TYPE_ID, "D:sc:whitepaper,P:sc:reviewable");

properties.put("sc:reviewer", Arrays.asList("John Smith", "Jane Doe"));


Somehow, the code threw an error "Constraint violation… the value is not an allowed value: John Smith". To verify the definition, I browsed to
http://localhost:8080/alfresco/s/cmis/type/P:sc:reviewable
and found "John Smith" was indeed listed as one of the cmis:choiceString/cmis:value.

Why would the code complain then? What am I missing? Thanks.
1 REPLY 1

mitpatoliya
Star Collaborator
Star Collaborator
When you are saying you have created the custom constrains. you have created the list of allowable values for one property.
Here you are mixing the concept of multivalue property and property constrain.
What I thought is that It is expecting only one of the value from the list directly to set as the value of that property.not the list.