cancel
Showing results for 
Search instead for 
Did you mean: 

Mandatory association problem

tomasp
Champ in-the-making
Champ in-the-making
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
2 REPLIES 2

afaust
Legendary Innovator
Legendary Innovator
Hello,

the "enforced" attribute on association mandatory settings is actually not required as - in contrast to properties - association "mandatory-ness" is already enforced and validated by default.
I'd advise against defining mandatory associations for content types as this prevents you from uploading any document of this type or even specializing the type via the "Change Type" action, as you have no way of providing the associations in these operations. The only mandatory associations should be on aspects IMHO.

Basically, the behavior you describe is to be expected for the model you defined.

Regards
Axel

mirko79_9866
Champ in-the-making
Champ in-the-making
I AFaust,

is this behavior still valid?
Documentation for alfresco 4.1 says that it's possible to set enforced="false": http://docs.alfresco.com/4.1/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Fconcepts%2Fmetadata-mo...

Thanks,
mirko