Project

General

Profile

Download (3.93 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.media;
11

    
12
import java.net.URI;
13

    
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;
25

    
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;
33

    
34
import eu.etaxonomy.cdm.model.agent.AgentBase;
35
import eu.etaxonomy.cdm.model.common.Language;
36
import eu.etaxonomy.cdm.model.common.LanguageStringBase;
37

    
38
/**
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-
42
 * terms/
43
 * @author m.doering
44
 * @version 1.0
45
 * @created 08-Nov-2007 13:06:49
46
 */
47
@XmlAccessorType(XmlAccessType.FIELD)
48
@XmlType(name = "Rights", propOrder = {
49
    "uri",
50
    "abbreviatedText",
51
    "type",
52
    "agent"
53
})
54
@XmlRootElement(name = "Rights")
55
@Entity
56
@Audited
57
@Table(name = "RightsInfo")  //to avoid conflicts with reserved database words
58
public class Rights extends LanguageStringBase implements Cloneable{
59
	private static final long serialVersionUID = 4920749849951432284L;
60
	private static final Logger logger = Logger.getLogger(Rights.class);
61

    
62
	//external location of copyright text
63
	@XmlElement(name = "URI")
64
	@Field(analyze = Analyze.NO)
65
	@Type(type="uriUserType")
66
	private URI uri;
67

    
68
	@XmlElement(name = "AbbreviatedText")
69
	private String abbreviatedText;
70

    
71
	@XmlElement(name = "Type")
72
	@XmlIDREF
73
	@XmlSchemaType(name = "IDREF")
74
	@ManyToOne(fetch = FetchType.LAZY)
75
	private RightsType type;
76

    
77
	// owner etc as defined by the rightstype
78
	@XmlElement(name = "Agent")
79
	@XmlIDREF
80
	@XmlSchemaType(name = "IDREF")
81
	@ManyToOne(fetch = FetchType.LAZY)
82
	@Cascade({CascadeType.SAVE_UPDATE,CascadeType.MERGE})
83
	private AgentBase<?> agent;
84

    
85
// ******************** FACTORY ***********************/
86

    
87
	/**
88
	 * Factory method
89
	 * @return
90
	 */
91
	public static Rights NewInstance() {
92
		logger.debug("NewInstance");
93
		return new Rights();
94
	}
95

    
96
	/**
97
	 * Factory method
98
	 * @return
99
	 */
100
	public static Rights NewInstance(String text, Language language) {
101
		return new Rights(text, language);
102
	}
103

    
104
//*********************** CONSTRUCTOR *************************/
105

    
106
	/**
107
	 * Default Constructor
108
	 */
109
	protected Rights() {
110
		super();
111
	}
112

    
113
	/**
114
	 * Constructor
115
	 */
116
	protected Rights(String text, Language language) {
117
		super(text, language);
118
	}
119

    
120
//*********************** GETTER /SETTER *****************************/
121

    
122
	public RightsType getType(){
123
		return this.type;
124
	}
125

    
126
	public void setType(RightsType type){
127
		this.type = type;
128
	}
129

    
130
	public URI getUri(){
131
		return this.uri;
132
	}
133

    
134
	public void setUri(URI uri){
135
		this.uri = uri;
136
	}
137

    
138
	public String getAbbreviatedText(){
139
		return this.abbreviatedText;
140
	}
141

    
142
	public void setAbbreviatedText(String abbreviatedStatement){
143
		this.abbreviatedText = abbreviatedStatement;
144
	}
145

    
146
	public AgentBase getAgent() {
147
		return agent;
148
	}
149

    
150
	public void setAgent(AgentBase agent) {
151
		this.agent = agent;
152
	}
153

    
154
//************************* CLONE **************************/
155

    
156
	@Override
157
	public Object clone() throws CloneNotSupportedException{
158
		Rights result = (Rights)super.clone();
159
		//no changes to: type, agent
160
		return result;
161
	}
162
}
(11-11/13)