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.

VersionedReference.java 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. package org.apache.archiva.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. * A reference to another Versioned Project.
  22. *
  23. * @version $Revision$ $Date$
  24. */
  25. @SuppressWarnings( "all" )
  26. public class VersionedReference
  27. implements java.io.Serializable
  28. {
  29. //--------------------------/
  30. //- Class/Member Variables -/
  31. //--------------------------/
  32. /**
  33. *
  34. * The Group ID of the repository content.
  35. *
  36. */
  37. private String groupId;
  38. /**
  39. *
  40. * The Artifact ID of the repository content.
  41. *
  42. */
  43. private String artifactId;
  44. /**
  45. *
  46. * The version of the repository content.
  47. *
  48. */
  49. private String version;
  50. //-----------/
  51. //- Methods -/
  52. //-----------/
  53. /**
  54. * Get the Artifact ID of the repository content.
  55. *
  56. * @return String
  57. */
  58. public String getArtifactId()
  59. {
  60. return this.artifactId;
  61. } //-- String getArtifactId()
  62. /**
  63. * Get the Group ID of the repository content.
  64. *
  65. * @return String
  66. */
  67. public String getGroupId()
  68. {
  69. return this.groupId;
  70. } //-- String getGroupId()
  71. /**
  72. * Get the version of the repository content.
  73. *
  74. * @return String
  75. */
  76. public String getVersion()
  77. {
  78. return this.version;
  79. } //-- String getVersion()
  80. /**
  81. * Set the Artifact ID of the repository content.
  82. *
  83. * @param artifactId
  84. */
  85. public void setArtifactId( String artifactId )
  86. {
  87. this.artifactId = artifactId;
  88. } //-- void setArtifactId( String )
  89. /**
  90. * Set the Group ID of the repository content.
  91. *
  92. * @param groupId
  93. */
  94. public void setGroupId( String groupId )
  95. {
  96. this.groupId = groupId;
  97. } //-- void setGroupId( String )
  98. /**
  99. * Set the version of the repository content.
  100. *
  101. * @param version
  102. */
  103. public void setVersion( String version )
  104. {
  105. this.version = version;
  106. } //-- void setVersion( String )
  107. private static final long serialVersionUID = -6990353165677563113L;
  108. private static String defaultString( String value )
  109. {
  110. if ( value == null )
  111. {
  112. return "";
  113. }
  114. return value.trim();
  115. }
  116. public static String toKey( VersionedReference reference )
  117. {
  118. StringBuilder key = new StringBuilder();
  119. key.append( defaultString( reference.getGroupId() ) ).append( ":" );
  120. key.append( defaultString( reference.getArtifactId() ) ).append( ":" );
  121. key.append( defaultString( reference.getVersion() ) );
  122. return key.toString();
  123. }
  124. }