Project

General

Profile

Revision 62ea8281

ID62ea828192c423cf5ebde23e722ff600b512a942
Parent 0afb9358
Child a48d0ae3

Added by Katja Luther over 3 years ago

cancel the longrunning thread cancels moveTaxonNode and set it to rollbackOnly

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/TaxonNodeServiceImpl.java
23 23
import org.springframework.beans.factory.annotation.Autowired;
24 24
import org.springframework.stereotype.Service;
25 25
import org.springframework.transaction.annotation.Transactional;
26
import org.springframework.transaction.interceptor.TransactionAspectSupport;
26 27

  
27 28
import eu.etaxonomy.cdm.api.service.UpdateResult.Status;
28 29
import eu.etaxonomy.cdm.api.service.config.NodeDeletionConfigurator.ChildHandling;
......
734 735
        monitor.beginTask("Move Taxonnodes", nodes.size() +1);
735 736

  
736 737
        for (TaxonNode node: nodes){
737
            if (!nodes.contains(node.getParent())){
738
                result.includeResult(moveTaxonNode(node,targetNode, movingType));
738
            if (!monitor.isCanceled()){
739
                if (!nodes.contains(node.getParent())){
740
                    result.includeResult(moveTaxonNode(node,targetNode, movingType));
741
                }
742
                monitor.worked(1);
743
            }else{
744
                monitor.done();
745
                result.setAbort();
746
                break;
739 747
            }
740
            monitor.worked(1);
741 748
        }
742
        dao.saveOrUpdateAll(nodes);
749
        if (!monitor.isCanceled()){
750
            dao.saveOrUpdateAll(nodes);
751
        }else{
752
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
753
        }
743 754

  
744 755
        monitor.done();
745 756
        return result;

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)