1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package ch.hortis.sonar.model;
21
22 import org.apache.commons.lang.builder.EqualsBuilder;
23
24 import javax.persistence.*;
25
26 @Entity
27 @Table(name = "snapshot_sources")
28 public class SnapshotSource {
29
30 @Id
31 @Column(name = "id")
32 @SequenceGenerator(name = "SNAPSHOT_SOURCES_SEQ", sequenceName = "SNAPSHOT_SOURCES_SEQ")
33 @GeneratedValue(strategy = GenerationType.AUTO, generator = "SNAPSHOT_SOURCES_SEQ")
34 private Integer id;
35
36 @Column(name = "snapshot_id")
37 private Integer snapshotId;
38
39 @Lob
40 @Column(name = "data", updatable = true, nullable = true, length = 16777215)
41 private String data;
42
43 public SnapshotSource() {
44 }
45
46 public SnapshotSource(Snapshot snapshot, String data) {
47 this.snapshotId = snapshot.getId();
48 this.data = data;
49 }
50
51 public Integer getId() {
52 return id;
53 }
54
55 public void setId(Integer id) {
56 this.id = id;
57 }
58
59 public void setSnapshot(Snapshot snapshot) {
60 this.snapshotId = snapshot.getId();
61 }
62
63 public String getData() {
64 return data;
65 }
66
67 public void setData(String data) {
68 this.data = data;
69 }
70
71 public boolean equals(Object obj) {
72 if (!(obj instanceof SnapshotSource)) {
73 return false;
74 }
75 if (this == obj) {
76 return true;
77 }
78 SnapshotSource other = (SnapshotSource) obj;
79 return snapshotId.equals(other.snapshotId);
80 }
81
82 public int hashCode() {
83 return snapshotId.hashCode();
84 }
85 }