Revision 0ed0ef35
Added by Andreas Müller almost 16 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/occurrence/DerivationEvent.java | ||
---|---|---|
27 | 27 |
public class DerivationEvent extends EventBase{ |
28 | 28 |
static Logger logger = Logger.getLogger(DerivationEvent.class); |
29 | 29 |
|
30 |
private Set<SpecimenOrObservationBase> originals = new HashSet(); |
|
31 |
private Set<DerivedUnit> derivatives = new HashSet();
|
|
30 |
private Set<SpecimenOrObservationBase> originals = new HashSet<SpecimenOrObservationBase>();
|
|
31 |
protected Set<DerivedUnitBase> derivatives = new HashSet<DerivedUnitBase>();
|
|
32 | 32 |
private DerivationEventType type; |
33 | 33 |
|
34 | 34 |
/** |
... | ... | |
55 | 55 |
this.originals = originals; |
56 | 56 |
} |
57 | 57 |
public void addOriginal(SpecimenOrObservationBase original) { |
58 |
this.originals.add(original); |
|
58 |
if (! this.originals.contains(original)){ |
|
59 |
this.originals.add(original); |
|
60 |
original.addDerivationEvent(this); |
|
61 |
} |
|
59 | 62 |
} |
60 | 63 |
public void removeOriginal(SpecimenOrObservationBase original) { |
61 | 64 |
this.originals.remove(original); |
... | ... | |
64 | 67 |
|
65 | 68 |
@OneToMany(mappedBy="derivedFrom") |
66 | 69 |
@Cascade({CascadeType.SAVE_UPDATE}) |
67 |
public Set<DerivedUnit> getDerivatives() { |
|
70 |
public Set<DerivedUnitBase> getDerivatives() {
|
|
68 | 71 |
return derivatives; |
69 | 72 |
} |
70 |
protected void setDerivatives(Set<DerivedUnit> derivatives) { |
|
73 |
protected void setDerivatives(Set<DerivedUnitBase> derivatives) {
|
|
71 | 74 |
this.derivatives = derivatives; |
72 | 75 |
} |
73 |
public void addDerivative(DerivedUnit derivative) { |
|
74 |
this.derivatives.add(derivative);
|
|
76 |
public void addDerivative(DerivedUnitBase derivative) {
|
|
77 |
derivative.setDerivedFrom(this);
|
|
75 | 78 |
} |
76 |
public void removeDerivative(DerivedUnit derivative) { |
|
79 |
public void removeDerivative(DerivedUnitBase derivative) {
|
|
77 | 80 |
this.derivatives.remove(derivative); |
78 | 81 |
} |
79 | 82 |
|
Also available in: Unified diff
specimen