2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.model
.common
;
12 import org
.apache
.log4j
.Logger
;
13 import org
.hibernate
.annotations
.Cascade
;
14 import org
.hibernate
.annotations
.CascadeType
;
16 import javax
.persistence
.*;
17 import javax
.xml
.bind
.annotation
.XmlAccessType
;
18 import javax
.xml
.bind
.annotation
.XmlAccessorType
;
19 import javax
.xml
.bind
.annotation
.XmlElement
;
20 import javax
.xml
.bind
.annotation
.XmlType
;
23 * This class aims to make available some "flags" for identifiable entities in a
24 * flexible way. Application developers (and even users) can define their own
25 * "flags" as a MarkerType.
28 * @created 08-Nov-2007 13:06:33
30 @XmlAccessorType(XmlAccessType
.FIELD
)
31 @XmlType(name
= "Marker")
33 public class Marker
extends VersionableEntity
implements Cloneable
{
34 private static final Logger logger
= Logger
.getLogger(Marker
.class);
36 @XmlElement(name
= "Flag")
39 @XmlElement(name
= "MarkerType")
40 private MarkerType markerType
;
42 @XmlElement(name
= "MarkedObject")
43 private AnnotatableEntity markedObj
;
49 public static Marker
NewInstance(){
55 * @param markerType The type of the marker
56 * @param flag The value of the marker
59 public static Marker
NewInstance(MarkerType markerType
, boolean flag
){
60 return new Marker(markerType
, flag
);
73 protected Marker(MarkerType markerType
, boolean flag
){
74 this.markerType
= markerType
;
82 public AnnotatableEntity
getMarkedObj() {
85 protected void setMarkedObj(AnnotatableEntity newMarkedObject
) {
86 this.markedObj
= newMarkedObject
;
93 @Cascade({CascadeType
.SAVE_UPDATE
})
94 public MarkerType
getMarkerType(){
95 return this.markerType
;
97 public void setMarkerType(MarkerType type
){
98 this.markerType
= type
;
105 public boolean getFlag(){
108 public void setFlag(boolean flag
){
113 //****************** CLONE ************************************************/
116 * @see java.lang.Object#clone()
119 public Object
clone() throws CloneNotSupportedException
{
120 Marker result
= (Marker
)super.clone();
121 //no changes to: type, flag
126 * Clones this marker and sets the clones marked object to 'markedObject'
127 * @see java.lang.Object#clone()
129 public Marker
clone(AnnotatableEntity markedObject
) throws CloneNotSupportedException
{
130 Marker result
= (Marker
)clone();
131 result
.setMarkedObj(markedObject
);