Project

General

Profile

« Previous | Next » 

Revision 8fb964f0

Added by Andreas Müller over 4 years ago

ref #2826 cleanup

View differences:

cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/indexFungorum/IndexFungorumImportBase.java
13 13
import java.sql.ResultSetMetaData;
14 14
import java.sql.SQLException;
15 15
import java.util.HashMap;
16
import java.util.HashSet;
17 16
import java.util.Map;
18 17
import java.util.Set;
19 18
import java.util.UUID;
......
52 51
 * @author a.mueller
53 52
 * @since 27.02.2012
54 53
 */
55
public abstract class IndexFungorumImportBase extends CdmImportBase<IndexFungorumImportConfigurator, IndexFungorumImportState> implements ICdmIO<IndexFungorumImportState>, IPartitionedIO<IndexFungorumImportState> {
54
public abstract class IndexFungorumImportBase
55
        extends CdmImportBase<IndexFungorumImportConfigurator, IndexFungorumImportState>
56
        implements ICdmIO<IndexFungorumImportState>, IPartitionedIO<IndexFungorumImportState> {
56 57

  
57 58
    private static final long serialVersionUID = -729872543287390949L;
58 59
    private static final Logger logger = Logger.getLogger(IndexFungorumImportBase.class);
......
105 106

  
106 107
    @Override
107 108
    public boolean doPartition(@SuppressWarnings("rawtypes") ResultSetPartitioner partitioner, IndexFungorumImportState state) {
108

  
109
        boolean success = true ;
110
		Set<CdmBase> objectsToSave = new HashSet<>();
111

  
112
// 		DbImportMapping<?, ?> mapping = getMapping();
113
//		mapping.initialize(state, cdmTargetClass);
114

  
115
		ResultSet rs = partitioner.getResultSet();
116
		try{
117
			while (rs.next()){
118
//				success &= mapping.invoke(rs,objectsToSave);
119
			}
120
		} catch (SQLException e) {
121
			logger.error("SQLException:" +  e);
122
			return false;
123
		}
124

  
125
		partitioner.startDoSave();
126
		getCommonService().save(objectsToSave);
127
		return success;
109
        //should be overridden by subclasses if used
110
		return true;
128 111
	}
129 112

  
130 113
	protected abstract String getRecordQuery(IndexFungorumImportConfigurator config);
......
218 201

  
219 202
	/**
220 203
	 * Returns true if i is a multiple of recordsPerTransaction
221
	 * @param i
222
	 * @param recordsPerTransaction
223
	 * @return
224 204
	 */
225 205
	protected boolean loopNeedsHandling(int i, int recordsPerLoop) {
226 206
		startTransaction();
......
316 296
		}
317 297
		ref.setVolume(volume);
318 298

  
319
		//year   //TODO why yearOfPubl 2x exact same value
299
		//year
320 300
		String yearOfPubl = rs.getString("YEAR OF PUBLICATION");
321 301
		String yearOnPubl = rs.getString("YEAR ON PUBLICATION");
322 302
		String year = null;
......
330 310
			ref.setDatePublished(TimePeriodParser.parseStringVerbatim(year));
331 311
		}
332 312

  
333
		//preliminary, set protected titlecache as Generic Cache Generation with in references currently doesn't fully work yet
313
		//TODO preliminary, set protected titlecache as generic cache generation with in-references currently doesn't fully work yet
334 314
		String titleCache = CdmUtils.concat(", ", pubAuthorStr, title);
335
		if  ( StringUtils.isNotBlank(pubAuthorStr)){
315
		if  (isNotBlank(pubAuthorStr)){
336 316
			titleCache = "in " + titleCache;
337 317
		}
338 318
		titleCache = CdmUtils.concat(" ", titleCache, volume);

Also available in: Unified diff