Project

General

Profile

« Previous | Next » 

Revision 52c34f45

Added by Andreas Müller almost 8 years ago

Remove bidirectionality for supplemental data #5743

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/IdentifiableEntity.java
244 244
        return cache;
245 245
    }
246 246

  
247

  
248
    @Override
249
    public boolean isProtectedTitleCache() {
250
        return protectedTitleCache;
251
    }
252

  
253
    @Override
254
    public void setProtectedTitleCache(boolean protectedTitleCache) {
255
        this.protectedTitleCache = protectedTitleCache;
256
    }
257

  
247 258
//**************************************************************************************
248 259

  
249 260
    @Override
......
332 343
     */
333 344
    public Set<String> getIdentifiers(UUID identifierTypeUuid){
334 345
        Set<String> result = new HashSet<String>();
335
        for (Identifier identifier : getIdentifiers()){
346
        for (Identifier<?> identifier : getIdentifiers()){
336 347
            if (identifier.getType().getUuid().equals(identifierTypeUuid)){
337 348
                result.add(identifier.getIdentifier());
338 349
            }
......
342 353

  
343 354
    @Override
344 355
    public Identifier addIdentifier(String identifier, DefinedTerm identifierType){
345
    	Identifier result = Identifier.NewInstance(this, identifier, identifierType);
356
    	Identifier<?> result = Identifier.NewInstance(identifier, identifierType);
357
    	addIdentifier(result);
346 358
    	return result;
347 359
    }
348 360

  
349 361
     @Override
350 362
    public void addIdentifier(int index, Identifier identifier){
351 363
        if (identifier != null){
352
        	if (identifier.getIdentifiedObj() != null && ! identifier.getIdentifiedObj().equals(this)){
353
        		identifier.getIdentifiedObj().removeIdentifier(identifier);
354
        	}
355
        	identifier.setIdentifiedObj(this);
356 364
        	//deduplication
357 365
        	int oldIndex = getIdentifiers().indexOf(identifier);
358 366
        	if(oldIndex > -1){
......
373 381
    @Override
374 382
    public void removeIdentifier(Identifier identifier){
375 383
        if (identifier != null){
376
        	identifier.setIdentifiedObj(null);
377 384
            getIdentifiers().remove(identifier);
378 385
        }
379 386
    }
......
423 430
    @Override
424 431
    public void addExtension(Extension extension){
425 432
        if (extension != null){
426
            extension.setExtendedObj(this);
427 433
            getExtensions().add(extension);
428 434
        }
429 435
    }
430 436
    @Override
431 437
    public void removeExtension(Extension extension){
432 438
        if (extension != null){
433
            extension.setExtendedObj(null);
434 439
            getExtensions().remove(extension);
435 440
        }
436 441
    }
437 442

  
438
    @Override
439
    public boolean isProtectedTitleCache() {
440
        return protectedTitleCache;
441
    }
442

  
443
    @Override
444
    public void setProtectedTitleCache(boolean protectedTitleCache) {
445
        this.protectedTitleCache = protectedTitleCache;
446
    }
447 443

  
448 444
    @Override
449 445
    public Set<IdentifiableSource> getSources() {
......
456 452
    @Override
457 453
    public void addSource(IdentifiableSource source) {
458 454
        if (source != null){
459
            IdentifiableEntity<?> oldSourcedObj = source.getSourcedObj();
460
            if (oldSourcedObj != null && oldSourcedObj != this){
461
                oldSourcedObj.getSources().remove(source);
462
            }
463 455
            getSources().add(source);
464
            source.setSourcedObj(this);
465 456
        }
466 457
    }
467 458

  
......
469 460
    public void addSources(Set<IdentifiableSource> sources) {
470 461
        if (sources != null){
471 462
        	for (IdentifiableSource source: sources){
472
	            IdentifiableEntity<?> oldSourcedObj = source.getSourcedObj();
473
	            if (oldSourcedObj != null && oldSourcedObj != this){
474
	                oldSourcedObj.getSources().remove(source);
475
	            }
476 463
	            getSources().add(source);
477
	            source.setSourcedObj(this);
478 464
        	}
479 465
        }
480 466
    }
......
513 499

  
514 500
//******************************** TO STRING *****************************************************/
515 501

  
516
    /* (non-Javadoc)
517
     * @see eu.etaxonomy.cdm.model.common.IIdentifiableEntity#toString()
518
     */
519
     @Override
502
    @Override
520 503
    public String toString() {
521 504
        String result;
522 505
        if (titleCache == null){

Also available in: Unified diff