package eu.etaxonomy.cdm.model.common;\r
\r
import javax.persistence.Entity;\r
+import javax.persistence.FetchType;\r
+import javax.persistence.ManyToOne;\r
+import javax.xml.bind.annotation.XmlAccessType;\r
+import javax.xml.bind.annotation.XmlAccessorType;\r
+import javax.xml.bind.annotation.XmlElement;\r
+import javax.xml.bind.annotation.XmlIDREF;\r
+import javax.xml.bind.annotation.XmlSchemaType;\r
+import javax.xml.bind.annotation.XmlType;\r
\r
import org.apache.log4j.Logger;\r
+import org.hibernate.annotations.Cascade;\r
+import org.hibernate.annotations.CascadeType;\r
+import org.hibernate.envers.Audited;\r
+\r
+import eu.etaxonomy.cdm.model.agent.AgentBase;\r
\r
/**\r
* @author a.mueller\r
* @created 23.03.2009\r
* @version 1.0\r
*/\r
+@XmlAccessorType(XmlAccessType.FIELD)\r
+@XmlType(name = "Credit")\r
@Entity\r
-public class Credit extends CdmBase {\r
+@Audited\r
+public class Credit extends LanguageStringBase implements Cloneable{\r
+ private static final long serialVersionUID = 5763391127298427701L;\r
+ @SuppressWarnings("unused")\r
private static final Logger logger = Logger.getLogger(Credit.class);\r
+ \r
+ // owner etc as defined by the rightstype\r
+ @XmlElement(name = "Agent")\r
+ @XmlIDREF\r
+ @XmlSchemaType(name = "IDREF")\r
+ @ManyToOne(fetch = FetchType.LAZY)\r
+ @Cascade(CascadeType.SAVE_UPDATE)\r
+ private AgentBase agent;\r
+ \r
+ @XmlElement(name = "AbbreviatedText")\r
+ private String abbreviatedText;\r
+ \r
+ public static Credit NewInstance(AgentBase agent, String text){\r
+ return NewInstance(agent, text, null, Language.DEFAULT());\r
+ }\r
+\r
+ public static Credit NewInstance(AgentBase agent, String text, String abbreviatedText, Language language){\r
+ Credit result = new Credit(text, language);\r
+ result.setAgent(agent);\r
+ result.setAbbreviatedText(abbreviatedText);\r
+ return result;\r
+ }\r
+\r
+ \r
+ protected Credit(){\r
+ super();\r
+ }\r
+ \r
+ protected Credit(String text, Language language){\r
+ super(text, language);\r
+ }\r
+\r
+\r
+\r
+ /**\r
+ * @return the agent\r
+ */\r
+ public AgentBase getAgent() {\r
+ return agent;\r
+ }\r
+\r
+\r
+\r
+ /**\r
+ * @param agent the agent to set\r
+ */\r
+ public void setAgent(AgentBase agent) {\r
+ this.agent = agent;\r
+ }\r
+\r
+\r
+\r
+ /**\r
+ * @return the abbreviatedText\r
+ */\r
+ public String getAbbreviatedText() {\r
+ return abbreviatedText;\r
+ }\r
+\r
+\r
+\r
+ /**\r
+ * @param abbreviatedText the abbreviatedText to set\r
+ */\r
+ public void setAbbreviatedText(String abbreviatedText) {\r
+ this.abbreviatedText = abbreviatedText;\r
+ }\r
+\r
+//************************* CLONE **************************/\r
+ \r
+ /* (non-Javadoc)\r
+ * @see java.lang.Object#clone()\r
+ */\r
+ @Override\r
+ public Object clone() throws CloneNotSupportedException{\r
+ Credit result = (Credit)super.clone();\r
+ //no changes to: agent\r
+ return result;\r
+ }\r
+\r
+ \r
}\r