mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Merged 5.1.N (5.1.1) to HEAD (5.2)
123431 amorarasu: Merged 5.0.N (5.0.4) to 5.1.N (5.1.1) (PARTIAL MERGE) 123349 cturlica: Merged V4.2-BUG-FIX (4.2.7) to 5.0.N (5.0.4) 123109 adragoi: Merged DEV to V4.2-BUG-FIX (4.2.7) 123105 adragoi: MNT-15705 : CLONE - Receiving error when bulk deleting content in Share - created remove overloaded method in script node that uses a new transaction and used it for bulk delete git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@123706 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -65,6 +65,8 @@ import org.alfresco.repo.thumbnail.ThumbnailHelper;
|
|||||||
import org.alfresco.repo.thumbnail.ThumbnailRegistry;
|
import org.alfresco.repo.thumbnail.ThumbnailRegistry;
|
||||||
import org.alfresco.repo.thumbnail.script.ScriptThumbnail;
|
import org.alfresco.repo.thumbnail.script.ScriptThumbnail;
|
||||||
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
import org.alfresco.repo.transaction.AlfrescoTransactionSupport;
|
||||||
|
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||||
|
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||||
import org.alfresco.repo.version.VersionModel;
|
import org.alfresco.repo.version.VersionModel;
|
||||||
import org.alfresco.repo.workflow.jscript.JscriptWorkflowInstance;
|
import org.alfresco.repo.workflow.jscript.JscriptWorkflowInstance;
|
||||||
import org.alfresco.scripts.ScriptException;
|
import org.alfresco.scripts.ScriptException;
|
||||||
@@ -195,6 +197,7 @@ public class ScriptNode implements Scopeable, NamespacePrefixResolverProvider
|
|||||||
protected ServiceRegistry services = null;
|
protected ServiceRegistry services = null;
|
||||||
private NodeService nodeService = null;
|
private NodeService nodeService = null;
|
||||||
private FileFolderService fileFolderService = null;
|
private FileFolderService fileFolderService = null;
|
||||||
|
private RetryingTransactionHelper retryingTransactionHelper = null;
|
||||||
private Boolean isDocument = null;
|
private Boolean isDocument = null;
|
||||||
private Boolean isContainer = null;
|
private Boolean isContainer = null;
|
||||||
private Boolean isLinkToDocument = null;
|
private Boolean isLinkToDocument = null;
|
||||||
@@ -261,6 +264,7 @@ public class ScriptNode implements Scopeable, NamespacePrefixResolverProvider
|
|||||||
this.services = services;
|
this.services = services;
|
||||||
this.nodeService = services.getNodeService();
|
this.nodeService = services.getNodeService();
|
||||||
this.fileFolderService = services.getFileFolderService();
|
this.fileFolderService = services.getFileFolderService();
|
||||||
|
this.retryingTransactionHelper = services.getTransactionService().getRetryingTransactionHelper();
|
||||||
this.scope = scope;
|
this.scope = scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2029,18 +2033,41 @@ public class ScriptNode implements Scopeable, NamespacePrefixResolverProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove this node. Any references to this Node or its NodeRef should be discarded!
|
* Remove this node. Any references to this Node or its NodeRef should be
|
||||||
|
* discarded!
|
||||||
*
|
*
|
||||||
* Beware: Any unsaved property changes will be lost when this is called. To preserve property changes call {@link #save()} first.
|
* Beware: Any unsaved property changes will be lost when this is called. To
|
||||||
|
* preserve property changes call {@link save()} first.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public boolean remove()
|
public boolean remove()
|
||||||
|
{
|
||||||
|
return remove(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove this node in a new transaction or not as specified.
|
||||||
|
* Any references to this Node or its NodeRef should be discarded!
|
||||||
|
*
|
||||||
|
* Beware: Any unsaved property changes will be lost when this is called. To
|
||||||
|
* preserve property changes call {@link save()} first.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public boolean remove(boolean newTransaction)
|
||||||
{
|
{
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
|
|
||||||
if (nodeService.exists(this.nodeRef))
|
if (nodeService.exists(this.nodeRef))
|
||||||
{
|
{
|
||||||
this.nodeService.deleteNode(this.nodeRef);
|
retryingTransactionHelper.doInTransaction(new RetryingTransactionCallback<Void>()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public Void execute() throws Throwable
|
||||||
|
{
|
||||||
|
nodeService.deleteNode(nodeRef);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}, false, newTransaction);
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user