1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.server.core.api.changelog;
21
22
23 import java.util.Date;
24
25
26
27
28
29
30
31
32 public class Tag
33 {
34
35 private final long revision;
36 private final String description;
37
38
39 private Date tagDate;
40
41
42 private Date revisionDate;
43
44
45 public Tag( long revision, String description )
46 {
47 this.revision = revision;
48 this.description = description;
49 this.tagDate = new Date();
50 }
51
52
53 public Tag( long revision, String description, Date tagDate, Date revisionDate )
54 {
55 this.revision = revision;
56 this.description = description;
57 this.tagDate = tagDate;
58 this.revisionDate = revisionDate;
59 }
60
61
62 public Tag( long revision, String description, long tagTime, long revisionTime )
63 {
64 this.revision = revision;
65 this.description = description;
66 this.tagDate = new Date( tagTime );
67
68 if ( revisionTime > 0 )
69 {
70 this.revisionDate = new Date( revisionTime );
71 }
72 }
73
74
75
76
77
78 public long getRevision()
79 {
80 return revision;
81 }
82
83
84
85
86
87 public String getDescription()
88 {
89 return description;
90 }
91
92
93 public Date getTagDate()
94 {
95 return tagDate;
96 }
97
98
99 public Date getRevisionDate()
100 {
101 return revisionDate;
102 }
103
104
105
106
107
108 @Override
109 public int hashCode()
110 {
111 int hash = 37;
112 if ( description != null )
113 {
114 hash = hash * 17 + description.hashCode();
115 }
116 hash = hash * 17 + Long.valueOf( revision ).hashCode();
117
118 return hash;
119 }
120
121
122
123
124
125 @Override
126 public boolean equals( Object other )
127 {
128 if ( other instanceof Tag )
129 {
130 Taghref="../../../../../../../org/apache/directory/server/core/api/changelog/Tag.html#Tag">Tag ot = ( Tag ) other;
131
132 if ( description != null && ot.getDescription() != null )
133 {
134 return revision == ot.getRevision() && description.equals( ot.getDescription() );
135 }
136 else if ( description == null && ot.getDescription() == null )
137 {
138 return revision == ot.getRevision();
139 }
140 }
141
142 return false;
143 }
144
145
146 @Override
147 public String toString()
148 {
149 StringBuilder sb = new StringBuilder();
150 sb.append( "Tag { " );
151
152 sb.append( "revision = " )
153 .append( revision )
154 .append( ", " );
155
156 sb.append( " tagDate = " )
157 .append( tagDate )
158 .append( ", " );
159
160 sb.append( " revisionDate = " )
161 .append( revisionDate );
162
163 sb.append( " }" );
164
165 return sb.toString();
166 }
167
168 }