Project

General

Profile

Revision 70709f18

ID70709f18a4aebab9c05989b26c5fc746cf7012ef
Parent 9aaa42dc
Child bf0b8a9d

Added by Patrick Plitzner about 1 year ago

ref #6794 Add termType check to DefinedTermBase and TermVocabulary

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/DefinedTermBase.java
239 239
      }
240 240

  
241 241
      public void addGeneralizationOf(T generalization) {
242
          checkTermType(generalization);
242 243
          generalization.setKindOf(this);
243 244
          this.generalizationOf.add(generalization);
244 245
      }
......
293 294
       * @see #getIncludes()
294 295
       */
295 296
      public void addIncludes(T includes) {
297
          checkTermType(includes);
296 298
          includes.setPartOf(this);
297 299
          this.includes.add(includes);
298 300
      }
......
471 473
        return this.vocabulary.findTermByUuid(uuid);
472 474
    }
473 475

  
476
    /**
477
     * Throws {@link IllegalArgumentException} if the given
478
     * term has not the same term type as this term or if term type is null.
479
     * @param term
480
     */
481
    private void checkTermType(IHasTermType term) {
482
        IHasTermType.checkTermTypes(term, this);
483
    }
484

  
474 485

  
475 486
//*********************** CLONE ********************************************************/
476 487

  
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/TermVocabulary.java
141 141
	}
142 142

  
143 143
	public void addTerm(T term) {
144
	    checkTermType(term);
144 145
		term.setVocabulary(this);
145 146
		this.terms.add(term);
146 147
	}
......
220 221
		return this;
221 222
	}
222 223

  
224
	/**
225
     * Throws {@link IllegalArgumentException} if the given
226
     * term has not the same term type as this term or if term type is null.
227
     * @param term
228
     */
229
    private void checkTermType(IHasTermType term) {
230
        IHasTermType.checkTermTypes(term, this);
231
    }
232

  
223 233
//*********************** CLONE ********************************************************/
224 234

  
225 235
	/**

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)