1
|
package eu.dnetlib.enabling.is.hib.objects;
|
2
|
|
3
|
import java.io.Serializable;
|
4
|
import java.util.Set;
|
5
|
|
6
|
import javax.persistence.CascadeType;
|
7
|
import javax.persistence.Column;
|
8
|
import javax.persistence.Entity;
|
9
|
import javax.persistence.EnumType;
|
10
|
import javax.persistence.Enumerated;
|
11
|
import javax.persistence.FetchType;
|
12
|
import javax.persistence.Id;
|
13
|
import javax.persistence.JoinColumn;
|
14
|
import javax.persistence.ManyToOne;
|
15
|
import javax.persistence.OneToMany;
|
16
|
import javax.persistence.Table;
|
17
|
import javax.persistence.Transient;
|
18
|
|
19
|
import com.google.common.collect.Sets;
|
20
|
|
21
|
import eu.dnetlib.rmi.objects.is.DnetResourceFormat;
|
22
|
|
23
|
@Entity(name = "resource_types")
|
24
|
@Table(name = "resource_types")
|
25
|
public class HibResourceType extends HibDnetObject implements Serializable {
|
26
|
|
27
|
@Transient
|
28
|
private static final long serialVersionUID = -5251771674517773515L;
|
29
|
|
30
|
@Id
|
31
|
@Column(name = "id")
|
32
|
private String id;
|
33
|
|
34
|
@ManyToOne
|
35
|
@JoinColumn(name = "kind", nullable = false)
|
36
|
private HibResourceKind kind;
|
37
|
|
38
|
@OneToMany(mappedBy = "type", cascade = CascadeType.REMOVE, fetch = FetchType.LAZY)
|
39
|
private Set<HibService> services = Sets.newLinkedHashSet();
|
40
|
|
41
|
@OneToMany(mappedBy = "type", cascade = CascadeType.REMOVE, fetch = FetchType.LAZY)
|
42
|
private Set<HibDatastructure> datastructures = Sets.newLinkedHashSet();
|
43
|
|
44
|
@Column(name = "format")
|
45
|
@Enumerated(EnumType.STRING)
|
46
|
private DnetResourceFormat format;
|
47
|
|
48
|
public HibResourceType() {}
|
49
|
|
50
|
public HibResourceType(final String id, final HibResourceKind kind, final DnetResourceFormat format) {
|
51
|
this.id = id;
|
52
|
this.kind = kind;
|
53
|
this.format = format;
|
54
|
}
|
55
|
|
56
|
public String getId() {
|
57
|
return id;
|
58
|
}
|
59
|
|
60
|
public void setId(final String id) {
|
61
|
this.id = id;
|
62
|
}
|
63
|
|
64
|
public HibResourceKind getKind() {
|
65
|
return kind;
|
66
|
}
|
67
|
|
68
|
public void setKind(final HibResourceKind kind) {
|
69
|
this.kind = kind;
|
70
|
}
|
71
|
|
72
|
public Set<HibService> getServices() {
|
73
|
return services;
|
74
|
}
|
75
|
|
76
|
public void setServices(final Set<HibService> services) {
|
77
|
this.services = services;
|
78
|
}
|
79
|
|
80
|
public Set<HibDatastructure> getDatastructures() {
|
81
|
return datastructures;
|
82
|
}
|
83
|
|
84
|
public void setDatastructures(final Set<HibDatastructure> datastructures) {
|
85
|
this.datastructures = datastructures;
|
86
|
}
|
87
|
|
88
|
public DnetResourceFormat getFormat() {
|
89
|
return format;
|
90
|
}
|
91
|
|
92
|
public void setFormat(final DnetResourceFormat format) {
|
93
|
this.format = format;
|
94
|
}
|
95
|
|
96
|
@Override
|
97
|
public int hashCode() {
|
98
|
return id.hashCode();
|
99
|
}
|
100
|
}
|