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