Project

General

Profile

Download (3.77 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)
83
	private AgentBase<?> agent;
84

    
85

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

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

    
103
	/**
104
	 * Default Constructor
105
	 */
106
	protected Rights() {
107
		super();
108
	}
109

    
110
	/**
111
	 * Constructor
112
	 */
113
	protected Rights(String text, Language language) {
114
		super(text, language);
115
	}
116

    
117
	public RightsType getType(){
118
		return this.type;
119
	}
120

    
121
	public void setType(RightsType type){
122
		this.type = type;
123
	}
124

    
125
	public URI getUri(){
126
		return this.uri;
127
	}
128

    
129
	public void setUri(URI uri){
130
		this.uri = uri;
131
	}
132

    
133
	public String getAbbreviatedText(){
134
		return this.abbreviatedText;
135
	}
136

    
137
	public void setAbbreviatedText(String abbreviatedStatement){
138
		this.abbreviatedText = abbreviatedStatement;
139
	}
140

    
141
	public AgentBase getAgent() {
142
		return agent;
143
	}
144

    
145
	public void setAgent(AgentBase agent) {
146
		this.agent = agent;
147
	}
148

    
149
//************************* CLONE **************************/
150

    
151

    
152
	/* (non-Javadoc)
153
	 * @see java.lang.Object#clone()
154
	 */
155
	@Override
156
	public Object clone() throws CloneNotSupportedException{
157
		Rights result = (Rights)super.clone();
158
		//no changes to: type, agent
159
		return result;
160
	}
161
}
(11-11/13)