Project

General

Profile

« Previous | Next » 

Revision 0880a77c

Added by Marc Geoffroy almost 16 years ago

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/taxon/Taxon.java
14 14
import eu.etaxonomy.cdm.model.common.RelationshipBase;
15 15
import eu.etaxonomy.cdm.model.description.TaxonDescription;
16 16
import eu.etaxonomy.cdm.model.name.HomotypicalGroup;
17
import eu.etaxonomy.cdm.model.name.NameRelationship;
18
import eu.etaxonomy.cdm.model.name.NameRelationshipType;
17 19
import eu.etaxonomy.cdm.model.name.NameTypeDesignation;
18 20
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
19 21
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
......
139 141
	 * Returns the set of {@link description.TaxonDescription taxon descriptions}
140 142
	 * concerning this taxon.
141 143
	 * 
142
	 * @see description.TaxonDescription#getTaxon()
143 144
	 * @see #removeDescription(TaxonDescription)
144 145
	 * @see #addDescription(TaxonDescription)
146
	 * @see description.TaxonDescription#getTaxon()
145 147
	 */
146 148
	@OneToMany(mappedBy="taxon", fetch= FetchType.LAZY) 
147 149
	@Cascade({CascadeType.SAVE_UPDATE})
......
157 159
	/** 
158 160
	 * Adds a new {@link description.TaxonDescription taxon description} to the set
159 161
	 * of taxon descriptions assigned to this (accepted/correct) taxon.
160
	 * The {@link description.TaxonDescription#getTaxon() taxon} of the taxon description
161
	 * will be filled with this taxon. The taxon description must be removed
162
	 * from the set of taxon descriptions assigned to the previous taxon. 
162
	 * Due to bidirectionality the content of the {@link description.TaxonDescription#getTaxon() taxon attribute} of the
163
	 * taxon description itself will be replaced with this taxon. The taxon
164
	 * description will also be removed from the set of taxon descriptions
165
	 * assigned to its previous taxon. 
163 166
	 *
164 167
	 * @param  description	the taxon description to be added for this taxon
165 168
	 * @see     		  	#getDescriptions()
......
177 180
		
178 181
	}
179 182
	/** 
180
	 * Removes one element from the set of {@link description.TaxonDescription taxon descriptions} assigned to the
181
	 * to this taxon. The The {@link description.TaxonDescription#getTaxon() taxon} in the description itself will be nullified.
183
	 * Removes one element from the set of {@link description.TaxonDescription taxon descriptions} assigned
184
	 * to this (accepted/correct) taxon. Due to bidirectionality the content of
185
	 * the {@link description.TaxonDescription#getTaxon() taxon attribute} of the taxon description
186
	 * itself will be set to "null".
182 187
	 *
183
	 * @param  description  the taxon description which should be deleted
188
	 * @param  description  the taxon description which should be removed
184 189
	 * @see     		  	#getDescriptions()
185 190
	 * @see     		  	#addDescription(TaxonDescription)
191
	 * @see 			  	description.TaxonDescription#getTaxon()
186 192
	 */
187 193
	public void removeDescription(TaxonDescription description) {
188 194
		initMethods();
......
204 210
	}
205 211

  
206 212

  
213
	/** 
214
	 * Returns the set of all {@link SynonymRelationship synonym relationships}
215
	 * in which this ("accepted/correct") taxon is involved. This taxon can only
216
	 * be the target of these synonym relationships.
217
	 *  
218
	 * @see    #addSynonymRelation(SynonymRelationship)
219
	 * @see    #removeSynonymRelation(SynonymRelationship)
220
	 * @see    #getSynonyms()
221
	 */
207 222
	@OneToMany(mappedBy="relatedTo", fetch=FetchType.LAZY)
208 223
	@Cascade({CascadeType.SAVE_UPDATE})
209 224
	public Set<SynonymRelationship> getSynonymRelations() {
210 225
		return synonymRelations;
211 226
	}
