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     * @param date of the commit
051     * @param revision of the commit
052     * @param author the person who wrote the line
053     * @param committer the person who committed the change
054     */
055    public BlameLine(Date date, String revision, String author, String committer) {
056        setDate(date);
057        setRevision(revision);
058        setAuthor(author);
059        setCommitter(committer);
060    }
061
062    public String getRevision() {
063        return revision;
064    }
065
066    public void setRevision(String revision) {
067        this.revision = revision;
068    }
069
070    public String getAuthor() {
071        return author;
072    }
073
074    public void setAuthor(String author) {
075        this.author = author;
076    }
077
078    public String getCommitter() {
079        return committer;
080    }
081
082    public void setCommitter(String committer) {
083        this.committer = committer;
084    }
085
086    /**
087     * @return the commit date
088     */
089    public Date getDate() {
090        if (date != null) {
091            return (Date) date.clone();
092        }
093        return null;
094    }
095
096    public void setDate(Date date) {
097        if (date != null) {
098            this.date = new Date(date.getTime());
099        } else {
100            this.date = null;
101        }
102    }
103}