Project

General

Profile

« Previous | Next » 

Revision bff8d9fe

Added by Andreas Müller over 5 years ago

ref #1444 cleanup erms import code

View differences:

cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/erms/ErmsImportBase.java
20 20
import java.util.Set;
21 21
import java.util.UUID;
22 22

  
23
import org.apache.commons.lang3.StringUtils;
23 24
import org.apache.log4j.Logger;
24 25
import org.joda.time.DateTime;
25 26

  
......
71 72
	protected static final String FEATURE_NAMESPACE = "note.type";
72 73
	protected static final String EXTENSION_TYPE_NAMESPACE = "ExtensionType";
73 74

  
74

  
75

  
76 75
	private String pluralString;
77 76
	private String dbTableName;
78 77
	//TODO needed?
79 78
	private Class cdmTargetClass;
80 79

  
81

  
82

  
83 80
	/**
84 81
	 * @param dbTableName
85 82
	 * @param dbTableName2
......
103 100
		recordsPerTransaction = recordsPerTransaction / divideCountBy();
104 101

  
105 102
		try{
106
			ResultSetPartitioner partitioner = ResultSetPartitioner.NewInstance(source, strIdQuery, strRecordQuery, recordsPerTransaction);
103
			ResultSetPartitioner<ErmsImportState> partitioner = ResultSetPartitioner.NewInstance(source, strIdQuery, strRecordQuery, recordsPerTransaction);
107 104
			while (partitioner.nextPartition()){
108 105
				partitioner.doPartition(this, state);
109 106
			}
......
120 117
	@Override
121 118
    public boolean doPartition(ResultSetPartitioner partitioner, ErmsImportState state) {
122 119
		boolean success = true ;
123
		Set<CdmBase> objectsToSave = new HashSet<CdmBase>();
120
		Set<CdmBase> objectsToSave = new HashSet<>();
124 121

  
125 122
 		DbImportMapping<?, ?> mapping = getMapping();
126 123
		mapping.initialize(state, cdmTargetClass);
......
160 157
		return result;
161 158
	}
162 159

  
163
	/* (non-Javadoc)
164
	 * @see eu.etaxonomy.cdm.io.berlinModel.in.IPartitionedIO#getPluralString()
165
	 */
166 160
	@Override
167 161
    public String getPluralString(){
168 162
		return pluralString;
......
185 179
		return success;
186 180
	}
187 181

  
188

  
189 182
	protected boolean doCreatedUpdatedNotes(ErmsImportState state, AnnotatableEntity annotatableEntity, ResultSet rs, String namespace)
190 183
			throws SQLException{
191 184

  
......
231 224

  
232 225

  
233 226
		//notes
234
		if (CdmUtils.isNotEmpty(notes)){
227
		if (StringUtils.isNotBlank(notes)){
235 228
			String notesString = String.valueOf(notes);
236 229
			if (notesString.length() > 65530 ){
237 230
				notesString = notesString.substring(0, 65530) + "...";
......
246 239
	}
247 240

  
248 241
	private User getUser(String userString, ErmsImportState state){
249
		if (CdmUtils.isEmpty(userString)){
242
		if (StringUtils.isBlank(userString)){
250 243
			return null;
251 244
		}
252 245
		userString = userString.trim();
......
351 344
	 */
352 345
	protected Map<String, Object> getValueMap(ResultSet rs) throws SQLException{
353 346
		try{
354
			Map<String, Object> valueMap = new HashMap<String, Object>();
347
			Map<String, Object> valueMap = new HashMap<>();
355 348
			int colCount = rs.getMetaData().getColumnCount();
356 349
			for (int c = 0; c < colCount ; c++){
357 350
				Object value = rs.getObject(c+1);

Also available in: Unified diff