AnsweredAssumed Answered

Mandatory association problem

Question asked by tomasp on Jan 26, 2012
Latest reply on Apr 7, 2014 by mirko79_9866
Hi,
I'm trying to model mandatory association with enforced="false". I created new type with association "Designer". On every document of this type the designer association must be filled.

I want to upload document of my new type. During the upload I can't fill properties and associations, so I declared all mandatory properties and associations as enforced="false". It works perfectly for properties. Document is uploaded and saved without mandatory fields. And when I edit metadata, I must fill mandatory properties.

But when I declared association as mandatory, enforced="false", the document is never uploaded:
16:17:38,108 User:admin ERROR [node.integrity.IntegrityChecker] Found 1 integrity violations:
The association target multiplicity has been violated:
   Source Node: workspace://SpacesStore/8f79bc3c-bebe-4fba-a87d-bdb257261b7f
   Association: Association[ class=ClassDef[name={http://www.foo.com/model/content/1.0}ProductData], name={http://www.foo.com/model/content/1.0}Designer, target class={http://www.alfresco.org/model/content/1.0}person, source role=null, target role=null]
   Required target Multiplicity: 1..1
   Actual target Multiplicity: 0

It seems like Alfresco don't care about enforced="false" within association declaration.

my model snipped:

<association name="foo:Designer">
   <source>
      <mandatory>false</mandatory>
      <many>true</many>
   </source>
   <target>
      <class>cm:person</class>
      <mandatory enforced="false">true</mandatory>
      <many>false</many>
   </target>
</association>

Thanks for all suggestion,

Tom

Outcomes