View Javadoc
1   package org.apache.maven.scm.command.blame;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   * http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.io.Serializable;
23  import java.util.Date;
24  
25  /**
26   * @author Evgeny Mandrikov
27   * @since 1.4
28   */
29  public class BlameLine
30      implements Serializable
31  {
32  
33      private static final long serialVersionUID = 2675122069344705612L;
34  
35      private Date date;
36  
37      private String revision;
38  
39      private String author;
40  
41      private String committer;
42  
43      /**
44       * @param date of the commit
45       * @param revision of the commit
46       * @param author will also be used as committer identification
47       */
48      public BlameLine( Date date, String revision, String author )
49      {
50          this( date, revision, author, author );
51      }
52  
53      /**
54       *
55       * @param date of the commit
56       * @param revision of the commit
57       * @param author the person who wrote the line
58       * @param committer the person who committed the change
59       */
60      public BlameLine( Date date, String revision, String author, String committer )
61      {
62          setDate( date );
63          setRevision( revision );
64          setAuthor( author );
65          setCommitter( committer );
66      }
67  
68      public String getRevision()
69      {
70          return revision;
71      }
72  
73      public void setRevision( String revision )
74      {
75          this.revision = revision;
76      }
77  
78      public String getAuthor()
79      {
80          return author;
81      }
82  
83      public void setAuthor( String author )
84      {
85          this.author = author;
86      }
87  
88      public String getCommitter()
89      {
90          return committer;
91      }
92  
93      public void setCommitter( String committer )
94      {
95          this.committer = committer;
96      }
97  
98      /**
99       * @return the commit date
100      */
101     public Date getDate()
102     {
103         if ( date != null )
104         {
105             return (Date) date.clone();
106         }
107         return null;
108     }
109 
110     public void setDate( Date date )
111     {
112         if ( date != null )
113         {
114             this.date = new Date( date.getTime() );
115         }
116         else
117         {
118             this.date = null;
119         }
120     }
121 }