cancel
Showing results for 
Search instead for 
Did you mean: 

Versioning breaks content associations?

moschops
Champ in-the-making
Champ in-the-making
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.
3 REPLIES 3

miiklay
Champ in-the-making
Champ in-the-making
I'm also looking for more info on this issue as it's happening to me too. I have a custom content defined (with versioning and associations). When I create my content items (of my custom content type) and then edit online, I get this error and cannot edit it. Here are my observations:
1) I noticed that my node reference changes with each attempt to edit. I would imagine that it should remain constant as it is referencing the node I want to edit.
2)  if I do not make any associations when I create my content, I can edit fine. That leads me to believe it is not related with versioning so much as it might be with the associations.
3) if I create my content with the associations (e.g. referencing an image one-to-one, and/or referencing files one-to-many) then I always get the error.

javax.faces.el.EvaluationException: Exception while invoking expression #{EditOnlineDialog.handleHttpEditing}
caused by:
org.alfresco.service.cmr.repository.InvalidNodeRefException: Node does not exist: workspace://SpacesStore/fa7a480b-3258-476f-aed4-2ee4340b1129

Details of error
javax.faces.el.EvaluationException: Exception while invoking expression #{EditOnlineDialog.handleHttpEditing}
at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:156)
at javax.faces.component.UICommand.broadcast(UICommand.java:89)
at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171)
at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.alfresco.service.cmr.repository.InvalidNodeRefException: Node does not exist: workspace://SpacesStore/fa7a480b-3258-476f-aed4-2ee4340b1129
at org.alfresco.repo.node.db.DbNodeServiceImpl.getNodePairNotNull(DbNodeServiceImpl.java:156)
at org.alfresco.repo.node.db.DbNodeServiceImpl.hasAspect(DbNodeServiceImpl.java:712)
at sun.reflect.GeneratedMethodAccessor282.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:296)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:177)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.alfresco.repo.transaction.SingleEntryTransactionResourceInterceptor.invokeInternal(SingleEntryTransactionResourceInterceptor.java:163)
at org.alfresco.repo.transaction.SingleEntryTransactionResourceInterceptor.invoke(SingleEntryTransactionResourceInterceptor.java:138)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy7.hasAspect(Unknown Source)
at sun.reflect.GeneratedMethodAccessor282.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:296)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:177)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.alfresco.repo.tenant.MultiTNodeServiceInterceptor.invoke(MultiTNodeServiceInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy7.hasAspect(Unknown Source)
at sun.reflect.GeneratedMethodAccessor282.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.alfresco.repo.service.StoreRedirectorProxyFactory$RedirectorInvocationHandler.invoke(StoreRedirectorProxyFactory.java:221)
at $Proxy8.hasAspect(Unknown Source)
at sun.reflect.GeneratedMethodAccessor282.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:296)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:177)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
at org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:306)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:306)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:274)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:274)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy7.hasAspect(Unknown Source)
at org.alfresco.repo.model.ml.MLContentInterceptor.invoke(MLContentInterceptor.java:88)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:275)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy31.getReader(Unknown Source)
at org.alfresco.web.bean.coci.EditOnlineDialog.handleHttpEditing(EditOnlineDialog.java:122)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:132)
… 22 more

Any thoughts?

miiklay
Champ in-the-making
Champ in-the-making
I was able to figure out the cause of my issue and want to share in hopes it may help others…

Within our custom content model definition (.xml file in /opt/Alfresco/tomcat/shared/classes/alfresco/extension/) we defined two associations:


  <associations>
    <association name="custom1:whatever1">
      <title>Title1</title>
      <target>
        <class>cm:content</class>
        <mandatory>false</mandatory>
        <many>false</many>
      </target>
    </association>
    <association name="custom1:whatever2">
      <title>Title2</title>
      <target>
        <class>cm:content</class>
        <mandatory>false</mandatory>
        <many>true</many>
      </target>
    </association>
  </associations>

We received errors any time we created content that utilized those associations UPON EDITING THEM online (100% reproducible), but not when we created content that did not utilize the associations. The resolution was to add <source> elements, in addition to the <target> elements:


  <associations>
    <association name="custom1:whatever1">
      <title>Title1</title>
      <source>
        <mandatory>false</mandatory>
        <many>true</many>
      </source>
      <target>
        <class>cm:content</class>
        <mandatory>false</mandatory>
        <many>false</many>
      </target>
    </association>
    <association name="custom1:whatever2">
      <title>Title2</title>
      <source>
        <mandatory>false</mandatory>
        <many>true</many>
      </source>
      <target>
        <class>cm:content</class>
        <mandatory>false</mandatory>
        <many>true</many>
      </target>
    </association>
  </associations>

Hope that helps someone, it was very frustrating. Kudos to Richard Im (Alfresco) for his assistance.

riogrande
Champ in-the-making
Champ in-the-making
Very useful thanks !