227
	/** 
228
	 * @see    #getSynonymRelations()
229
	 * @see    #addSynonymRelation(SynonymRelationship)
230
	 */
212 231
	protected void setSynonymRelations(Set<SynonymRelationship> synonymRelations) {
213 232
		this.synonymRelations = synonymRelations;
214 233
	}
234
	/**
235
	 * Adds an existing {@link SynonymRelationship synonym relationship} to the set of
236
	 * {@link #getSynonymRelations() synonym relationships} assigned to this taxon. If the
237
	 * the target of the synonym relationship does not match with this taxon
238
	 * no addition will be carried out.
239
	 * 
240
	 * @param synonymRelation	the synonym relationship to be added to this taxon's
241
	 * 							synonym relationships set
242
	 * @see    	   				#getSynonymRelations()
243
	 * @see    	   				#addSynonym(Synonym, SynonymRelationshipType)
244
	 * @see    	   				#addSynonym(Synonym, SynonymRelationshipType, ReferenceBase, String)
245
	 * @see    	   				#addSynonymName(TaxonNameBase, SynonymRelationshipType)
246
	 * @see    	   				#addSynonymName(TaxonNameBase, SynonymRelationshipType, ReferenceBase, String)
247
	 */
215 248
	protected void addSynonymRelation(SynonymRelationship synonymRelation) {
216 249
		this.synonymRelations.add(synonymRelation);
217 250
	}
251
	/** 
252
	 * Removes one element from the set of {@link SynonymRelationship synonym relationships} assigned
253
	 * to this (accepted/correct) taxon. Due to bidirectionality the given
254
	 * synonym relationship will also be removed from the set of synonym
255
	 * relationships assigned to the {@link Synonym#getSynonymRelations() synonym} involved in the
256
	 * relationship. Furthermore the content of
257
	 * the {@link SynonymRelationship#getAcceptedTaxon() accepted taxon attribute} and of the
258
	 * {@link SynonymRelationship#getSynonym() synonym attribute} within the synonym relationship
259
	 * itself will be set to "null".
260
	 *
261
	 * @param  synonymRelation  the synonym relationship which should be deleted
262
	 * @see     		  		#getSynonymRelations()
263
	 * @see     		  		#addSynonymRelation(SynonymRelationship)
264
	 * @see 			  		#removeSynonym(Synonym)
265
	 */
218 266
	public void removeSynonymRelation(SynonymRelationship synonymRelation) {
219 267
		synonymRelation.setAcceptedTaxon(null);
220 268
		Synonym synonym = synonymRelation.getSynonym();
......
226 274
	}
227 275

  
228 276
	
277
	/** 
278
	 * Returns the set of all {@link TaxonRelationship taxon relationships}
279
	 * between two taxa in which this taxon is involved as a source.
280
	 *  
281
	 * @see    #getRelationsToThisTaxon()
282
	 * @see    #getTaxonRelations()
283
	 */
229 284
	@OneToMany(mappedBy="relatedFrom", fetch=FetchType.LAZY)
230 285
	@Cascade({CascadeType.SAVE_UPDATE, CascadeType.DELETE_ORPHAN})
231 286
	public Set<TaxonRelationship> getRelationsFromThisTaxon() {
232 287
		return relationsFromThisTaxon;
233 288
	}
289
	/** 
290
	 * @see    #getRelationsFromThisTaxon()
291
	 */
234 292
	protected void setRelationsFromThisTaxon(
235 293
			Set<TaxonRelationship> relationsFromThisTaxon) {
236 294
		this.relationsFromThisTaxon = relationsFromThisTaxon;
237 295
	}
238 296

  
239 297

  
298
	/** 
299
	 * Returns the set of all {@link TaxonRelationship taxon relationships}
300
	 * between two taxa in which this taxon is involved as a target.
301
	 *  
302
	 * @see    #getRelationsFromThisTaxon()
303
	 * @see    #getTaxonRelations()
304
	 */
