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