2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.model
.common
;
12 import javax
.persistence
.Entity
;
13 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
;
22 import org
.apache
.log4j
.Logger
;
23 import org
.hibernate
.annotations
.Cascade
;
24 import org
.hibernate
.annotations
.CascadeType
;
25 import org
.hibernate
.envers
.Audited
;
27 import eu
.etaxonomy
.cdm
.model
.agent
.AgentBase
;
34 @XmlAccessorType(XmlAccessType
.FIELD
)
35 @XmlType(name
= "Credit")
38 public class Credit
extends LanguageStringBase
implements Cloneable
{
39 private static final long serialVersionUID
= 5763391127298427701L;
40 @SuppressWarnings("unused")
41 private static final Logger logger
= Logger
.getLogger(Credit
.class);
43 // owner etc as defined by the rightstype
44 @XmlElement(name
= "Agent")
46 @XmlSchemaType(name
= "IDREF")
47 @ManyToOne(fetch
= FetchType
.LAZY
)
48 @Cascade({CascadeType
.SAVE_UPDATE
,CascadeType
.MERGE
})
49 private AgentBase
<?
> agent
;
51 @XmlElement(name
= "AbbreviatedText")
52 private String abbreviatedText
;
54 public static Credit
NewInstance(AgentBase agent
, String text
){
55 return NewInstance(agent
, text
, null, Language
.DEFAULT());
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
);
70 protected Credit(String text
, Language language
){
71 super(text
, language
);
79 public AgentBase
getAgent() {
86 * @param agent the agent to set
88 public void setAgent(AgentBase agent
) {
95 * @return the abbreviatedText
97 public String
getAbbreviatedText() {
98 return abbreviatedText
;
104 * @param abbreviatedText the abbreviatedText to set
106 public void setAbbreviatedText(String abbreviatedText
) {
107 this.abbreviatedText
= abbreviatedText
;
110 //************************* CLONE **************************/
113 * @see java.lang.Object#clone()
116 public Object
clone() throws CloneNotSupportedException
{
117 Credit result
= (Credit
)super.clone();
118 //no changes to: agent