1 |
affa9b33
|
Andreas Müller
|
/**
|
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.common;
|
11 |
|
|
|
12 |
|
|
import javax.persistence.Entity;
|
13 |
db45aff9
|
Andreas Müller
|
import javax.persistence.FetchType;
|
14 |
|
|
import javax.persistence.ManyToOne;
|
15 |
|
|
import javax.xml.bind.annotation.XmlAccessType;
|
16 |
|
|
import javax.xml.bind.annotation.XmlAccessorType;
|
17 |
|
|
import javax.xml.bind.annotation.XmlElement;
|
18 |
|
|
import javax.xml.bind.annotation.XmlIDREF;
|
19 |
|
|
import javax.xml.bind.annotation.XmlSchemaType;
|
20 |
|
|
import javax.xml.bind.annotation.XmlType;
|
21 |
affa9b33
|
Andreas Müller
|
|
22 |
|
|
import org.apache.log4j.Logger;
|
23 |
db45aff9
|
Andreas Müller
|
import org.hibernate.annotations.Cascade;
|
24 |
|
|
import org.hibernate.annotations.CascadeType;
|
25 |
|
|
import org.hibernate.envers.Audited;
|
26 |
|
|
|
27 |
|
|
import eu.etaxonomy.cdm.model.agent.AgentBase;
|
28 |
affa9b33
|
Andreas Müller
|
|
29 |
|
|
/**
|
30 |
|
|
* @author a.mueller
|
31 |
|
|
* @created 23.03.2009
|
32 |
|
|
* @version 1.0
|
33 |
|
|
*/
|
34 |
db45aff9
|
Andreas Müller
|
@XmlAccessorType(XmlAccessType.FIELD)
|
35 |
|
|
@XmlType(name = "Credit")
|
36 |
affa9b33
|
Andreas Müller
|
@Entity
|
37 |
db45aff9
|
Andreas Müller
|
@Audited
|
38 |
7fb97e85
|
Andreas Müller
|
public class Credit extends LanguageStringBase implements Cloneable{
|
39 |
db45aff9
|
Andreas Müller
|
private static final long serialVersionUID = 5763391127298427701L;
|
40 |
|
|
@SuppressWarnings("unused")
|
41 |
affa9b33
|
Andreas Müller
|
private static final Logger logger = Logger.getLogger(Credit.class);
|
42 |
db45aff9
|
Andreas Müller
|
|
43 |
|
|
// owner etc as defined by the rightstype
|
44 |
|
|
@XmlElement(name = "Agent")
|
45 |
|
|
@XmlIDREF
|
46 |
|
|
@XmlSchemaType(name = "IDREF")
|
47 |
|
|
@ManyToOne(fetch = FetchType.LAZY)
|
48 |
|
|
@Cascade(CascadeType.SAVE_UPDATE)
|
49 |
96e14e86
|
Andreas Müller
|
private AgentBase<?> agent;
|
50 |
db45aff9
|
Andreas Müller
|
|
51 |
|
|
@XmlElement(name = "AbbreviatedText")
|
52 |
|
|
private String abbreviatedText;
|
53 |
|
|
|
54 |
|
|
public static Credit NewInstance(AgentBase agent, String text){
|
55 |
|
|
return NewInstance(agent, text, null, Language.DEFAULT());
|
56 |
|
|
}
|
57 |
|
|
|
58 |
|
|
public static Credit NewInstance(AgentBase agent, String text, String abbreviatedText, Language language){
|
59 |
|
|
Credit result = new Credit(text, language);
|
60 |
|
|
result.setAgent(agent);
|
61 |
|
|
result.setAbbreviatedText(abbreviatedText);
|
62 |
|
|
return result;
|
63 |
|
|
}
|
64 |
|
|
|
65 |
|
|
|
66 |
|
|
protected Credit(){
|
67 |
|
|
super();
|
68 |
|
|
}
|
69 |
|
|
|
70 |
|
|
protected Credit(String text, Language language){
|
71 |
|
|
super(text, language);
|
72 |
|
|
}
|
73 |
|
|
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
/**
|
77 |
|
|
* @return the agent
|
78 |
|
|
*/
|
79 |
|
|
public AgentBase getAgent() {
|
80 |
|
|
return agent;
|
81 |
|
|
}
|
82 |
|
|
|
83 |
|
|
|
84 |
|
|
|
85 |
|
|
/**
|
86 |
|
|
* @param agent the agent to set
|
87 |
|
|
*/
|
88 |
|
|
public void setAgent(AgentBase agent) {
|
89 |
|
|
this.agent = agent;
|
90 |
|
|
}
|
91 |
|
|
|
92 |
|
|
|
93 |
|
|
|
94 |
|
|
/**
|
95 |
|
|
* @return the abbreviatedText
|
96 |
|
|
*/
|
97 |
|
|
public String getAbbreviatedText() {
|
98 |
|
|
return abbreviatedText;
|
99 |
|
|
}
|
100 |
|
|
|
101 |
|
|
|
102 |
|
|
|
103 |
|
|
/**
|
104 |
|
|
* @param abbreviatedText the abbreviatedText to set
|
105 |
|
|
*/
|
106 |
|
|
public void setAbbreviatedText(String abbreviatedText) {
|
107 |
|
|
this.abbreviatedText = abbreviatedText;
|
108 |
|
|
}
|
109 |
7fb97e85
|
Andreas Müller
|
|
110 |
|
|
//************************* CLONE **************************/
|
111 |
db45aff9
|
Andreas Müller
|
|
112 |
7fb97e85
|
Andreas Müller
|
/* (non-Javadoc)
|
113 |
|
|
* @see java.lang.Object#clone()
|
114 |
|
|
*/
|
115 |
|
|
@Override
|
116 |
|
|
public Object clone() throws CloneNotSupportedException{
|
117 |
|
|
Credit result = (Credit)super.clone();
|
118 |
|
|
//no changes to: agent
|
119 |
|
|
return result;
|
120 |
|
|
}
|
121 |
|
|
|
122 |
db45aff9
|
Andreas Müller
|
|
123 |
affa9b33
|
Andreas Müller
|
}
|