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.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. package org.apache.archiva.maven.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. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. import javax.xml.bind.annotation.XmlRootElement;
  20. import javax.xml.bind.annotation.XmlTransient;
  21. import java.io.Serializable;
  22. import java.util.ArrayList;
  23. import java.util.List;
  24. /**
  25. * @author Olivier Lamy
  26. */
  27. @XmlRootElement( name = "treeEntry" )
  28. public class TreeEntry
  29. implements Serializable
  30. {
  31. private List<TreeEntry> childs = new ArrayList<>();
  32. private Artifact artifact;
  33. private TreeEntry parent;
  34. public TreeEntry()
  35. {
  36. // no op
  37. }
  38. public TreeEntry( Artifact artifact )
  39. {
  40. this.artifact = artifact;
  41. }
  42. public Artifact getArtifact()
  43. {
  44. return artifact;
  45. }
  46. public void setArtifact( Artifact artifact )
  47. {
  48. this.artifact = artifact;
  49. }
  50. public List<TreeEntry> getChilds()
  51. {
  52. return childs;
  53. }
  54. public void setChilds( List<TreeEntry> childs )
  55. {
  56. this.childs = childs;
  57. }
  58. @XmlTransient
  59. public TreeEntry getParent()
  60. {
  61. return parent;
  62. }
  63. public void setParent( TreeEntry parent )
  64. {
  65. this.parent = parent;
  66. }
  67. @Override
  68. public boolean equals( Object o )
  69. {
  70. if ( this == o )
  71. {
  72. return true;
  73. }
  74. if ( !( o instanceof TreeEntry ) )
  75. {
  76. return false;
  77. }
  78. TreeEntry treeEntry = (TreeEntry) o;
  79. if ( artifact != null ? !artifact.equals( treeEntry.artifact ) : treeEntry.artifact != null )
  80. {
  81. return false;
  82. }
  83. return true;
  84. }
  85. @Override
  86. public int hashCode()
  87. {
  88. return artifact != null ? artifact.hashCode() : 0;
  89. }
  90. }