| 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.description; |
|---|
| 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.XmlRootElement; |
|---|
| 16 | import javax.xml.bind.annotation.XmlType; |
|---|
| 17 | |
|---|
| 18 | import org.apache.log4j.Logger; |
|---|
| 19 | import org.hibernate.envers.Audited; |
|---|
| 20 | import org.hibernate.search.annotations.Indexed; |
|---|
| 21 | import org.springframework.beans.factory.annotation.Configurable; |
|---|
| 22 | |
|---|
| 23 | import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase; |
|---|
| 24 | import eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy; |
|---|
| 25 | import eu.etaxonomy.cdm.strategy.cache.common.IdentifiableEntityDefaultCacheStrategy; |
|---|
| 26 | |
|---|
| 27 | /** |
|---|
| 28 | * This class represents descriptions for {@link SpecimenOrObservationBase specimens or observations}. |
|---|
| 29 | * <P> |
|---|
| 30 | * This class corresponds to DescriptionsBaseType with an "Object" element |
|---|
| 31 | * according to the SDD schema. |
|---|
| 32 | * |
|---|
| 33 | * @author a.mueller |
|---|
| 34 | * @version 1.0 |
|---|
| 35 | * @created 08-Jul-2008 |
|---|
| 36 | */ |
|---|
| 37 | @XmlAccessorType(XmlAccessType.FIELD) |
|---|
| 38 | @XmlType(name = "SpecimenDescription") |
|---|
| 39 | @XmlRootElement(name = "SpecimenDescription") |
|---|
| 40 | @Entity |
|---|
| 41 | @Indexed(index = "eu.etaxonomy.cdm.model.description.DescriptionBase") |
|---|
| 42 | @Audited |
|---|
| 43 | @Configurable |
|---|
| 44 | public class SpecimenDescription extends DescriptionBase<IIdentifiableEntityCacheStrategy<SpecimenDescription>> implements Cloneable { |
|---|
| 45 | private static final long serialVersionUID = -8506790426682192703L; |
|---|
| 46 | private static final Logger logger = Logger.getLogger(SpecimenDescription.class); |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | /** |
|---|
| 50 | * Class constructor: creates a new empty specimen description instance. |
|---|
| 51 | */ |
|---|
| 52 | public SpecimenDescription() { |
|---|
| 53 | super(); |
|---|
| 54 | this.cacheStrategy = new IdentifiableEntityDefaultCacheStrategy<SpecimenDescription>(); |
|---|
| 55 | } |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | /** |
|---|
| 59 | * Creates a new empty specimen description instance. |
|---|
| 60 | */ |
|---|
| 61 | public static SpecimenDescription NewInstance(){ |
|---|
| 62 | return new SpecimenDescription(); |
|---|
| 63 | } |
|---|
| 64 | |
|---|
| 65 | /** |
|---|
| 66 | * Creates a new empty specimen description instance. |
|---|
| 67 | */ |
|---|
| 68 | public static SpecimenDescription NewInstance(SpecimenOrObservationBase specimen){ |
|---|
| 69 | SpecimenDescription result = new SpecimenDescription(); |
|---|
| 70 | result.addDescribedSpecimenOrObservation(specimen); |
|---|
| 71 | return result; |
|---|
| 72 | } |
|---|
| 73 | |
|---|
| 74 | //*********************** CLONE ********************************************************/ |
|---|
| 75 | |
|---|
| 76 | /** |
|---|
| 77 | * Clones <i>this</i> specimen description. This is a shortcut that enables to create |
|---|
| 78 | * a new instance that differs only slightly from <i>this</i> specimen description by |
|---|
| 79 | * modifying only some of the attributes. |
|---|
| 80 | * |
|---|
| 81 | * @see eu.etaxonomy.cdm.model.description.DescriptionBase#clone() |
|---|
| 82 | * @see java.lang.Object#clone() |
|---|
| 83 | */ |
|---|
| 84 | @Override |
|---|
| 85 | public Object clone() { |
|---|
| 86 | SpecimenDescription result; |
|---|
| 87 | result = (SpecimenDescription)super.clone(); |
|---|
| 88 | //no changes to: taxonName |
|---|
| 89 | return result; |
|---|
| 90 | } |
|---|
| 91 | |
|---|
| 92 | |
|---|
| 93 | } |
|---|