Project

General

Profile

Download (3.11 KB) Statistics
| Branch: | Tag: | Revision:
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.XmlRootElement;
18
import javax.xml.bind.annotation.XmlType;
19

    
20
import org.apache.log4j.Logger;
21
import org.hibernate.envers.Audited;
22
import org.hibernate.search.annotations.Indexed;
23
import org.springframework.beans.factory.annotation.Configurable;
24

    
25
import eu.etaxonomy.cdm.strategy.cache.reference.CdDvdDefaultCacheStrategy;
26
import eu.etaxonomy.cdm.strategy.cache.reference.INomenclaturalReferenceCacheStrategy;
27

    
28
/**
29
 * This class represents electronic publications the support of which are Cds 
30
 * (Compact Discs) or Dvds (Digital Versatile Discs). This class applies for Cds
31
 * or Dvds as a whole but not for parts of it.
32
 * CdDvd implements INomenclaturalReference as this seems to be allowed by the ICZN
33
 * (see http://www.iczn.org/electronic_publication.html)
34
 * 
35
 * @author m.doering
36
 * @version 1.0
37
 * @created 08-Nov-2007 13:06:15
38
 */
39
@XmlAccessorType(XmlAccessType.FIELD)
40
@XmlType(name = "CdDvd")
41
@XmlRootElement(name = "CdDvd")
42
@Entity
43
@Indexed(index = "eu.etaxonomy.cdm.model.reference.ReferenceBase")
44
@Audited
45
@Configurable
46
public class CdDvd extends PublicationBase<INomenclaturalReferenceCacheStrategy<CdDvd>> implements INomenclaturalReference, Cloneable{
47
	private static final long serialVersionUID = -1010571682756717813L;
48
	private static final Logger logger = Logger.getLogger(CdDvd.class);
49

    
50
	public static CdDvd NewInstance() {
51
		return new CdDvd();
52
	}
53
	
54
	
55
//    @XmlTransient
56
//    @Transient
57
//	private NomenclaturalReferenceHelper nomRefBase = NomenclaturalReferenceHelper.NewInstance(this);
58

    
59
	
60
	protected CdDvd(){
61
		super();
62
		this.type = ReferenceType.CdDvd;
63
		this.cacheStrategy = CdDvdDefaultCacheStrategy.NewInstance();
64
	}
65
	
66

    
67
	 /**(non-Javadoc)
68
	 * @see eu.etaxonomy.cdm.model.reference.INomenclaturalReference#getNomenclaturalCitation(java.lang.String)
69
	 */
70
	@Transient
71
	public String getNomenclaturalCitation(String microReference) {
72
		if (cacheStrategy == null){
73
			logger.warn("No CacheStrategy defined for "+ this.getClass() + ": " + this.getUuid());
74
			return null;
75
		}else{
76
			return cacheStrategy.getNomenclaturalCitation(this,microReference);
77
		}
78
	}
79
	
80

    
81
	
82
	/** 
83
	 * Clones <i>this</i> Cd or Dvd instance. This is a shortcut that enables to
84
	 * create a new instance that differs only slightly from <i>this</i>
85
	 * Cd or Dvd instance by modifying only some of the attributes.<BR>
86
	 * This method overrides the clone method from {@link StrictReferenceBase StrictReferenceBase}.
87
	 * 
88
	 * @see StrictReferenceBase#clone()
89
	 * @see eu.etaxonomy.cdm.model.media.IdentifiableMediaEntity#clone()
90
	 * @see java.lang.Object#clone()
91
	 */
92
	@Override
93
	public Object clone(){
94
		CdDvd result = (CdDvd)super.clone();
95
		//no changes to: -
96
		return result;
97
	}
98

    
99
}
(4-4/47)