dataportal release v2.0
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / model / reference / PublicationBase.java
1 /**
2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
5 *
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.
8 */
9
10 package eu.etaxonomy.cdm.model.reference;
11
12 import javax.persistence.Entity;
13 import javax.xml.bind.annotation.XmlAccessType;
14 import javax.xml.bind.annotation.XmlAccessorType;
15 import javax.xml.bind.annotation.XmlElement;
16 import javax.xml.bind.annotation.XmlRootElement;
17 import javax.xml.bind.annotation.XmlType;
18
19 import org.apache.log4j.Logger;
20 import org.hibernate.envers.Audited;
21 import org.hibernate.search.annotations.Indexed;
22
23 import eu.etaxonomy.cdm.strategy.cache.reference.IReferenceBaseCacheStrategy;
24
25 /**
26 * This (abstract) class represents all different kind of published {@link StrictReferenceBase references}
27 * which constitute a physical or virtual unit. A reference is a published
28 * reference if it can be consulted by the general public.
29 *
30 * @author m.doering
31 * @version 1.0
32 * @created 08-Nov-2007 13:06:46
33 */
34 @XmlAccessorType(XmlAccessType.FIELD)
35 @XmlType(name = "PublicationBase", propOrder = {
36 "publisher",
37 "placePublished",
38
39 })
40 @XmlRootElement(name = "PublicationBase")
41 @Entity
42 @Indexed(index = "eu.etaxonomy.cdm.model.reference.ReferenceBase")
43 @Audited
44 public abstract class PublicationBase<S extends IReferenceBaseCacheStrategy> extends StrictReferenceBase<S> {
45 private static final Logger logger = Logger.getLogger(PublicationBase.class);
46
47 // @XmlElementWrapper(name = "Publishers")
48 // @XmlElement(name = "Publisher")
49 // @OneToMany (cascade = {javax.persistence.CascadeType.ALL}, fetch= FetchType.LAZY)
50 // @IndexColumn(name="sortIndex", base = 0)
51 // @JoinColumn (name = "referenceBase_id")
52 // @Cascade({CascadeType.SAVE_UPDATE, CascadeType.MERGE, CascadeType.DELETE_ORPHAN})
53 // private List<Publisher> publishers = new ArrayList<Publisher>();
54
55
56 @XmlElement(name = "Publisher")
57 private String publisher;
58
59 @XmlElement(name = "PlacePublished")
60 private String placePublished;
61
62
63 public PublicationBase(){
64 super();
65 }
66
67
68 /**
69 * @return the publisher
70 */
71 public String getPublisher() {
72 return publisher;
73 }
74
75
76
77 /**
78 * @param publisher the publisher to set
79 */
80 public void setPublisher(String publisher) {
81 this.publisher = publisher;
82 }
83
84
85
86 /**
87 * @return the placePublished
88 */
89 public String getPlacePublished() {
90 return placePublished;
91 }
92
93
94
95 /**
96 * @param placePublished the placePublished to set
97 */
98 public void setPlacePublished(String placePublished) {
99 this.placePublished = placePublished;
100 }
101
102
103 //*********** CLONE **********************************/
104
105 /**
106 * Clones <i>this</i> publication. This is a shortcut that enables to
107 * create a new instance that differs only slightly from <i>this</i>
108 * publication by modifying only some of the attributes.<BR>
109 * This method overrides the clone method from {@link StrictReferenceBase StrictReferenceBase}.
110 *
111 * @see StrictReferenceBase#clone()
112 * @see eu.etaxonomy.cdm.model.media.IdentifiableMediaEntity#clone()
113 * @see java.lang.Object#clone()
114 */
115 @Override
116 public Object clone() {
117 PublicationBase result = (PublicationBase)super.clone();
118 //Publisher
119 // result.publishers = new ArrayList<Publisher>();
120 // for (Publisher publisher : this.publishers ){
121 // Publisher newPublisher;
122 // try {
123 // newPublisher = (Publisher)publisher.clone();
124 // } catch (CloneNotSupportedException e) {
125 // //Publisher implements Cloneable therefore this should not be reached
126 // throw new RuntimeException("Publisher does not implement Cloneable");
127 // }
128 // result.addPublisher(newPublisher.getPublisherName(), newPublisher.getPlace());
129 // }
130 //No changes: -
131 return result;
132 }
133
134 }