Project

General

Profile

« Previous | Next » 

Revision 19c7c9f3

Added by Andreas Kohlbecker over 7 years ago

Revert "fix #6037 per batch transction commit implemented for excel imports"

This reverts commit 53067226137bd8528e6bc26f21edbf98aebe26a9.

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/excel/common/ExcelImportConfiguratorBase.java
1 1
/**
2 2
 * Copyright (C) 2007 EDIT
3
 * European Distributed Institute of Taxonomy
3
 * European Distributed Institute of Taxonomy 
4 4
 * http://www.e-taxonomy.eu
5
 *
5
 * 
6 6
 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
 * See LICENSE.TXT at the top of this package for the full license terms.
8 8
 */
......
23 23

  
24 24
public abstract class ExcelImportConfiguratorBase extends ImportConfiguratorBase<ExcelImportState, URI> implements IImportConfigurator{
25 25
	private static final Logger logger = Logger.getLogger(ExcelImportConfiguratorBase.class);
26

  
26
	
27 27
	//TODO
28 28
	private static IInputTransformer defaultTransformer = null;
29 29

  
30
	private int batchSize = 0;
31

  
32 30

  
33 31
	/**
34 32
	 * @param url
......
37 35
	protected ExcelImportConfiguratorBase(URI uri, ICdmDataSource destination) {
38 36
		this(uri, destination, defaultTransformer);
39 37
	}
40

  
38
	
41 39
	/**
42 40
	 * @param url
43 41
	 * @param destination
......
66 64
		return false;
67 65
	}
68 66

  
69
	public int getBatchSize() {
70
	    return batchSize;
71
	}
72

  
73
	public void setBatchSize(int batchSize) {
74
	    this.batchSize = batchSize;
75
	}
76

  
77

  
78 67

  
68
	
79 69
}
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/excel/common/ExcelImporterBase.java
110 110
				}finally{
111 111
					state.incCurrentLine();
112 112
				}
113
    			txStatus = perBatchCommit(state, txStatus, i);
114 113
    		}
115 114
    		//second pass
116 115
    		state.setCurrentLine(startingLine);
......
120 119
    			state.setOriginalRecord(record);
121 120
                secondPass(state);
122 121
    			state.incCurrentLine();
123
    			txStatus = perBatchCommit(state, txStatus, i);
124 122
    	   	}
125 123

  
126 124
    		commitTransaction(txStatus);
......
130 128
		return;
131 129
	}
132 130

  
133
    /**
134
     * @param state
135
     * @param txStatus
136
     * @param i
137
     * @return
138
     */
139
    protected TransactionStatus perBatchCommit(STATE state, TransactionStatus txStatus, int i) {
140
        if(state.getConfig().getBatchSize() > 0 &&  (i % state.getConfig().getBatchSize() == 0)) {
141
            commitTransaction(txStatus);
142
            txStatus = startTransaction();
143
        }
144
        return txStatus;
145
    }
146

  
147 131
	/**
148 132
	 * To define a worksheet name override this method. Otherwise the first worksheet is taken.
149 133
	 * @return worksheet name. <code>null</null> if not worksheet is defined.

Also available in: Unified diff