Project

General

Profile

« Previous | Next » 

Revision 99e92829

Added by Andreas Müller about 7 years ago

ref #6286 FloraHellenica import transactional

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/io/greece/FloraHellenicaExcludedTaxonImport.java
15 15

  
16 16
import org.apache.log4j.Logger;
17 17
import org.springframework.stereotype.Component;
18
import org.springframework.transaction.TransactionStatus;
18 19

  
19 20
import eu.etaxonomy.cdm.io.mexico.SimpleExcelTaxonImportState;
20 21
import eu.etaxonomy.cdm.model.name.BotanicalName;
......
60 61
        return "excluded taxa";
61 62
    }
62 63

  
64
    private boolean isFirst = true;
65
    private TransactionStatus tx = null;
63 66
    /**
64 67
     * {@inheritDoc}
65 68
     */
66 69
    @Override
67 70
    protected void firstPass(SimpleExcelTaxonImportState<CONFIG> state) {
71
        if (isFirst){
72
            tx = this.startTransaction();
73
            isFirst = false;
74
        }
68 75

  
69 76
        String line = state.getCurrentLine() + ": ";
70 77
        HashMap<String, String> record = state.getOriginalRecord();
......
83 90
        }
84 91
    }
85 92

  
93
    @Override
94
    protected void secondPass(SimpleExcelTaxonImportState<CONFIG> state) {
95
        if (tx != null){
96
            this.commitTransaction(tx);
97
            tx = null;
98
        }
99
    }
100

  
86 101

  
87 102
    /**
88 103
     * @param state

Also available in: Unified diff