240 305
	@OneToMany(mappedBy="relatedTo", fetch=FetchType.LAZY)
241 306
	@Cascade({CascadeType.SAVE_UPDATE, CascadeType.DELETE_ORPHAN})
242 307
	public Set<TaxonRelationship> getRelationsToThisTaxon() {
243 308
		return relationsToThisTaxon;
244 309
	}
310
	/** 
311
	 * @see    #getRelationsToThisTaxon()
312
	 */
245 313
	protected void setRelationsToThisTaxon(Set<TaxonRelationship> relationsToThisTaxon) {
246 314
		this.relationsToThisTaxon = relationsToThisTaxon;
247 315
	}
......
255 323
		this.taxonomicParentCache = taxonomicParent;
256 324
	}
257 325

  
326
	/** 
327
	 * Returns the set of all {@link TaxonRelationship taxon relationships}
328
	 * between two taxa in which this taxon is involved either as a source or
329
	 * as a target.
330
	 *  
331
	 * @see    #getRelationsFromThisTaxon()
332
	 * @see    #getRelationsToThisTaxon()
333
	 */
258 334
	@Transient
259 335
	public Set<TaxonRelationship> getTaxonRelations() {
260 336
		Set<TaxonRelationship> rels = new HashSet<TaxonRelationship>();
......
262 338
		rels.addAll(getRelationsFromThisTaxon());
263 339
		return rels;
264 340
	}
341
	/** 
342
	 * Removes one {@link TaxonRelationship taxon relationship} from one of both sets of
343
	 * {@link #getTaxonRelations() taxon relationships} in which this taxon is involved
344
	 * either as a {@link #getRelationsFromThisTaxon() source} or as a {@link #getRelationsToThisTaxon() target}.
345
	 * The taxon relationship will also be removed from one of both sets
346
	 * belonging to the second taxon involved. Furthermore the inherited RelatedFrom and
347
	 * RelatedTo attributes of the given taxon relationship will be nullified.
348
	 * If the taxon relationship concerns the taxonomical tree possible
349
	 * modifications of the {@link #getTaxonomicParent() parent} or of the number of
350
	 * {@link #getTaxonomicChildrenCount() childrens} will be stored.
351
	 *
352
	 * @param  rel  the taxon relationship which should be removed from one
353
	 * 				of both sets
354
	 * @see    		#getTaxonRelations()
355
	 * @see    	    #getTaxonomicParent()
356
	 * @see    	    #getTaxonomicChildrenCount()
357
	 * @see    		common.RelationshipBase#getRelatedFrom()
358
	 * @see    		common.RelationshipBase#getRelatedTo()
359
	 * 
360
	 */
265 361
	public void removeTaxonRelation(TaxonRelationship rel) {
266 362
		logger.warn("remove TaxonRelation");  //for testing only 
267 363
		this.relationsToThisTaxon.remove(rel);
......
287 383
		}
288 384
	}
289 385

  
386
	/**
387
	 * Adds an existing {@link TaxonRelationship taxon relationship} either to the set of
388
	 * {@link #getRelationsToThisTaxon() taxon relationships to this taxon} or to the set of
389
	 * {@link #getRelationsFromThisTaxon() taxon relationships from this taxon}. If neither the
390
	 * source nor the target of the taxon relationship match with this taxon
391
	 * no addition will be carried out. The taxon relationship will also be
392
	 * added to the second taxon involved in the given relationship.
393
	 * If the taxon relationship concerns the taxonomical tree possible
394
	 * modifications of the {@link #getTaxonomicParent() parent} or of the number of
395
	 * {@link #getTaxonomicChildrenCount() childrens} will be stored.
396
	 * 
397
	 * @param rel  the taxon relationship to be added to one of this taxon's taxon relationships sets
398
	 * @see    	   #addTaxonRelation(Taxon, TaxonRelationshipType, ReferenceBase, String)
399
	 * @see    	   #getTaxonRelations()
400
	 * @see    	   #getRelationsFromThisTaxon()
401
	 * @see    	   #getRelationsToThisTaxon()
402
	 * @see    	   #getTaxonomicParent()
403
	 * @see    	   #getTaxonomicChildrenCount()
404
	 */
