| 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.media; |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | import javax.persistence.Entity; |
|---|
| 14 | import javax.persistence.FetchType; |
|---|
| 15 | import javax.persistence.ManyToOne; |
|---|
| 16 | import javax.xml.bind.annotation.XmlAccessType; |
|---|
| 17 | import javax.xml.bind.annotation.XmlAccessorType; |
|---|
| 18 | import javax.xml.bind.annotation.XmlElement; |
|---|
| 19 | import javax.xml.bind.annotation.XmlIDREF; |
|---|
| 20 | import javax.xml.bind.annotation.XmlRootElement; |
|---|
| 21 | import javax.xml.bind.annotation.XmlSchemaType; |
|---|
| 22 | import javax.xml.bind.annotation.XmlType; |
|---|
| 23 | |
|---|
| 24 | import org.apache.log4j.Logger; |
|---|
| 25 | import org.hibernate.annotations.Cascade; |
|---|
| 26 | import org.hibernate.annotations.CascadeType; |
|---|
| 27 | import org.hibernate.envers.Audited; |
|---|
| 28 | |
|---|
| 29 | import eu.etaxonomy.cdm.model.common.IReferencedEntity; |
|---|
| 30 | import eu.etaxonomy.cdm.model.reference.Reference; |
|---|
| 31 | |
|---|
| 32 | /** |
|---|
| 33 | * @author m.doering |
|---|
| 34 | * @version 1.0 |
|---|
| 35 | * @created 08-Nov-2007 13:06:48 |
|---|
| 36 | */ |
|---|
| 37 | @XmlAccessorType(XmlAccessType.FIELD) |
|---|
| 38 | @XmlType(name = "ReferencedMedia", propOrder = { |
|---|
| 39 | "citationMicroReference", |
|---|
| 40 | "citation" |
|---|
| 41 | }) |
|---|
| 42 | @XmlRootElement(name = "ReferencedMedia") |
|---|
| 43 | @Entity |
|---|
| 44 | @Audited |
|---|
| 45 | public abstract class ReferencedMediaBase extends Media implements IReferencedEntity { |
|---|
| 46 | private static final long serialVersionUID = 4118655992311004088L; |
|---|
| 47 | static Logger logger = Logger.getLogger(ReferencedMediaBase.class); |
|---|
| 48 | |
|---|
| 49 | @XmlElement(name = "CitationMicroReference") |
|---|
| 50 | private String citationMicroReference; |
|---|
| 51 | |
|---|
| 52 | @XmlElement(name = "Citation") |
|---|
| 53 | @XmlIDREF |
|---|
| 54 | @XmlSchemaType(name = "IDREF") |
|---|
| 55 | @ManyToOne(fetch = FetchType.LAZY) |
|---|
| 56 | @Cascade(CascadeType.SAVE_UPDATE) |
|---|
| 57 | private Reference<?> citation; |
|---|
| 58 | |
|---|
| 59 | public Reference<?> getCitation(){ |
|---|
| 60 | return this.citation; |
|---|
| 61 | } |
|---|
| 62 | |
|---|
| 63 | public void setCitation(Reference<?> citation){ |
|---|
| 64 | this.citation = citation; |
|---|
| 65 | } |
|---|
| 66 | |
|---|
| 67 | public String getCitationMicroReference(){ |
|---|
| 68 | return this.citationMicroReference; |
|---|
| 69 | } |
|---|
| 70 | |
|---|
| 71 | public void setCitationMicroReference(String citationMicroReference){ |
|---|
| 72 | this.citationMicroReference = citationMicroReference; |
|---|
| 73 | } |
|---|
| 74 | |
|---|
| 75 | } |
|---|