mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Feature/rm 7103 changes from governance pr#1421 (#508)
* RM-7103: [AGS] Updating record retention schedule to a longer period fails - Run as system user when setting the disposition property on the node. * RM-7103: [AGS] Updating record retention schedule to a longer period fails - Added test * RM-7103: [AGS] Updating record retention schedule to a longer period fails - Removed unnecessary parentheses * RM-7103: [AGS] Updating record retention schedule to a longer period fails - Added missing constants * RM-7103: [AGS] Updating record retention schedule to a longer period fails - Replaced with lambda expression Co-authored-by: Raluca Munteanu <raluca.munteanu@ness.com>
This commit is contained in:
@@ -59,6 +59,7 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport.TxnReadState;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
@@ -330,18 +331,23 @@ public class DispositionServiceImpl extends ServiceBaseImpl
|
||||
final String dispositionActionName = dsNextAction.getNextActionName();
|
||||
final Date dispositionActionDate = dsNextAction.getNextActionDateAsOf();
|
||||
|
||||
// check if current transaction is a READ ONLY one and if true set the property on the node
|
||||
RunAsWork<Void> runAsWork = () -> {
|
||||
nodeService.setProperty(action, PROP_DISPOSITION_AS_OF, dispositionActionDate);
|
||||
return null;
|
||||
};
|
||||
|
||||
// if the current transaction is READ ONLY set the property on the node
|
||||
// in a READ WRITE transaction
|
||||
if (AlfrescoTransactionSupport.getTransactionReadState().equals(TxnReadState.TXN_READ_ONLY))
|
||||
{
|
||||
transactionService.getRetryingTransactionHelper().doInTransaction((RetryingTransactionCallback<Void>) () -> {
|
||||
getInternalNodeService().setProperty(action, PROP_DISPOSITION_AS_OF, dispositionActionDate);
|
||||
AuthenticationUtil.runAsSystem(runAsWork);
|
||||
return null;
|
||||
}, false, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
getInternalNodeService().setProperty(action, PROP_DISPOSITION_AS_OF, dispositionActionDate);
|
||||
AuthenticationUtil.runAsSystem(runAsWork);
|
||||
}
|
||||
|
||||
if (dsNextAction.getWriteMode().equals(WriteMode.DATE_AND_NAME))
|
||||
|
Reference in New Issue
Block a user