aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/metadata
diff options
context:
space:
mode:
authorMartin Stockhammer <martin_s@apache.org>2019-08-27 22:09:09 +0200
committerMartin Stockhammer <martin_s@apache.org>2019-08-27 22:09:09 +0200
commit31fd0d917e6678dc3a39f5cf3b2904ddcae67985 (patch)
tree4b8e09a63f8234f3736ce64fc537a9094d2999e3 /archiva-modules/metadata
parent28ae84d45aad833e2ab5108e45cbf316a2720829 (diff)
downloadarchiva-31fd0d917e6678dc3a39f5cf3b2904ddcae67985.tar.gz
archiva-31fd0d917e6678dc3a39f5cf3b2904ddcae67985.zip
Migrating to primaryTypes and modifying dependencies
Diffstat (limited to 'archiva-modules/metadata')
-rw-r--r--archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/Dependency.java25
-rw-r--r--archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/License.java18
-rw-r--r--archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/MailingList.java18
-rw-r--r--archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java10
4 files changed, 58 insertions, 13 deletions
diff --git a/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/Dependency.java b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/Dependency.java
index 15bcf24a8..e00f51d8a 100644
--- a/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/Dependency.java
+++ b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/Dependency.java
@@ -64,7 +64,12 @@ public class Dependency
/**
* The Maven group ID of the dependency.
*/
- private String groupId;
+ private String namespace;
+
+ /**
+ * The project id
+ */
+ private String projectId;
/**
* The version of the artifact to depend on. If this refers to a project version then the repository implementation
@@ -127,9 +132,9 @@ public class Dependency
this.artifactId = artifactId;
}
- public void setGroupId( String groupId )
+ public void setNamespace(String groupId )
{
- this.groupId = groupId;
+ this.namespace = groupId;
}
public void setVersion( String version )
@@ -147,9 +152,17 @@ public class Dependency
return artifactId;
}
- public String getGroupId()
+ public String getNamespace()
{
- return groupId;
+ return namespace;
+ }
+
+ public String getProjectId() {
+ return projectId;
+ }
+
+ public void setProjectId(String projectId) {
+ this.projectId = projectId;
}
@Override
@@ -163,7 +176,7 @@ public class Dependency
sb.append( ", systemPath='" ).append( systemPath ).append( '\'' );
sb.append( ", type='" ).append( type ).append( '\'' );
sb.append( ", artifactId='" ).append( artifactId ).append( '\'' );
- sb.append( ", groupId='" ).append( groupId ).append( '\'' );
+ sb.append( ", namespace='" ).append(namespace).append( '\'' );
sb.append( ", version='" ).append( version ).append( '\'' );
sb.append( '}' );
return sb.toString();
diff --git a/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/License.java b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/License.java
index 1c9ef6cf7..961bd6efc 100644
--- a/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/License.java
+++ b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/License.java
@@ -27,7 +27,7 @@ import java.io.Serializable;
*/
@XmlRootElement(name = "license")
public class License
- implements Serializable
+ implements Serializable, Comparable<License>
{
/**
* The name of the license.
@@ -39,6 +39,8 @@ public class License
*/
private String url;
+ private Integer index = 0;
+
public License( String name, String url )
{
this.name = name;
@@ -109,4 +111,18 @@ public class License
{
return "License{" + "name='" + name + '\'' + ", url='" + url + '\'' + '}';
}
+
+ public Integer getIndex() {
+ return index;
+ }
+
+ public void setIndex(int index) {
+ this.index = index;
+ }
+
+
+ @Override
+ public int compareTo(License o) {
+ return this.index.compareTo(o.getIndex());
+ }
}
diff --git a/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/MailingList.java b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/MailingList.java
index 0297ebf8b..7a934c3ed 100644
--- a/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/MailingList.java
+++ b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/MailingList.java
@@ -30,8 +30,11 @@ import java.util.List;
*/
@XmlRootElement(name = "mailingList")
public class MailingList
- implements Serializable
+ implements Serializable, Comparable<MailingList>
{
+
+ private Integer index;
+
/**
* The primary archive URL for this mailing list.
*/
@@ -134,4 +137,17 @@ public class MailingList
", unsubscribeAddress='" + unsubscribeAddress + '\'' +
'}';
}
+
+ public Integer getIndex() {
+ return index;
+ }
+
+ public void setIndex(Integer index) {
+ this.index = index;
+ }
+
+ @Override
+ public int compareTo(MailingList o) {
+ return this.index.compareTo(o.getIndex());
+ }
}
diff --git a/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java b/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java
index 48d8cb9ce..65b6b3e1d 100644
--- a/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java
+++ b/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java
@@ -419,7 +419,7 @@ public abstract class AbstractMetadataRepositoryTest
Dependency d = new Dependency( );
d.setArtifactId( "artifactId" );
d.setClassifier( "classifier" );
- d.setGroupId( "groupId" );
+ d.setNamespace( "groupId" );
d.setScope( "scope" );
d.setSystemPath( "system path" );
d.setType( "type" );
@@ -471,7 +471,7 @@ public abstract class AbstractMetadataRepositoryTest
d = metadata.getDependencies( ).get( 0 );
assertEquals( "artifactId", d.getArtifactId( ) );
assertEquals( "classifier", d.getClassifier( ) );
- assertEquals( "groupId", d.getGroupId( ) );
+ assertEquals( "groupId", d.getNamespace( ) );
assertEquals( "scope", d.getScope( ) );
assertEquals( "system path", d.getSystemPath( ) );
assertEquals( "type", d.getType( ) );
@@ -2080,7 +2080,7 @@ public abstract class AbstractMetadataRepositoryTest
Dependency d = new Dependency( );
d.setArtifactId( "artifactId" );
d.setClassifier( "classifier" );
- d.setGroupId( "groupId" );
+ d.setNamespace( "groupId" );
d.setScope( "scope" );
d.setSystemPath( "system path" );
d.setType( "type" );
@@ -2091,7 +2091,7 @@ public abstract class AbstractMetadataRepositoryTest
d = new Dependency( );
d.setArtifactId( "artifactId1" );
d.setClassifier( "classifier" );
- d.setGroupId( "groupId" );
+ d.setNamespace( "groupId" );
d.setScope( "scope" );
d.setSystemPath( "system path" );
d.setType( "type" );
@@ -2110,7 +2110,7 @@ public abstract class AbstractMetadataRepositoryTest
tryAssert( ( ) -> {
Collection<ProjectVersionReference> references =
- getRepository( ).getProjectReferences( session, TEST_REPO_ID, dd.getGroupId( ), dd.getArtifactId( ), dd.getVersion( ) );
+ getRepository( ).getProjectReferences( session, TEST_REPO_ID, dd.getNamespace( ), dd.getArtifactId( ), dd.getVersion( ) );
log.info( "references: {}", references );
assertThat( references ).isNotNull( ).hasSize( 1 ).contains(
new ProjectVersionReference( ProjectVersionReference.ReferenceType.DEPENDENCY, TEST_PROJECT, TEST_NAMESPACE,