Project

General

Profile

Download (2.42 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 EDIT
3
* European Distributed Institute of Taxonomy 
4
* http://www.e-taxonomy.eu
5
* 
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

    
10
package eu.etaxonomy.cdm.model.name;
11

    
12

    
13
import eu.etaxonomy.cdm.model.common.ReferencedEntityBase;
14
import eu.etaxonomy.cdm.model.reference.ReferenceBase;
15

    
16
import org.apache.log4j.Logger;
17
import org.hibernate.annotations.Cascade;
18
import org.hibernate.annotations.CascadeType;
19

    
20
import java.util.*;
21
import javax.persistence.*;
22

    
23
/**
24
 * {only for typified names which have a rank above "species", in this case the
25
 * type has to be a "species" name}
26
 * @author m.doering
27
 * @version 1.0
28
 * @created 08-Nov-2007 13:06:38
29
 */
30
@Entity
31
public class NameTypeDesignation extends ReferencedEntityBase {
32
	static Logger logger = Logger.getLogger(NameTypeDesignation.class);
33
	private boolean isRejectedType;
34
	private boolean isConservedType;
35
	private TaxonNameBase typeSpecies;
36
	private TaxonNameBase typifiedName;
37

    
38
	protected NameTypeDesignation(TaxonNameBase typifiedName, TaxonNameBase typeSpecies, ReferenceBase citation, String citationMicroReference,
39
			String originalNameString, boolean isRejectedType, boolean isConservedType) {
40
		super(citation, citationMicroReference, originalNameString);
41
		this.setTypeSpecies(typeSpecies);
42
		this.setTypifiedName(typifiedName);
43
		// the typified name has to be part of the same homotypical group as the type species
44
		typifiedName.setHomotypicalGroup(typeSpecies.getHomotypicalGroup());
45
		this.isRejectedType = isRejectedType;
46
		this.isConservedType = isConservedType;
47
	}
48
	
49
	
50
	@Cascade({CascadeType.SAVE_UPDATE})
51
	public TaxonNameBase getTypifiedName() {
52
		return typifiedName;
53
	}
54
	private void setTypifiedName(TaxonNameBase typifiedName) {
55
		this.typifiedName = typifiedName;
56
		typifiedName.nameTypeDesignations.add(this);
57
		}
58

    
59

    
60
	@ManyToOne
61
	@Cascade({CascadeType.SAVE_UPDATE})
62
	public TaxonNameBase getTypeSpecies(){
63
		return this.typeSpecies;
64
	}
65
	private void setTypeSpecies(TaxonNameBase typeSpecies){
66
		this.typeSpecies = typeSpecies;
67
	}
68

    
69
	public boolean isRejectedType(){
70
		return this.isRejectedType;
71
	}
72
	public void setRejectedType(boolean isRejectedType){
73
		this.isRejectedType = isRejectedType;
74
	}
75

    
76
	public boolean isConservedType(){
77
		return this.isConservedType;
78
	}
79
	public void setConservedType(boolean isConservedType){
80
		this.isConservedType = isConservedType;
81
	}
82

    
83
}
(9-9/20)