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
.media
;
14 import javax
.persistence
.Entity
;
15 import javax
.persistence
.FetchType
;
16 import javax
.persistence
.ManyToOne
;
17 import javax
.persistence
.Table
;
18 import javax
.xml
.bind
.annotation
.XmlAccessType
;
19 import javax
.xml
.bind
.annotation
.XmlAccessorType
;
20 import javax
.xml
.bind
.annotation
.XmlElement
;
21 import javax
.xml
.bind
.annotation
.XmlIDREF
;
22 import javax
.xml
.bind
.annotation
.XmlRootElement
;
23 import javax
.xml
.bind
.annotation
.XmlSchemaType
;
24 import javax
.xml
.bind
.annotation
.XmlType
;
26 import org
.apache
.log4j
.Logger
;
27 import org
.hibernate
.annotations
.Cascade
;
28 import org
.hibernate
.annotations
.CascadeType
;
29 import org
.hibernate
.annotations
.Type
;
30 import org
.hibernate
.envers
.Audited
;
31 import org
.hibernate
.search
.annotations
.Analyze
;
32 import org
.hibernate
.search
.annotations
.Field
;
34 import eu
.etaxonomy
.cdm
.model
.agent
.AgentBase
;
35 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
36 import eu
.etaxonomy
.cdm
.model
.common
.LanguageStringBase
;
39 * Typically, rights information includes a statement about various property
40 * rights associated with the resource, including intellectual property rights.
41 * http://purl.org/dc/elements/1.1/rights http://dublincore.org/documents/dcmi-
44 * @created 08-Nov-2007 13:06:49
46 @XmlAccessorType(XmlAccessType
.FIELD
)
47 @XmlType(name
= "Rights", propOrder
= {
53 @XmlRootElement(name
= "Rights")
56 @Table(name
= "RightsInfo") //to avoid conflicts with reserved database words
57 public class Rights
extends LanguageStringBase
implements Cloneable
{
58 private static final long serialVersionUID
= 4920749849951432284L;
59 @SuppressWarnings("unused")
60 private static final Logger logger
= Logger
.getLogger(Rights
.class);
62 //external location of copyright text
63 @XmlElement(name
= "URI")
64 @Field(analyze
= Analyze
.NO
)
65 @Type(type
="uriUserType")
68 @XmlElement(name
= "AbbreviatedText")
69 private String abbreviatedText
;
71 @XmlElement(name
= "Type")
73 @XmlSchemaType(name
= "IDREF")
74 @ManyToOne(fetch
= FetchType
.LAZY
)
75 private RightsType type
;
77 // owner etc as defined by the rights type
78 @XmlElement(name
= "Agent")
80 @XmlSchemaType(name
= "IDREF")
81 @ManyToOne(fetch
= FetchType
.LAZY
)
82 @Cascade({CascadeType
.SAVE_UPDATE
, CascadeType
.MERGE
})
83 private AgentBase
<?
> agent
;
85 // ******************** FACTORY ***********************/
87 public static Rights
NewInstance() {
91 public static Rights
NewInstance(String text
, Language language
) {
92 return new Rights(text
, language
, null, null);
95 public static Rights
NewInstance(RightsType type
) {
96 return new Rights(null, null, type
, null);
99 public static Rights
NewInstance(RightsType type
, AgentBase agent
) {
100 return new Rights(null, null, type
, agent
);
103 public static Rights
NewInstance(String text
, Language language
, RightsType type
) {
104 return new Rights(text
, language
, type
, null);
107 public static Rights
NewInstance(String text
, Language language
, RightsType type
, AgentBase agent
) {
108 return new Rights(text
, language
, type
, agent
);
111 //*********************** CONSTRUCTOR *************************/
116 protected Rights(String text
, Language language
, RightsType type
, AgentBase agent
) {
117 super(text
, language
);
119 this.setAgent(agent
);
122 //*********************** GETTER /SETTER *****************************/
124 public RightsType
getType(){
128 public void setType(RightsType type
){
136 public void setUri(URI uri
){
140 public String
getAbbreviatedText(){
141 return this.abbreviatedText
;
144 public void setAbbreviatedText(String abbreviatedStatement
){
145 this.abbreviatedText
= abbreviatedStatement
;
148 public AgentBase
getAgent() {
152 public void setAgent(AgentBase agent
) {
156 //************************* CLONE **************************/
159 public Object
clone() throws CloneNotSupportedException
{
160 Rights result
= (Rights
)super.clone();
161 //no changes to: type, agent