001package org.apache.maven.scm.provider.accurev;
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.util.Date;
023
024/**
025 * 
026 */
027public class Stream
028{
029
030    private String name;
031
032    private long id;
033
034    private String basis;
035
036    private long basisId;
037
038    private String depot;
039
040    private Date startDate;
041
042    private String streamType;
043
044    public Stream( String name, long id, String basis, long basisId, String depot, Date startDate, String streamType )
045    {
046        this.name = name;
047        this.id = id;
048        this.basis = basis;
049        this.basisId = basisId;
050        this.depot = depot;
051        this.startDate = startDate;
052        this.streamType = streamType;
053    }
054
055    @Override
056    public int hashCode()
057    {
058        final int prime = 31;
059        int result = 1;
060        result = prime * result + ( ( basis == null ) ? 0 : basis.hashCode() );
061        result = prime * result + (int) ( basisId ^ ( basisId >>> 32 ) );
062        result = prime * result + ( ( depot == null ) ? 0 : depot.hashCode() );
063        result = prime * result + (int) ( id ^ ( id >>> 32 ) );
064        result = prime * result + ( ( name == null ) ? 0 : name.hashCode() );
065        result = prime * result + ( ( startDate == null ) ? 0 : startDate.hashCode() );
066        result = prime * result + ( ( streamType == null ) ? 0 : streamType.hashCode() );
067        return result;
068    }
069
070    @Override
071    public boolean equals( Object obj )
072    {
073        if ( this == obj )
074        {
075            return true;
076        }
077        if ( obj == null )
078        {
079            return false;
080        }
081        if ( getClass() != obj.getClass() )
082        {
083            return false;
084        }
085        Stream other = (Stream) obj;
086        if ( basis == null )
087        {
088            if ( other.basis != null )
089            {
090                return false;
091            }
092        }
093        else if ( !basis.equals( other.basis ) )
094        {
095            return false;
096        }
097        if ( basisId != other.basisId )
098        {
099            return false;
100        }
101        if ( depot == null )
102        {
103            if ( other.depot != null )
104            {
105                return false;
106            }
107        }
108        else if ( !depot.equals( other.depot ) )
109        {
110            return false;
111        }
112        if ( id != other.id )
113        {
114            return false;
115        }
116        if ( name == null )
117        {
118            if ( other.name != null )
119            {
120                return false;
121            }
122        }
123        else if ( !name.equals( other.name ) )
124        {
125            return false;
126        }
127        if ( startDate == null )
128        {
129            if ( other.startDate != null )
130            {
131                return false;
132            }
133        }
134        else if ( !startDate.equals( other.startDate ) )
135        {
136            return false;
137        }
138        if ( streamType == null )
139        {
140            if ( other.streamType != null )
141            {
142                return false;
143            }
144        }
145        else if ( !streamType.equals( other.streamType ) )
146        {
147            return false;
148        }
149        return true;
150    }
151
152    public String getName()
153    {
154        return name;
155    }
156
157    public long getId()
158    {
159        return id;
160    }
161
162    public String getBasis()
163    {
164        return basis;
165    }
166
167    public long getBasisId()
168    {
169        return basisId;
170    }
171
172    public String getDepot()
173    {
174        return depot;
175    }
176
177    public Date getStartDate()
178    {
179        return startDate;
180    }
181
182    public String getStreamType()
183    {
184        return streamType;
185    }
186
187    public Boolean isWorkspace()
188    {
189        return "workspace".equals( streamType );
190    }
191
192}