290 405
	public void addTaxonRelation(TaxonRelationship rel) {
291 406
		if (rel!=null && rel.getType()!=null && !getTaxonRelations().contains(rel) ){
292 407
			Taxon toTaxon=rel.getToTaxon();
......
331 446
		}
332 447
	}
333 448
	
449
	/**
450
	 * Creates a new {@link TaxonRelationship taxon relationship} instance where this taxon
451
	 * plays the source role and adds it to the set of
452
	 * {@link #getRelationsFromThisTaxon() taxon relationships from this taxon}. The taxon relationship
453
	 * will also be added to the set of taxon relationships to the second taxon
454
	 * involved in the created relationship. If the taxon relationship concerns
455
	 * the taxonomical tree possible modifications of the {@link #getTaxonomicParent() parent}
456
	 * or of the number of {@link #getTaxonomicChildrenCount() childrens} will be stored.
457
	 * 
458
	 * @param toTaxon		the taxon which plays the target role in the new taxon relationship
459
	 * @param type			the taxon relationship type for the new taxon relationship
460
	 * @param citation		the reference source for the new taxon relationship
461
	 * @param microcitation	the string with the details describing the exact localisation within the reference
462
	 * @see    	   			#addTaxonRelation(TaxonRelationship)
463
	 * @see    	   			#getTaxonRelations()
464
	 * @see    	   			#getRelationsFromThisTaxon()
465
	 * @see    	   			#getRelationsToThisTaxon()
466
	 * @see    	   			#getTaxonomicParent()
467
	 * @see    	   			#getTaxonomicChildrenCount()
468
	 */
334 469
	public void addTaxonRelation(Taxon toTaxon, TaxonRelationshipType type, ReferenceBase citation, String microcitation) {
335 470
		TaxonRelationship rel = new TaxonRelationship(this, toTaxon, type, citation, microcitation);
336 471
	}
472
	/**
473
	 * Creates a new {@link TaxonRelationship taxon relationship} (with {@link TaxonRelationshipType taxon relationship type}
474
	 * "misapplied name for") instance where this taxon plays the target role
475
	 * and adds it to the set of {@link #getRelationsToThisTaxon() taxon relationships to this taxon}.
476
	 * The taxon relationship will also be added to the set of taxon
477
	 * relationships to the other (misapplied name) taxon involved in the created relationship.
478
	 * 
479
	 * @param misappliedNameTaxon	the taxon which plays the target role in the new taxon relationship
480
	 * @param citation				the reference source for the new taxon relationship
481
	 * @param microcitation			the string with the details describing the exact localisation within the reference
482
	 * @see    	   					#addTaxonRelation(Taxon, TaxonRelationshipType, ReferenceBase, String)
483
	 * @see    	   					#addTaxonRelation(TaxonRelationship)
484
	 * @see    	   					#getTaxonRelations()
485
	 * @see    	   					#getRelationsFromThisTaxon()
486
	 * @see    	   					#getRelationsToThisTaxon()
487
	 */
337 488
	public void addMisappliedName(Taxon misappliedNameTaxon, ReferenceBase citation, String microcitation) {
338 489
		misappliedNameTaxon.addTaxonRelation(this, TaxonRelationshipType.MISAPPLIEDNAMEFOR(), citation, microcitation);
339 490
	}
......
421 572
	}
422 573

  
423 574
	/**
424
	 * @see getHasTaxonomicChildren() 
575
	 * @see #getTaxonomicChildren() 
425 576
	 *	@return
426 577
	 */
427 578
	@Transient

Also available in: Unified diff