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