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.changelog;
21
22
23 import java.util.Date;
24
25
26
27
28
29
30
31
32
33 public class Tag
34 {
35
36 private final long revision;
37 private final String description;
38
39
40 private Date tagDate;
41
42
43 private Date revisionDate;
44
45
46 public Tag( long revision, String description )
47 {
48 this.revision = revision;
49 this.description = description;
50 this.tagDate = new Date();
51 }
52
53
54 public Tag( long revision, String description, Date tagDate, Date revisionDate )
55 {
56 this.revision = revision;
57 this.description = description;
58 this.tagDate = tagDate;
59 this.revisionDate = revisionDate;
60 }
61
62
63 public Tag( long revision, String description, long tagTime, long revisionTime )
64 {
65 this.revision = revision;
66 this.description = description;
67 this.tagDate = new Date( tagTime );
68
69 if( revisionTime > 0 )
70 {
71 this.revisionDate = new Date( revisionTime );
72 }
73 }
74
75
76
77
78
79 public long getRevision()
80 {
81 return revision;
82 }
83
84
85
86
87
88 public String getDescription()
89 {
90 return description;
91 }
92
93
94 public Date getTagDate()
95 {
96 return tagDate;
97 }
98
99
100 public Date getRevisionDate()
101 {
102 return revisionDate;
103 }
104
105
106 public boolean equals( Object other )
107 {
108 if ( other instanceof Tag )
109 {
110 Tag ot = ( Tag ) other;
111
112 if ( description != null && ot.getDescription() != null )
113 {
114 return revision == ot.getRevision() && description.equals( ot.getDescription() );
115 }
116 else if ( description == null && ot.getDescription() == null )
117 {
118 return revision == ot.getRevision();
119 }
120 }
121
122 return false;
123 }
124
125
126 @Override
127 public String toString()
128 {
129 StringBuilder sb = new StringBuilder();
130 sb.append( "Tag { " );
131
132 sb.append( "revision = " )
133 .append( revision )
134 .append( ", " );
135
136 sb.append( " tagDate = " )
137 .append( tagDate )
138 .append( ", " );
139
140 sb.append( " revisionDate = " )
141 .append( revisionDate );
142
143 sb.append( " }" );
144
145 return sb.toString();
146 }
147
148
149 }