001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.maven.scm.command.blame; 020 021import java.io.Serializable; 022import java.util.Date; 023 024/** 025 * @author Evgeny Mandrikov 026 * @since 1.4 027 */ 028public class BlameLine implements Serializable { 029 030 private static final long serialVersionUID = 2675122069344705612L; 031 032 private Date date; 033 034 private String revision; 035 036 private String author; 037 038 private String committer; 039 040 /** 041 * @param date of the commit 042 * @param revision of the commit 043 * @param author will also be used as committer identification 044 */ 045 public BlameLine(Date date, String revision, String author) { 046 this(date, revision, author, author); 047 } 048 049 /** 050 * 051 * @param date of the commit 052 * @param revision of the commit 053 * @param author the person who wrote the line 054 * @param committer the person who committed the change 055 */ 056 public BlameLine(Date date, String revision, String author, String committer) { 057 setDate(date); 058 setRevision(revision); 059 setAuthor(author); 060 setCommitter(committer); 061 } 062 063 public String getRevision() { 064 return revision; 065 } 066 067 public void setRevision(String revision) { 068 this.revision = revision; 069 } 070 071 public String getAuthor() { 072 return author; 073 } 074 075 public void setAuthor(String author) { 076 this.author = author; 077 } 078 079 public String getCommitter() { 080 return committer; 081 } 082 083 public void setCommitter(String committer) { 084 this.committer = committer; 085 } 086 087 /** 088 * @return the commit date 089 */ 090 public Date getDate() { 091 if (date != null) { 092 return (Date) date.clone(); 093 } 094 return null; 095 } 096 097 public void setDate(Date date) { 098 if (date != null) { 099 this.date = new Date(date.getTime()); 100 } else { 101 this.date = null; 102 } 103 } 104}