001    package org.apache.archiva.rest.api.model;
002    /*
003     * Licensed to the Apache Software Foundation (ASF) under one
004     * or more contributor license agreements.  See the NOTICE file
005     * distributed with this work for additional information
006     * regarding copyright ownership.  The ASF licenses this file
007     * to you under the Apache License, Version 2.0 (the
008     * "License"); you may not use this file except in compliance
009     * with the License.  You may obtain a copy of the License at
010     *
011     *   http://www.apache.org/licenses/LICENSE-2.0
012     *
013     * Unless required by applicable law or agreed to in writing,
014     * software distributed under the License is distributed on an
015     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016     * KIND, either express or implied.  See the License for the
017     * specific language governing permissions and limitations
018     * under the License.
019     */
020    
021    import javax.xml.bind.annotation.XmlRootElement;
022    import java.io.Serializable;
023    
024    /**
025     * @author Olivier Lamy
026     * @since 1.4-M3
027     */
028    @XmlRootElement( name = "artifactContentEntry" )
029    public class ArtifactContentEntry
030        implements Serializable
031    {
032        private String path;
033    
034        private boolean file;
035    
036        private int depth;
037    
038        private String repositoryId;
039    
040        public ArtifactContentEntry()
041        {
042            // no op
043        }
044    
045    
046        public ArtifactContentEntry( String path, boolean file, int depth, String repositoryId )
047        {
048    
049            this.path = path;
050            this.file = file;
051            this.depth = depth;
052            this.repositoryId = repositoryId;
053        }
054    
055        public String getPath()
056        {
057            return path;
058        }
059    
060        public void setPath( String path )
061        {
062            this.path = path;
063        }
064    
065        public boolean isFile()
066        {
067            return file;
068        }
069    
070        public void setFile( boolean file )
071        {
072            this.file = file;
073        }
074    
075        public int getDepth()
076        {
077            return depth;
078        }
079    
080        public void setDepth( int depth )
081        {
082            this.depth = depth;
083        }
084    
085        public String getRepositoryId()
086        {
087            return repositoryId;
088        }
089    
090        public void setRepositoryId( String repositoryId )
091        {
092            this.repositoryId = repositoryId;
093        }
094    
095    
096        @Override
097        public boolean equals( Object o )
098        {
099            if ( this == o )
100            {
101                return true;
102            }
103            if ( !( o instanceof ArtifactContentEntry ) )
104            {
105                return false;
106            }
107    
108            ArtifactContentEntry that = (ArtifactContentEntry) o;
109    
110            if ( depth != that.depth )
111            {
112                return false;
113            }
114            if ( file != that.file )
115            {
116                return false;
117            }
118            if ( !path.equals( that.path ) )
119            {
120                return false;
121            }
122            if ( !repositoryId.equals( that.repositoryId ) )
123            {
124                return false;
125            }
126    
127            return true;
128        }
129    
130        @Override
131        public int hashCode()
132        {
133            int result = path.hashCode();
134            result = 31 * result + ( file ? 1 : 0 );
135            result = 31 * result + depth;
136            result = 31 * result + repositoryId.hashCode();
137            return result;
138        }
139    
140    
141        @Override
142        public String toString()
143        {
144            final StringBuilder sb = new StringBuilder();
145            sb.append( "ArtifactContentEntry" );
146            sb.append( "{path='" ).append( path ).append( '\'' );
147            sb.append( ", file=" ).append( file );
148            sb.append( ", depth=" ).append( depth );
149            sb.append( ", repositoryId='" ).append( repositoryId ).append( '\'' );
150            sb.append( '}' );
151            return sb.toString();
152        }
153    }