2 * Copyright (C) 2009 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
.FetchType
;
13 import javax
.persistence
.ManyToOne
;
14 import javax
.persistence
.MappedSuperclass
;
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
.XmlRootElement
;
20 import javax
.xml
.bind
.annotation
.XmlSchemaType
;
21 import javax
.xml
.bind
.annotation
.XmlType
;
23 import org
.apache
.log4j
.Logger
;
24 import org
.hibernate
.annotations
.Cascade
;
25 import org
.hibernate
.annotations
.CascadeType
;
26 import org
.hibernate
.search
.annotations
.Field
;
27 import org
.hibernate
.search
.annotations
.Index
;
28 import org
.hibernate
.search
.annotations
.IndexedEmbedded
;
30 import eu
.etaxonomy
.cdm
.model
.agent
.AgentBase
;
32 @XmlAccessorType(XmlAccessType
.FIELD
)
33 @XmlType(name
= "EventBase", propOrder
= {
38 @XmlRootElement(name
= "EventBase")
40 public abstract class EventBase
extends AnnotatableEntity
implements IEvent
{
41 private static final long serialVersionUID
= -1859035632758446593L;
42 @SuppressWarnings("unused")
43 private static final Logger logger
= Logger
.getLogger(EventBase
.class);
45 @XmlElement(name
= "TimePeriod")
46 private TimePeriod timeperiod
= TimePeriod
.NewInstance();
48 @XmlElement(name
= "Actor")
50 @XmlSchemaType(name
= "IDREF")
51 @ManyToOne(fetch
= FetchType
.LAZY
)
53 @Cascade(CascadeType
.SAVE_UPDATE
)
54 private AgentBase actor
;
56 @XmlElement(name
= "Description")
57 @Field(index
=Index
.TOKENIZED
)
58 private String description
;
62 * @see eu.etaxonomy.cdm.model.occurrence.IEvent#getTimeperiod()
64 public TimePeriod
getTimeperiod() {
68 * @see eu.etaxonomy.cdm.model.occurrence.IEvent#setTimeperiod(eu.etaxonomy.cdm.model.common.TimePeriod)
70 public void setTimeperiod(TimePeriod timeperiod
) {
71 this.timeperiod
= timeperiod
;
75 * @see eu.etaxonomy.cdm.model.occurrence.IEvent#getActor()
77 public AgentBase
getActor() {
81 * @see eu.etaxonomy.cdm.model.occurrence.IEvent#setActor(eu.etaxonomy.cdm.model.agent.Agent)
83 public void setActor(AgentBase actor
) {
88 * @see eu.etaxonomy.cdm.model.occurrence.IEvent#getDescription()
90 public String
getDescription() {
94 * @see eu.etaxonomy.cdm.model.occurrence.IEvent#setDescription(java.lang.String)
96 public void setDescription(String description
) {
97 this.description
= description
;
101 //*********** CLONE **********************************/
104 * Clones <i>this</i> event base. This is a shortcut that enables to
105 * create a new instance that differs only slightly from <i>this</i> event base
106 * by modifying only some of the attributes.<BR>
107 * This method overrides the clone method from {@link AnnotatableEntity AnnotatableEntity}.
109 * @see eu.etaxonomy.cdm.model.media.AnnotatableEntity#clone()
110 * @see java.lang.Object#clone()
113 public Object
clone() throws CloneNotSupportedException
{
114 EventBase result
= (EventBase
)super.clone();
116 result
.setActor(this.getActor());
118 result
.setTimeperiod((TimePeriod
)this.getTimeperiod().clone());
119 //no changes to: description