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 public void setStartDate( Date startDate )
68 throws ScmException
69 {
70 parameters.setDate( CommandParameter.START_DATE, startDate );
71 }
72
73 public Date getEndDate()
74 throws ScmException
75 {
76 return parameters.getDate( CommandParameter.END_DATE );
77 }
78
79
80
81
82 public void setEndDate( Date endDate )
83 throws ScmException
84 {
85 parameters.setDate( CommandParameter.END_DATE, endDate );
86 }
87
88 public int getNumDays()
89 throws ScmException
90 {
91 return parameters.getInt( CommandParameter.START_DATE );
92 }
93
94
95
96
97 public void setNumDays( int numDays )
98 throws ScmException
99 {
100 parameters.setInt( CommandParameter.NUM_DAYS, numDays );
101 }
102
103 public ScmVersion getStartRevision()
104 throws ScmException
105 {
106 return parameters.getScmVersion( CommandParameter.START_SCM_VERSION, null );
107 }
108
109
110
111
112 public void setStartRevision( ScmVersion startRevision )
113 throws ScmException
114 {
115 parameters.setScmVersion( CommandParameter.START_SCM_VERSION, startRevision );
116 }
117
118 public ScmVersion getEndRevision()
119 throws ScmException
120 {
121 return parameters.getScmVersion( CommandParameter.END_SCM_VERSION, null );
122 }
123
124
125
126
127 public void setEndRevision( ScmVersion endRevision )
128 throws ScmException
129 {
130 parameters.setScmVersion( CommandParameter.END_SCM_VERSION, endRevision );
131 }
132
133 public String getDatePattern()
134 throws ScmException
135 {
136 return parameters.getString( CommandParameter.CHANGELOG_DATE_PATTERN, null );
137 }
138
139
140
141
142 public void setDatePattern( String datePattern )
143 throws ScmException
144 {
145 parameters.setString( CommandParameter.CHANGELOG_DATE_PATTERN, datePattern );
146 }
147
148 public Integer getLimit()
149 throws ScmException
150 {
151 final int limit = parameters.getInt( CommandParameter.LIMIT, -1 );
152 return limit > 0 ? limit : null;
153 }
154
155
156
157
158 public void setLimit( Integer limit )
159 throws ScmException
160 {
161 if ( limit != null )
162 {
163 parameters.setInt( CommandParameter.LIMIT, limit );
164 }
165 else
166 {
167 parameters.remove( CommandParameter.LIMIT );
168 }
169 }
170
171 public void setDateRange( Date startDate, Date endDate )
172 throws ScmException
173 {
174 setStartDate( startDate );
175 setEndDate( endDate );
176 }
177
178 }