You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TreeEntry.java 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. import com.fasterxml.jackson.annotation.JsonIgnore;
  21. import javax.xml.bind.annotation.XmlRootElement;
  22. import java.io.Serializable;
  23. import java.util.ArrayList;
  24. import java.util.List;
  25. /**
  26. * @author Olivier Lamy
  27. */
  28. @XmlRootElement( name = "treeEntry" )
  29. public class TreeEntry
  30. implements Serializable
  31. {
  32. private List<TreeEntry> childs = new ArrayList<>();
  33. private Artifact artifact;
  34. @JsonIgnore
  35. private TreeEntry parent;
  36. public TreeEntry()
  37. {
  38. // no op
  39. }
  40. public TreeEntry( Artifact artifact )
  41. {
  42. this.artifact = artifact;
  43. }
  44. public Artifact getArtifact()
  45. {
  46. return artifact;
  47. }
  48. public void setArtifact( Artifact artifact )
  49. {
  50. this.artifact = artifact;
  51. }
  52. public List<TreeEntry> getChilds()
  53. {
  54. return childs;
  55. }
  56. public void setChilds( List<TreeEntry> childs )
  57. {
  58. this.childs = childs;
  59. }
  60. @JsonIgnore
  61. public TreeEntry getParent()
  62. {
  63. return parent;
  64. }
  65. @JsonIgnore
  66. public void setParent( TreeEntry parent )
  67. {
  68. this.parent = parent;
  69. }
  70. @Override
  71. public boolean equals( Object o )
  72. {
  73. if ( this == o )
  74. {
  75. return true;
  76. }
  77. if ( !( o instanceof TreeEntry ) )
  78. {
  79. return false;
  80. }
  81. TreeEntry treeEntry = (TreeEntry) o;
  82. if ( artifact != null ? !artifact.equals( treeEntry.artifact ) : treeEntry.artifact != null )
  83. {
  84. return false;
  85. }
  86. return true;
  87. }
  88. @Override
  89. public int hashCode()
  90. {
  91. return artifact != null ? artifact.hashCode() : 0;
  92. }
  93. }