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