use of org.alfresco.service.cmr.transfer.TransferEventBegin in project alfresco-repository by Alfresco.
the class TransferTreeWithCancelActionExecuter method executeImpl.
/* (non-Javadoc)
* @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef)
*/
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef) {
TransferTarget target = serviceRegistry.getTransactionService().getRetryingTransactionHelper().doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<TransferTarget>() {
public TransferTarget execute() throws Throwable {
return TransferTestUtil.getTestTarget(transferService);
}
}, false, true);
NodeCrawler crawler = new StandardNodeCrawlerImpl(serviceRegistry);
crawler.setNodeFinders(new ChildAssociatedNodeFinder(ContentModel.ASSOC_CONTAINS));
Set<NodeRef> nodes = crawler.crawl(actionedUponNodeRef);
TransferDefinition td = new TransferDefinition();
td.setNodes(nodes);
transferService.transferAsync(target.getName(), td, new TransferCallback() {
private String transferId;
public void processEvent(TransferEvent event) {
if (event instanceof TransferEventBegin) {
transferId = ((TransferEventBegin) event).getTransferId();
} else if (event instanceof TransferEventCommittingStatus) {
transferService.cancelAsync(transferId);
}
}
});
}
use of org.alfresco.service.cmr.transfer.TransferEventBegin in project alfresco-repository by Alfresco.
the class TestTransferCallback method processEvent.
public void processEvent(TransferEvent event) {
logger.debug(event.toString());
events.add(event);
if (event instanceof TransferEventBegin) {
TransferEventBegin beginEvent = (TransferEventBegin) event;
transferId = beginEvent.getTransferId();
}
}
Aggregations