Project

General

Profile

« Previous | Next » 

Revision 30165a24

Added by Andreas Kohlbecker over 7 years ago

fix #6095 log duplicate registrations during import

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/io/iapt/IAPTExcelImport.java
151 151
    DateTimeFormatter formatterYear = DateTimeFormat.forPattern("yyyy");
152 152

  
153 153
    private Map<String, Collection> collectionMap = new HashMap<>();
154

  
154 155
    private ExtensionType extensionTypeIAPTRegData = null;
155 156

  
157
    private Set<String> nameSet = new HashSet<>();
158
    private DefinedTermBase duplicateRegistration = null;
156 159

  
157 160
    enum TypesName {
158 161
        fieldUnit, holotype, isotype;
......
339 342
        if(isFossil){
340 343
            taxon.addMarker(Marker.NewInstance(markerTypeFossil(), true));
341 344
        }
345
        if(!nameSet.add(titleCacheStr)){
346
            taxonName.addMarker(Marker.NewInstance(markerDuplicateRegistration(), true));
347
            logger.warn(csvReportLine(regNumber, "Duplicate registration of", titleCacheStr));
348
        }
349

  
342 350

  
343 351
        // Types
344 352
        if(!StringUtils.isEmpty(typeStr)){
......
1290 1298
        return markerTypeFossil;
1291 1299
    }
1292 1300

  
1301
    private MarkerType markerDuplicateRegistration(){
1302
        if(this.duplicateRegistration == null){
1303
            duplicateRegistration = MarkerType.NewInstance("duplicateRegistration", "duplicateRegistration", null);
1304
            getTermService().save(this.duplicateRegistration);
1305
        }
1306
        return markerTypeFossil;
1307
    }
1308

  
1293 1309
    private String csvReportLine(String regId, String message, String ... fields){
1294 1310
        StringBuilder out = new StringBuilder("regID#");
1295 1311
        out.append(regId).append(",\"").append(message).append('"');

Also available in: Unified diff