This project has retired. For details please refer to its Attic page.
TreeEntry xref
View Javadoc
1   package org.apache.archiva.maven2.model;
2   /*
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *   http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing,
14   * software distributed under the License is distributed on an
15   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16   * KIND, either express or implied.  See the License for the
17   * specific language governing permissions and limitations
18   * under the License.
19   */
20  
21  
22  import com.fasterxml.jackson.annotation.JsonIgnore;
23  
24  import javax.xml.bind.annotation.XmlRootElement;
25  import java.io.Serializable;
26  import java.util.ArrayList;
27  import java.util.List;
28  
29  /**
30   * @author Olivier Lamy
31   */
32  @XmlRootElement( name = "treeEntry" )
33  public class TreeEntry
34      implements Serializable
35  {
36  
37      private List<TreeEntry> childs = new ArrayList<>();
38  
39      private Artifact artifact;
40  
41      @JsonIgnore
42      private TreeEntry parent;
43  
44      public TreeEntry()
45      {
46          // no op
47      }
48  
49      public TreeEntry( Artifact artifact )
50      {
51          this.artifact = artifact;
52      }
53  
54  
55      public Artifact getArtifact()
56      {
57          return artifact;
58      }
59  
60      public void setArtifact( Artifact artifact )
61      {
62          this.artifact = artifact;
63      }
64  
65      public List<TreeEntry> getChilds()
66      {
67          return childs;
68      }
69  
70      public void setChilds( List<TreeEntry> childs )
71      {
72          this.childs = childs;
73      }
74  
75      @JsonIgnore
76      public TreeEntry getParent()
77      {
78          return parent;
79      }
80  
81      @JsonIgnore
82      public void setParent( TreeEntry parent )
83      {
84          this.parent = parent;
85      }
86  
87      @Override
88      public boolean equals( Object o )
89      {
90          if ( this == o )
91          {
92              return true;
93          }
94          if ( !( o instanceof TreeEntry ) )
95          {
96              return false;
97          }
98  
99          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 }