Project

General

Profile

Revision aa2d500a

IDaa2d500aca7ba1f8b5f24e1a42cc3e23d3370246
Parent 463affc4
Child cb03e48f

Added by Katja Luther almost 7 years ago

#3596

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/TaxonNameBase.java
10 10
package eu.etaxonomy.cdm.model.name;
11 11

  
12 12
import java.lang.reflect.Method;
13
import java.util.ArrayList;
13 14
import java.util.HashSet;
14 15
import java.util.Iterator;
15 16
import java.util.List;
16 17
import java.util.Map;
17 18
import java.util.Set;
19
import java.util.concurrent.CopyOnWriteArrayList;
18 20

  
19 21
import javax.persistence.Column;
20 22
import javax.persistence.Entity;
......
1329 1331
        ReflectionUtils.invokeMethod(method, taxonBase, new Object[] {null});
1330 1332
        boolean removed = false;
1331 1333
        
1334
        
1335
        
1332 1336
        if (taxonBases.contains(taxonBase)){
1333 1337
        	 removed = taxonBases.remove(taxonBase);
1334 1338
        }
1335 1339
        if (!removed){
1336 1340
	       if (!removed && !taxonBases.isEmpty()){
1337
		       HashSet<TaxonBase> copyTaxonBase = new HashSet<TaxonBase>();
1338
		       Iterator<TaxonBase> iterator = taxonBases.iterator();
1339
		       while (iterator.hasNext()){
1340
		    	   TaxonBase taxonBaseTest = iterator.next();
1341
		    	   if (taxonBaseTest.equals(taxonBase)){
1342
		    		   removed = taxonBases.remove(taxonBaseTest);
1341
	    	   CopyOnWriteArrayList<TaxonBase> copyTaxonBase = new CopyOnWriteArrayList(taxonBases);
1342
		       for (TaxonBase temp:taxonBases){
1343
		    	   copyTaxonBase.add(temp);
1344
		       }
1345
		       for (TaxonBase temp:copyTaxonBase){
1346
		    	   
1347
		    	   if (temp.equals(taxonBase)){
1348
		    		   removed = copyTaxonBase.remove(temp);
1343 1349
		    	   }
1344 1350
		    	   
1345 1351
		    	   
1346 1352
		        }
1353
		       if (removed){
1354
		    	   taxonBases.clear();
1355
		    	   taxonBases.addAll(copyTaxonBase);
1356
		       }
1347 1357
	       }
1348 1358
        }
1349 1359
        
......
1352 1362
        
1353 1363
        
1354 1364
       
1365
   
1366
        
1367
       
1368
        
1369
        
1370
       
1355 1371
    }
1356 1372

  
1357 1373
    /**

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)