1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.ibatis.migration;
17
18 import java.math.BigDecimal;
19
20 public class Change implements Comparable<Change> {
21
22 private BigDecimal id;
23 private String description;
24 private String appliedTimestamp;
25 private String filename;
26
27 public Change() {
28 }
29
30 public Change(BigDecimal id) {
31 this.id = id;
32 }
33
34 public Change(BigDecimal id, String appliedTimestamp, String description) {
35 this.id = id;
36 this.appliedTimestamp = appliedTimestamp;
37 this.description = description;
38 }
39
40 public Change(Change toCopy) {
41 this(toCopy.getId(), toCopy.getAppliedTimestamp(), toCopy.getDescription());
42 this.filename = toCopy.getFilename();
43 }
44
45 public BigDecimal getId() {
46 return id;
47 }
48
49 public void setId(BigDecimal id) {
50 this.id = id;
51 }
52
53 public String getDescription() {
54 return description;
55 }
56
57 public void setDescription(String description) {
58 this.description = description;
59 }
60
61 public String getAppliedTimestamp() {
62 return appliedTimestamp;
63 }
64
65 public void setAppliedTimestamp(String appliedTimestamp) {
66 this.appliedTimestamp = appliedTimestamp;
67 }
68
69 public String getFilename() {
70 return filename;
71 }
72
73 public void setFilename(String filename) {
74 this.filename = filename;
75 }
76
77 @Override
78 public String toString() {
79 return id + " " + (appliedTimestamp == null ? " ...pending... " : appliedTimestamp) + " " + description;
80 }
81
82 @Override
83 public boolean equals(Object o) {
84 if (this == o) {
85 return true;
86 }
87 if (o == null || getClass() != o.getClass()) {
88 return false;
89 }
90
91 Change change = (Change) o;
92
93 return id.equals(change.getId());
94 }
95
96 @Override
97 public int hashCode() {
98 return id.hashCode();
99 }
100
101 @Override
102 public int compareTo(Change change) {
103 return id.compareTo(change.getId());
104 }
105
106 }