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
.occurrence
;
12 import java
.util
.HashSet
;
15 import javax
.persistence
.Entity
;
16 import javax
.persistence
.ManyToMany
;
17 import javax
.persistence
.ManyToOne
;
18 import javax
.persistence
.OneToMany
;
20 import org
.apache
.log4j
.Logger
;
21 import org
.hibernate
.annotations
.Cascade
;
22 import org
.hibernate
.annotations
.CascadeType
;
24 import eu
.etaxonomy
.cdm
.model
.common
.EventBase
;
27 public class DerivationEvent
extends EventBase
{
28 static Logger logger
= Logger
.getLogger(DerivationEvent
.class);
30 private Set
<SpecimenOrObservationBase
> originals
= new HashSet();
31 private Set
<DerivedUnit
> derivatives
= new HashSet();
32 private DerivationEventType type
;
38 public static DerivationEvent
NewInstance(){
39 return new DerivationEvent();
45 protected DerivationEvent() {
49 @ManyToMany(mappedBy
="derivationEvents")
50 @Cascade({CascadeType
.SAVE_UPDATE
})
51 public Set
<SpecimenOrObservationBase
> getOriginals() {
54 protected void setOriginals(Set
<SpecimenOrObservationBase
> originals
) {
55 this.originals
= originals
;
57 public void addOriginal(SpecimenOrObservationBase original
) {
58 this.originals
.add(original
);
60 public void removeOriginal(SpecimenOrObservationBase original
) {
61 this.originals
.remove(original
);
65 @OneToMany(mappedBy
="derivedFrom")
66 @Cascade({CascadeType
.SAVE_UPDATE
})
67 public Set
<DerivedUnit
> getDerivatives() {
70 protected void setDerivatives(Set
<DerivedUnit
> derivatives
) {
71 this.derivatives
= derivatives
;
73 public void addDerivative(DerivedUnit derivative
) {
74 this.derivatives
.add(derivative
);
76 public void removeDerivative(DerivedUnit derivative
) {
77 this.derivatives
.remove(derivative
);
82 public DerivationEventType
getType() {
85 public void setType(DerivationEventType type
) {