1 package org.apache.maven.scm.command.changelog;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.scm.CommandParameter;
23 import org.apache.maven.scm.ScmBranch;
24 import org.apache.maven.scm.ScmException;
25 import org.apache.maven.scm.ScmFileSet;
26 import org.apache.maven.scm.ScmRequest;
27 import org.apache.maven.scm.ScmVersion;
28 import org.apache.maven.scm.repository.ScmRepository;
29
30 import java.util.Date;
31
32
33
34
35
36 public class ChangeLogScmRequest
37 extends ScmRequest
38 {
39 private static final long serialVersionUID = 20120620L;
40
41 public ChangeLogScmRequest( ScmRepository scmRepository, ScmFileSet scmFileSet )
42 {
43 super( scmRepository, scmFileSet );
44 }
45
46 public ScmBranch getScmBranch()
47 throws ScmException
48 {
49 return (ScmBranch) parameters.getScmVersion( CommandParameter.BRANCH, null );
50 }
51
52 public void setScmBranch( ScmBranch scmBranch )
53 throws ScmException
54 {
55 parameters.setScmVersion( CommandParameter.BRANCH, scmBranch );
56 }
57
58 public Date getStartDate()
59 throws ScmException
60 {
61 return parameters.getDate( CommandParameter.START_DATE );
62 }
63
64
65
66
67
68 public void setStartDate( Date startDate )
69 throws ScmException
70 {
71 parameters.setDate( CommandParameter.START_DATE, startDate );
72 }
73
74 public Date getEndDate()
75 throws ScmException
76 {
77 return parameters.getDate( CommandParameter.END_DATE );
78 }
79
80
81
82
83
84 public void setEndDate( Date endDate )
85 throws ScmException
86 {
87 parameters.setDate( CommandParameter.END_DATE, endDate );
88 }
89
90 public int getNumDays()
91 throws ScmException
92 {
93 return parameters.getInt( CommandParameter.START_DATE );
94 }
95
96
97
98
99
100 public void setNumDays( int numDays )
101 throws ScmException
102 {
103 parameters.setInt( CommandParameter.NUM_DAYS, numDays );
104 }
105
106 public ScmVersion getStartRevision()
107 throws ScmException
108 {
109 return parameters.getScmVersion( CommandParameter.START_SCM_VERSION, null );
110 }
111
112
113
114
115
116 public void setStartRevision( ScmVersion startRevision )
117 throws ScmException
118 {
119 parameters.setScmVersion( CommandParameter.START_SCM_VERSION, startRevision );
120 }
121
122 public ScmVersion getEndRevision()
123 throws ScmException
124 {
125 return parameters.getScmVersion( CommandParameter.END_SCM_VERSION, null );
126 }
127
128
129
130
131
132 public void setEndRevision( ScmVersion endRevision )
133 throws ScmException
134 {
135 parameters.setScmVersion( CommandParameter.END_SCM_VERSION, endRevision );
136 }
137
138 public String getDatePattern()
139 throws ScmException
140 {
141 return parameters.getString( CommandParameter.CHANGELOG_DATE_PATTERN, null );
142 }
143
144
145
146
147
148 public void setDatePattern( String datePattern )
149 throws ScmException
150 {
151 parameters.setString( CommandParameter.CHANGELOG_DATE_PATTERN, datePattern );
152 }
153
154 public Integer getLimit()
155 throws ScmException
156 {
157 final int limit = parameters.getInt( CommandParameter.LIMIT, -1 );
158 return limit > 0 ? limit : null;
159 }
160
161
162
163
164
165 public void setLimit( Integer limit )
166 throws ScmException
167 {
168 if ( limit != null )
169 {
170 parameters.setInt( CommandParameter.LIMIT, limit );
171 }
172 else
173 {
174 parameters.remove( CommandParameter.LIMIT );
175 }
176 }
177
178 public void setDateRange( Date startDate, Date endDate )
179 throws ScmException
180 {
181 setStartDate( startDate );
182 setEndDate( endDate );
183 }
184
185 public void setRevision( ScmVersion revision )
186 throws ScmException
187 {
188 parameters.setScmVersion( CommandParameter.SCM_VERSION, revision );
189 }
190
191 public ScmVersion getRevision()
192 throws ScmException
193 {
194 return parameters.getScmVersion( CommandParameter.SCM_VERSION, null );
195 }
196 }