Project

General

Profile

Download (3.16 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2019 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
package eu.etaxonomy.cdm.model.name;
10

    
11
import java.io.Serializable;
12

    
13
import javax.persistence.Column;
14
import javax.persistence.Embeddable;
15
import javax.validation.constraints.NotNull;
16
import javax.xml.bind.annotation.XmlAccessType;
17
import javax.xml.bind.annotation.XmlAccessorType;
18
import javax.xml.bind.annotation.XmlAttribute;
19
import javax.xml.bind.annotation.XmlElement;
20
import javax.xml.bind.annotation.XmlRootElement;
21
import javax.xml.bind.annotation.XmlType;
22

    
23
import org.apache.logging.log4j.LogManager;import org.apache.logging.log4j.Logger;
24
import org.hibernate.annotations.Type;
25
import org.hibernate.envers.Audited;
26

    
27
/**
28
 * @author a.mueller
29
 * @since 23.07.2019
30
 */
31
@XmlAccessorType(XmlAccessType.FIELD)
32
@XmlType(name = "RuleConsidered", propOrder = {
33
    "text",
34
    "codeEdition",
35
})
36
@XmlRootElement(name = "RuleConsidered")
37
@Embeddable
38
public class RuleConsidered implements Cloneable, Serializable{
39

    
40
    private static final long serialVersionUID = 531030660792800636L;
41
    private static final Logger logger = LogManager.getLogger(RuleConsidered.class);
42

    
43
    //The nomenclatural code rule considered. The article/note/recommendation in the code in question that is commented on in
44
    //the note property.
45
    @XmlElement(name = "text")
46
    @Column(name="ruleConsidered")
47
    private String text;
48

    
49
    /**
50
     * The {@link NomenclaturalCodeEdition code edition} for the rule considered.
51
     */
52
    @XmlAttribute(name ="CodeEdition")
53
    @Column(name="codeEdition", length=20)
54
    @NotNull
55
    @Type(type = "eu.etaxonomy.cdm.hibernate.EnumUserType",
56
        parameters = {@org.hibernate.annotations.Parameter(name = "enumClass", value = "eu.etaxonomy.cdm.model.name.NomenclaturalCodeEdition")}
57
    )
58
    @Audited //needed ?
59
    private NomenclaturalCodeEdition codeEdition;
60

    
61
  //******************** FACTORY METHODS ****************************
62

    
63
    /**
64
     * Factory method
65
     * @return
66
     */
67
    public static RuleConsidered NewInstance(){
68
        return new RuleConsidered();
69
    }
70

    
71
//********** GETTER / SETTER ***********************************/
72

    
73
    public String getText(){
74
        return this.text;
75
    }
76
    public void setText(String text){
77
        this.text = text;
78
    }
79

    
80
    public NomenclaturalCodeEdition getCodeEdition() {
81
        return codeEdition;
82
    }
83
    public void setCodeEdition(NomenclaturalCodeEdition codeEdition) {
84
        this.codeEdition = codeEdition;
85
    }
86

    
87
  //*********** CLONE **********************************/
88

    
89
    /**
90
     * Clones <i>this</i> rule considered.
91
     *
92
     * @see java.lang.Object#clone()
93
     */
94
    @Override
95
    public RuleConsidered clone(){
96
        try{
97
            RuleConsidered result = (RuleConsidered)super.clone();
98
            //no changes to: ruleConsidered, codeEdition
99
            return result;
100
        } catch (CloneNotSupportedException e) {
101
            logger.warn("Object does not implement cloneable");
102
            e.printStackTrace();
103
            return null;
104
        }
105
    }
106
}
(30-30/39)