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