StrictReferenceBase matchable
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / model / reference / SectionBase.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
13 import javax.persistence.Entity;
14 import javax.persistence.Transient;
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.XmlRootElement;
19 import javax.xml.bind.annotation.XmlType;
20
21 import org.apache.log4j.Logger;
22 import org.hibernate.envers.Audited;
23 import org.hibernate.search.annotations.Field;
24 import org.hibernate.search.annotations.Index;
25 import org.hibernate.search.annotations.Indexed;
26
27 import eu.etaxonomy.cdm.strategy.cache.reference.IReferenceBaseCacheStrategy;
28
29 /**
30 * This (abstract) class represents isolated sections (parts, chapters or
31 * papers) within a {@link PrintedUnitBase printed unit}.
32 * <P>
33 * This class corresponds, according to the TDWG ontology, to the publication type
34 * term (from PublicationTypeTerm): "SubReference".
35 *
36 * @author m.doering
37 * @version 1.0
38 * @created 08-Nov-2007 13:06:51
39 */
40 @XmlAccessorType(XmlAccessType.FIELD)
41 @XmlType(name = "SectionBase", propOrder = {
42 "pages"
43 })
44 @XmlRootElement(name = "SectionBase")
45 @Entity
46 @Indexed(index = "eu.etaxonomy.cdm.model.reference.ReferenceBase")
47 @Audited
48 public abstract class SectionBase<S extends IReferenceBaseCacheStrategy> extends StrictReferenceBase<S> {
49
50 static Logger logger = Logger.getLogger(SectionBase.class);
51
52 @XmlElement(name = "Pages")
53 @Field(index=Index.TOKENIZED)
54 private String pages;
55
56 /**
57 * Returns the string representing the page(s) where the content of
58 * <i>this</i> section is located within the {@link PrintedUnitBase printed unit}.
59 *
60 * @return the string with the pages corresponding to <i>this</i> section
61 */
62 public String getPages(){
63 return this.pages;
64 }
65
66 /**
67 * @see #getPages()
68 */
69 public void setPages(String pages){
70 this.pages = pages;
71 }
72
73 /**
74 * Returns the {@link PrintedUnitBase printed unit} to which <i>this</i> section
75 * belongs.
76 *
77 * @return the printed unit containing <i>this</i> section
78 */
79 @Transient
80 public PrintedUnitBase getPrintedUnit(){
81 logger.warn("Not yet implemented");
82 return null;
83 }
84
85 //*********** CLONE **********************************/
86
87
88 /**
89 * Clones <i>this</i> section. This is a shortcut that enables to
90 * create a new instance that differs only slightly from <i>this</i> section
91 * by modifying only some of the attributes.<BR>
92 * This method overrides the clone method from {@link StrictReferenceBase StrictReferenceBase}.
93 *
94 * @see StrictReferenceBase#clone()
95 * @see eu.etaxonomy.cdm.model.media.IdentifiableMediaEntity#clone()
96 * @see java.lang.Object#clone()
97 */
98 @Override
99 public Object clone(){
100 SectionBase result = (SectionBase)super.clone();
101 //no changes to: pages
102 return result;
103 }
104 }