tsgrp / HPI

OpenContent Management Suite (OCMS)
http://www.tsgrp.com/products
17 stars 5 forks source link

Chain Versionable - Cannot version documents with custom target associations #2436

Closed jharkins2 closed 3 years ago

jharkins2 commented 3 years ago

Currently we cannot version documents with custom target associations when using chain versionable. The following error will occur as part of the versioning process:

[2021-08-23 15:55:45,724|ERROR|CheckInWebscript|executeImpl|78] Unhandled exception: null
org.alfresco.service.cmr.repository.AssociationExistsException
    at org.alfresco.repo.domain.node.AbstractNodeDAOImpl.newNodeAssoc(AbstractNodeDAOImpl.java:2898)
    at org.alfresco.repo.node.db.DbNodeServiceImpl.createAssociation_aroundBody86(DbNodeServiceImpl.java:2027)
    at org.alfresco.repo.node.db.DbNodeServiceImpl$AjcClosure87.run(DbNodeServiceImpl.java:1)
    at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:257)
    at org.alfresco.traitextender.AJExtender.localProceed(AJExtender.java:728)
    at org.alfresco.traitextender.AJProxyTrait.invoke(AJProxyTrait.java:86)
    at com.sun.proxy.$Proxy40.createAssociation(Unknown Source)
    at org.alfresco.repo.virtual.bundle.VirtualNodeServiceExtension.createAssociation(VirtualNodeServiceExtension.java:1141)
    at jdk.internal.reflect.GeneratedMethodAccessor1537.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.alfresco.traitextender.SingletonExtensionFactory$TraiSingletontHandler.invoke(SingletonExtensionFactory.java:74)
    at com.sun.proxy.$Proxy313.createAssociation(Unknown Source)
    at jdk.internal.reflect.GeneratedMethodAccessor1559.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.alfresco.traitextender.AJExtender.extendAroundAdvice(AJExtender.java:654)
    at org.alfresco.traitextender.RouteExtensions.ajc$inlineAccessMethod$org_alfresco_traitextender_RouteExtensions$org_alfresco_traitextender_AJExtender$extendAroundAdvice(RouteExtensions.java:1)
    at org.alfresco.traitextender.RouteExtensions.intercept(RouteExtensions.java:85)
    at org.alfresco.repo.node.db.DbNodeServiceImpl.createAssociation(DbNodeServiceImpl.java:2014)
    at jdk.internal.reflect.GeneratedMethodAccessor1537.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    at org.alfresco.repo.lock.mem.LockableAspectInterceptor.invoke(LockableAspectInterceptor.java:244)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
    at com.sun.proxy.$Proxy36.createAssociation(Unknown Source)
    at jdk.internal.reflect.GeneratedMethodAccessor1537.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    at org.alfresco.repo.tenant.MultiTNodeServiceInterceptor.invoke(MultiTNodeServiceInterceptor.java:111)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
    at com.sun.proxy.$Proxy36.createAssociation(Unknown Source)
    at jdk.internal.reflect.GeneratedMethodAccessor1537.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.alfresco.repo.service.StoreRedirectorProxyFactory$RedirectorInvocationHandler.invoke(StoreRedirectorProxyFactory.java:231)
    at com.sun.proxy.$Proxy68.createAssociation(Unknown Source)
    at jdk.internal.reflect.GeneratedMethodAccessor1537.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    at org.alfresco.repo.tagging.TagScopePropertyMethodInterceptor.invoke(TagScopePropertyMethodInterceptor.java:159)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.alfresco.repo.node.MLPropertyInterceptor.invoke(MLPropertyInterceptor.java:311)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.alfresco.repo.node.NodeRefPropertyMethodInterceptor.invoke(NodeRefPropertyMethodInterceptor.java:276)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.alfresco.repo.interceptor.RmNodeRefPropertyInterceptor.invoke(RmNodeRefPropertyInterceptor.java:42)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
    at com.sun.proxy.$Proxy36.createAssociation(Unknown Source)
    at jdk.internal.reflect.GeneratedMethodAccessor1537.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
    at com.sun.proxy.$Proxy36.createAssociation(Unknown Source)
    at jdk.internal.reflect.GeneratedMethodAccessor1537.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    at org.alfresco.repo.node.ContentPropertyRestrictionInterceptor.invoke(ContentPropertyRestrictionInterceptor.java:207)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.alfresco.repo.audit.DisableAuditableBehaviourInterceptor.invoke(DisableAuditableBehaviourInterceptor.java:120)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.alfresco.module.org_alfresco_module_rm.security.RMMethodSecurityInterceptor.invoke(RMMethodSecurityInterceptor.java:352)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:53)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.alfresco.repo.audit.AuditMethodInterceptor.proceedWithAudit(AuditMethodInterceptor.java:256)
    at org.alfresco.repo.audit.AuditMethodInterceptor.proceed(AuditMethodInterceptor.java:216)
    at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:171)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.alfresco.repo.transaction.RetryingTransactionInterceptor$1.execute(RetryingTransactionInterceptor.java:95)
    at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:450)
    at org.alfresco.repo.transaction.RetryingTransactionInterceptor.invoke(RetryingTransactionInterceptor.java:85)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.alfresco.enterprise.repo.authorization.AuthorizationStatusInterceptor.invoke(AuthorizationStatusInterceptor.java:189)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
    at com.sun.proxy.$Proxy36.createAssociation(Unknown Source)
    at com.tsgrp.alfresco.chained.versionable.VersionChainPolicy.updateSourceTargetAssociations(VersionChainPolicy.java:406)
    at com.tsgrp.alfresco.chained.versionable.VersionChainPolicy.createVersionCopy(VersionChainPolicy.java:362)
    at com.tsgrp.alfresco.chained.versionable.VersionChainPolicy.access$100(VersionChainPolicy.java:51)
    at com.tsgrp.alfresco.chained.versionable.VersionChainPolicy$1.doWork(VersionChainPolicy.java:215)
    at com.tsgrp.alfresco.chained.versionable.VersionChainPolicy$1.doWork(VersionChainPolicy.java:184)
    at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:602)
    at com.tsgrp.alfresco.chained.versionable.VersionChainPolicy.beforeCheckIn(VersionChainPolicy.java:184)

This occurs when creating our node copy and moving target associations over. Alfresco as part of the copy will move the custom target associations over for us, so when we add them ourselves a duplicate association is added

jharkins2 commented 3 years ago

Close at revision #10482/10483

ASSOCIATION MIGRATION

Making sure target associations do not already exist before we move them from the node to the node copy on check in

CR: aking, dgrumieaux

ASSOCIATION MIGRATION

Cleaning up incorrect javadoc