source: VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/model/ResourceProxy.java @ 210

Last change on this file since 210 was 210, checked in by oschonef, 14 years ago
  • silence Hibernate warning
  • Property svn:eol-style set to native
File size: 1.8 KB
Line 
1package eu.clarin.cmdi.virtualcollectionregistry.model;
2
3import javax.persistence.Column;
4import javax.persistence.DiscriminatorValue;
5import javax.persistence.Entity;
6import javax.persistence.EnumType;
7import javax.persistence.Enumerated;
8import javax.persistence.Table;
9import javax.xml.bind.annotation.XmlAccessType;
10import javax.xml.bind.annotation.XmlAccessorType;
11import javax.xml.bind.annotation.XmlElement;
12import javax.xml.bind.annotation.XmlRootElement;
13import javax.xml.bind.annotation.XmlSeeAlso;
14import javax.xml.bind.annotation.XmlType;
15
16import org.apache.commons.lang.builder.HashCodeBuilder;
17
18@Entity
19@DiscriminatorValue("P")
20@XmlRootElement(name = "ResourceProxy")
21@XmlAccessorType(XmlAccessType.NONE)
22@XmlType(namespace = "urn:x-vcr:virtualcollection:resourceproxy",
23         propOrder = { "type", "ref" })
24@XmlSeeAlso({ Resource.class })
25public class ResourceProxy extends Resource {
26        @Column(name = "type")
27        @Enumerated(EnumType.ORDINAL)
28        private ResourceType type = ResourceType.METADATA;
29        @Column(name = "ref", nullable = false)
30        private String ref;
31
32        @SuppressWarnings("unused")
33        private ResourceProxy() {
34                super();
35        }
36
37        public ResourceProxy(ResourceType type, String ref) {
38                super();
39                this.setType(type);
40                this.setRef(ref);
41        }
42
43        public void setType(ResourceType type) {
44                if (type == null) {
45                        throw new IllegalArgumentException("type == null");
46                }
47                this.type = type;
48        }
49
50        @XmlElement(name = "ResourceType")
51        public ResourceType getType() {
52                return type;
53        }
54
55        public void setRef(String ref) {
56                if (ref == null) {
57                        throw new IllegalArgumentException("ref == null");
58                }
59                this.ref = ref;
60        }
61
62        @XmlElement(name = "ResourceRef")
63        public String getRef() {
64                return ref;
65        }
66
67        int getSignature() {
68                return new HashCodeBuilder(799, 51)
69                        .append(type)
70                        .append(ref)
71                        .toHashCode();
72        }
73
74} // class ResourceProxy
Note: See TracBrowser for help on using the repository browser.