Project

General

Profile

Revision 30165a24

ID30165a24720670d6fa54138415538f81ff2e6b9d
Parent ac956ff7
Child 67432178

Added by Andreas Kohlbecker about 4 years ago

fix #6095 log duplicate registrations during import

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/app/iapt/IAPTActivator.java
44 44
    public static final String DATA_TYPE_LEG_100 = "iapt-type-leg-100.xls";
45 45
    public static final String DATA_NAME_TYPES = "iapt-name-types.xls";
46 46
    public static final String DATA_SINGLE = "single.xls";
47
    public static final String DATA_FILE = DATA_FILE_0_100;
47
    public static final String DATA_FILE = DATA_FILE_FULL;
48 48

  
49 49
    //database validation status (create, update, validate ...)
50 50
    static DbSchemaValidation hbm2dll = DbSchemaValidation.CREATE;
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

Add picture from clipboard (Maximum size: 40 MB)