AnsweredAssumed Answered

Versioning breaks content associations?

Question asked by moschops on Feb 2, 2009
Latest reply on May 4, 2009 by riogrande
I have a content type that has an association with a document abstract type and since I might want to reuse it I put the association in an abstractable aspect.  I figured that an abstract should only have one document referencing it and a document should have only one parent so I made the source and target have <many>false</many> as below.  Unfortunately when I make my documents versionable this seems to break because I end up with multiple versions of the document in the repository that are trying to reference a single version of the abstract.  This causes an error like this when I try to edit the document:

5:56:27,700 ERROR [org.alfresco.repo.node.integrity.IntegrityChecker] Found 1 integrity violations:
The association parent multiplicity has been violated:
   Target Node: workspace://SpacesStore/bec98956-b11c-4417-a6fe-365d83087678
   Association: Association[ class=ClassDef[name={http://goodguide.com/model/1.0}abstractable], name={http://oooooo.com/model/1.0}abstractAssociation, target class={http://oooooo.com/model/1.0}contentAbstract, source role=null, target role=null]
   Required parent Multiplicity: 0..1
   Actual parent Multiplicity: 2

If I relax mulitplicity on the source to true I can edit the document.  Should I be happy with this?  Or should this really require some rule that creates a new version of the abstract document when you edit the document that references it thus preserving the multiplicity.  My feeling is that is not a nice solution since changing the doc doesn't necessarily imply the abstract should change and creating new versions of the abstract in that case is misleading.  Really we should have version agnostic associations…

I have not tried a child-association - I doubt it will behave differently and I think the semantics may be wrong.  I don't necessarily want the abstract deleted if they parent document deleted.

     <aspect name="gg:abstractable">
       <title>Abstractable Aspect</title>
       <associations>
    <child-association name="gg:abstractAssociation">
      <title>Abstract for this item</title>
      <source>
        <mandatory>false</mandatory>
        <many>true</many>
      </source>
      <target>
        <class>gg:contentAbstract</class>
        <mandatory>false</mandatory>
        <many>false</many>
      </target>
    </child-association>
       </associations>
     </aspect>

One other thing - the above constraint error is only visible in the log, the web client UI shows it alarmingly as:

javax.faces.el.EvaluationException: Exception while invoking expression #{EditOnlineDialog.handleHttpEditing}
caused by:
org.alfresco.service.cmr.repository.InvalidNodeRefException: Node does not exist: workspace://SpacesStore/d7bd3c05-e912-4f4f-a079-9a1b6a58cbba

The constraint info isn't shown even if you "Show details" on the exception thus leading the user to think somehow their doc has disappeared.

Outcomes