summaryrefslogtreecommitdiffstats
path: root/archiva-base
diff options
context:
space:
mode:
authorJoakim Erdfelt <joakime@apache.org>2007-10-23 00:12:47 +0000
committerJoakim Erdfelt <joakime@apache.org>2007-10-23 00:12:47 +0000
commitb4c36626c52186d00f669c80bb7f22c2be330cfe (patch)
tree88d56f819b7a374118fbb57e3632b3faeb936242 /archiva-base
parent2e968e0e085d0f7866a5c9abe6f945dd4a96156e (diff)
downloadarchiva-b4c36626c52186d00f669c80bb7f22c2be330cfe.tar.gz
archiva-b4c36626c52186d00f669c80bb7f22c2be330cfe.zip
Adding a few more .toKey() methods to aide in logging statements elsewhere.
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@587310 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-base')
-rw-r--r--archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/Keys.java35
1 files changed, 35 insertions, 0 deletions
diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/Keys.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/Keys.java
index f08dde63e..b89aec6d9 100644
--- a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/Keys.java
+++ b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/Keys.java
@@ -19,6 +19,7 @@ package org.apache.maven.archiva.model;
* under the License.
*/
+import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.model.ArchivaProjectModel;
/**
@@ -34,6 +35,29 @@ public class Keys
return toKey( model.getGroupId(), model.getArtifactId(), model.getVersion() );
}
+ public static String toKey( ArtifactReference ref )
+ {
+ StringBuffer key = new StringBuffer();
+
+ key.append( ref.getGroupId() ).append( ":" );
+ key.append( ref.getArtifactId() ).append( ":" );
+ key.append( ref.getVersion() ).append( ":" );
+ key.append( StringUtils.defaultString( ref.getClassifier() ) ).append( ":" );
+ key.append( ref.getType() );
+
+ return key.toString();
+ }
+
+ public static String toKey( ProjectReference ref )
+ {
+ StringBuffer key = new StringBuffer();
+
+ key.append( ref.getGroupId() ).append( ":" );
+ key.append( ref.getArtifactId() );
+
+ return key.toString();
+ }
+
public static String toKey( String groupId, String artifactId, String version )
{
StringBuffer key = new StringBuffer();
@@ -44,4 +68,15 @@ public class Keys
return key.toString();
}
+
+ public static String toKey( VersionedReference ref )
+ {
+ StringBuffer key = new StringBuffer();
+
+ key.append( ref.getGroupId() ).append( ":" );
+ key.append( ref.getArtifactId() ).append( ":" );
+ key.append( ref.getVersion() );
+
+ return key.toString();
+ }
}