1 package org.apache.maven.scm.provider.accurev;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.util.Collection;
23 import java.util.Date;
24 import java.util.HashSet;
25
26
27
28
29 public class Transaction
30 {
31
32
33
34
35 public class Version
36 {
37
38 private String realSpec;
39
40 private String virtualSpec;
41
42 private String ancestorSpec;
43
44 private Long elementId;
45
46 private String elementName;
47
48 private Version( Long id, String elementName, String virtualSpec, String realSpec, String ancestor )
49 {
50 this.elementId = id;
51 this.virtualSpec = virtualSpec;
52 this.realSpec = realSpec;
53 this.ancestorSpec = ancestor;
54 this.elementName = elementName;
55 }
56
57 public String getVirtualSpec()
58 {
59 return virtualSpec;
60 }
61
62 public void setVirtualSpec( String virtualSpec )
63 {
64 this.virtualSpec = virtualSpec;
65 }
66
67 public String getAncestorSpec()
68 {
69 return ancestorSpec;
70 }
71
72 public void setAncestorSpec( String ancestorSpec )
73 {
74 this.ancestorSpec = ancestorSpec;
75 }
76
77 public void setRealSpec( String realSpec )
78 {
79 this.realSpec = realSpec;
80 }
81
82 public void setElementId( Long elementId )
83 {
84 this.elementId = elementId;
85 }
86
87 public String getRealSpec()
88 {
89 return realSpec;
90 }
91
92 public Long getElementId()
93 {
94 return elementId;
95 }
96
97 public Transaction getTransaction()
98 {
99 return getOuterTransaction();
100 }
101
102 public String getElementName()
103 {
104 return elementName;
105 }
106
107 @Override
108 public String toString()
109 {
110 return String.format( "Version: %s (%d) %s (%s) anc=%s", elementName, elementId, virtualSpec, realSpec,
111 ancestorSpec );
112 }
113
114 }
115
116 private Collection<Version> versions = new HashSet<Version>();
117
118 private long id;
119
120 public Transaction( Long id, Date when, String tranType, String user )
121 {
122 this.id = id;
123 this.tranType = tranType;
124 this.when = when;
125 this.author = user;
126 }
127
128 public long getId()
129 {
130 return id;
131 }
132
133 public String getTranType()
134 {
135 return tranType;
136 }
137
138 public String getComment()
139 {
140 return comment;
141 }
142
143 public void setComment( String comment )
144 {
145 this.comment = comment;
146 }
147
148 private Date when;
149
150 private String tranType;
151
152 private String author;
153
154 private String comment;
155
156 public long getTranId()
157 {
158 return id;
159 }
160
161 private Transaction getOuterTransaction()
162 {
163 return this;
164 }
165
166 public Collection<Version> getVersions()
167 {
168 return versions;
169 }
170
171 public Date getWhen()
172 {
173 return when;
174 }
175
176 public String getType()
177 {
178 return tranType;
179 }
180
181 public String getAuthor()
182 {
183 return author;
184 }
185
186 public void addVersion( Long id, String name, String virtualSpec, String realSpec, String ancestor )
187 {
188 Transaction.Version v = new Version( id, name, virtualSpec, realSpec, ancestor );
189 versions.add( v );
190
191 }
192
193 public String toString()
194 {
195 return String.format( "Transaction: %d, %s at %tc by %s -'%s'", this.getId(), this.getTranType(),
196 this.getWhen(), this.getAuthor(), this.getComment() );
197 }
198 }