Added methods for retrieving Rights and OriginalSource as part of #466 implemented...
[cdmlib.git] / cdmlib-model / src / main / java / eu / etaxonomy / cdm / model / media / Rights.java
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 org.apache.log4j.Logger;
13 import org.hibernate.annotations.Cascade;
14 import org.hibernate.annotations.CascadeType;
15 import eu.etaxonomy.cdm.model.agent.Agent;
16 import eu.etaxonomy.cdm.model.common.Language;
17 import eu.etaxonomy.cdm.model.common.LanguageStringBase;
18
19 import javax.persistence.*;
20 import javax.xml.bind.annotation.XmlAccessType;
21 import javax.xml.bind.annotation.XmlAccessorType;
22 import javax.xml.bind.annotation.XmlElement;
23 import javax.xml.bind.annotation.XmlIDREF;
24 import javax.xml.bind.annotation.XmlRootElement;
25 import javax.xml.bind.annotation.XmlSchemaType;
26 import javax.xml.bind.annotation.XmlType;
27
28 /**
29 * Typically, rights information includes a statement about various property
30 * rights associated with the resource, including intellectual property rights.
31 * http://purl.org/dc/elements/1.1/rights http://dublincore.org/documents/dcmi-
32 * terms/
33 * @author m.doering
34 * @version 1.0
35 * @created 08-Nov-2007 13:06:49
36 */
37 @XmlAccessorType(XmlAccessType.FIELD)
38 @XmlType(name = "Rights", propOrder = {
39 "uri",
40 "abbreviatedText",
41 "type",
42 "agent"
43 })
44 @XmlRootElement(name = "Rights")
45 @Entity
46 public class Rights extends LanguageStringBase {
47 private static final long serialVersionUID = 4920749849951432284L;
48 private static final Logger logger = Logger.getLogger(Rights.class);
49
50 //external location of copyright text
51 @XmlElement(name = "URI")
52 private String uri;
53
54 @XmlElement(name = "AbbreviatedText")
55 private String abbreviatedText;
56
57 @XmlElement(name = "Type")
58 @XmlIDREF
59 @XmlSchemaType(name = "IDREF")
60 private RightsTerm type;
61
62 // owner etc as defined by the rightstype
63 @XmlElement(name = "Agent")
64 @XmlIDREF
65 @XmlSchemaType(name = "IDREF")
66 private Agent agent;
67
68
69 /**
70 * Factory method
71 * @return
72 */
73 public static Rights NewInstance() {
74 logger.debug("NewInstance");
75 return new Rights();
76 }
77
78 /**
79 * Factory method
80 * @return
81 */
82 public static Rights NewInstance(String text, Language language) {
83 return new Rights(text, language);
84 }
85
86 /**
87 * Default Constructor
88 */
89 protected Rights() {
90 super();
91 }
92
93 /**
94 * Constructor
95 */
96 protected Rights(String text, Language language) {
97 super(text, language);
98 }
99
100
101 @ManyToOne(fetch = FetchType.LAZY)
102 @Cascade({CascadeType.SAVE_UPDATE})
103 public RightsTerm getType(){
104 return this.type;
105 }
106 public void setType(RightsTerm type){
107 this.type = type;
108 }
109
110
111 public String getUri(){
112 return this.uri;
113 }
114 public void setUri(String uri){
115 this.uri = uri;
116 }
117
118
119 public String getAbbreviatedText(){
120 return this.abbreviatedText;
121 }
122 public void setAbbreviatedText(String abbreviatedStatement){
123 this.abbreviatedText = abbreviatedStatement;
124 }
125
126
127 @ManyToOne
128 @Cascade({CascadeType.SAVE_UPDATE})
129 public Agent getAgent() {
130 return agent;
131 }
132 public void setAgent(Agent agent) {
133 this.agent = agent;
134 }
135
136 }