This project has retired. For details please refer to its Attic page.
Source code
001package org.apache.archiva.maven2.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
022import com.fasterxml.jackson.annotation.JsonIgnore;
023
024import javax.xml.bind.annotation.XmlRootElement;
025import java.io.Serializable;
026import java.util.ArrayList;
027import java.util.List;
028
029/**
030 * @author Olivier Lamy
031 */
032@XmlRootElement( name = "treeEntry" )
033public class TreeEntry
034    implements Serializable
035{
036
037    private List<TreeEntry> childs = new ArrayList<>();
038
039    private Artifact artifact;
040
041    @JsonIgnore
042    private TreeEntry parent;
043
044    public TreeEntry()
045    {
046        // no op
047    }
048
049    public TreeEntry( Artifact artifact )
050    {
051        this.artifact = artifact;
052    }
053
054
055    public Artifact getArtifact()
056    {
057        return artifact;
058    }
059
060    public void setArtifact( Artifact artifact )
061    {
062        this.artifact = artifact;
063    }
064
065    public List<TreeEntry> getChilds()
066    {
067        return childs;
068    }
069
070    public void setChilds( List<TreeEntry> childs )
071    {
072        this.childs = childs;
073    }
074
075    @JsonIgnore
076    public TreeEntry getParent()
077    {
078        return parent;
079    }
080
081    @JsonIgnore
082    public void setParent( TreeEntry parent )
083    {
084        this.parent = parent;
085    }
086
087    @Override
088    public boolean equals( Object o )
089    {
090        if ( this == o )
091        {
092            return true;
093        }
094        if ( !( o instanceof TreeEntry ) )
095        {
096            return false;
097        }
098
099        TreeEntry treeEntry = (TreeEntry) o;
100
101        if ( artifact != null ? !artifact.equals( treeEntry.artifact ) : treeEntry.artifact != null )
102        {
103            return false;
104        }
105
106        return true;
107    }
108
109    @Override
110    public int hashCode()
111    {
112        return artifact != null ? artifact.hashCode() : 0;
113    }
114}