tsgrp / HPI

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

CVN/ Controlled Docs Checkin After Delete Fails #2454

Closed katiebrill closed 2 years ago

katiebrill commented 2 years ago

Process to recreate issue:

Stack trace:

ERROR EmbeddedAlfrescoAdvice An unspecified OC exception occurred com.tsgrp.opencontent.core.exception.OCRuntimeException: Unhandled exception around OC method class: doEnhancedCreateObject at com.tsgrp.opencontent.alfresco.content.AlfrescoEmbContentImpl.doEnhancedUpdateObject(AlfrescoEmbContentImpl.java:1101) at com.tsgrp.opencontent.core.content.AbstractContentImpl.enhancedUpdateObject(AbstractContentImpl.java:235) at sun.reflect.GeneratedMethodAccessor1428.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ... Caused by: org.alfresco.repo.node.integrity.IntegrityException: 03170108 Found 2 integrity violations: The association target multiplicity has been violated: Source Node: workspace://SpacesStore/377b62f3-8726-4665-a1a3-31bab6d34f4e Association: Association[ class=ClassDef[name={http://www.alfresco.org/model/content/1.0}copiedfrom], name={http://www.alfresco.org/model/content/1.0}original, target class={http://www.alfresco.org/model/content/1.0}cmobject, source role=null, target role=null] Required target Multiplicity: 0..1 Actual target Multiplicity: 2 The association target multiplicity has been violated: Source Node: workspace://SpacesStore/377b62f3-8726-4665-a1a3-31bab6d34f4e Association: Association[ class=ClassDef[name={http://www.alfresco.org/model/content/1.0}copiedfrom], name={http://www.alfresco.org/model/content/1.0}original, target class={http://www.alfresco.org/model/content/1.0}cmobject, source role=null, target role=null] Required target Multiplicity: 0..1 Actual target Multiplicity: 2 at org.alfresco.repo.node.integrity.IntegrityChecker.checkIntegrity(IntegrityChecker.java:669) at org.alfresco.repo.node.integrity.IntegrityChecker.beforeCommit(IntegrityChecker.java:771) at org.alfresco.util.transaction.TransactionSupportUtil$TransactionSynchronizationImpl.beforeCommit(TransactionSupportUtil.java:498) at org.springframework.transaction.support.TransactionSynchronizationUtils.triggerBeforeCommit(TransactionSynchronizationUtils.java:95) at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCommit(AbstractPlatformTransactionManager.java:925) at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:738) at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:724) at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:475) at org.alfresco.util.transaction.SpringAwareUserTransaction.commit(SpringAwareUserTransaction.java:482) at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:486) at com.tsgrp.opencontent.alfresco.content.AlfrescoEmbContentImpl$4.execute(AlfrescoEmbContentImpl.java:1083) at com.tsgrp.opencontent.alfresco.content.AlfrescoEmbContentImpl$4.execute(AlfrescoEmbContentImpl.java:886) at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:464) at com.tsgrp.opencontent.alfresco.content.AlfrescoEmbContentImpl.doEnhancedUpdateObject(AlfrescoEmbContentImpl.java:886)

Cause of the issue:

After Deleteing version 0.2 of the controlled doc, a cm:original association gets added to version 0.1 and ties that node TO ITSELF

Details of that assoc:

Note: If I use the alfresco api to delete that association then I can check the document in successfully

katiebrill commented 2 years ago

CVN alfresco commit: 10514

Checking in a new version of a controlled doc after the last version was deleted errors out (for example: if you had a 0.1 and 0.2, then deleted the 0.2, then checked out the 0.1 and tried checking it back in it would fail)

This is because deleting the 0.2 somehow causes a weird cm:original association that ties the 0.1 to itself. This association then causes an integrity violation on checkin.

The solution is to check for this odd association before copying over the associations on checkin.

CR: aking, cadcock, gsteimer, dgrumieaux