aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2014-03-25 06:27:50 +0000
committerOlivier Lamy <olamy@apache.org>2014-03-25 06:27:50 +0000
commit91c9d36a7b5aabde1d614b88fa7c42a091e01a12 (patch)
treec1e13aa356fe6e7fee9acf5d8d29c32507009fed
parenta7f93fed1095a51c94aff1888b8be0cb43e7ebe2 (diff)
downloadarchiva-91c9d36a7b5aabde1d614b88fa7c42a091e01a12.tar.gz
archiva-91c9d36a7b5aabde1d614b88fa7c42a091e01a12.zip
simplify code with adding constructors
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1581251 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/CiManagement.java11
-rw-r--r--archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/IssueManagement.java14
-rw-r--r--archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/Organization.java12
-rw-r--r--archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/Scm.java13
-rw-r--r--archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java24
5 files changed, 51 insertions, 23 deletions
diff --git a/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/CiManagement.java b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/CiManagement.java
index 2b3157056..27f87c860 100644
--- a/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/CiManagement.java
+++ b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/CiManagement.java
@@ -42,6 +42,17 @@ public class CiManagement
*/
private String url;
+ public CiManagement()
+ {
+ // no op
+ }
+
+ public CiManagement( String system, String url )
+ {
+ this.system = system;
+ this.url = url;
+ }
+
public String getUrl()
{
return url;
diff --git a/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/IssueManagement.java b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/IssueManagement.java
index c10770e5b..214b1c666 100644
--- a/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/IssueManagement.java
+++ b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/IssueManagement.java
@@ -19,13 +19,12 @@ package org.apache.archiva.metadata.model;
* under the License.
*/
-import javax.persistence.Entity;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
/**
* Information about the issue management system used by the project.
- *
+ * <p/>
* TODO considering moving this to a facet - avoid referring to it externally
*/
@XmlRootElement(name = "issueManagement")
@@ -42,6 +41,17 @@ public class IssueManagement
*/
private String url;
+ public IssueManagement()
+ {
+ // no op
+ }
+
+ public IssueManagement( String system, String url )
+ {
+ this.system = system;
+ this.url = url;
+ }
+
public String getUrl()
{
return url;
diff --git a/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/Organization.java b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/Organization.java
index c8409abe5..932c2f667 100644
--- a/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/Organization.java
+++ b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/Organization.java
@@ -19,7 +19,6 @@ package org.apache.archiva.metadata.model;
* under the License.
*/
-import javax.persistence.Entity;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
@@ -31,6 +30,17 @@ public class Organization
private String url;
+ public Organization()
+ {
+ // no op
+ }
+
+ public Organization( String name, String url )
+ {
+ this.name = name;
+ this.url = url;
+ }
+
public String getUrl()
{
return url;
diff --git a/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/Scm.java b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/Scm.java
index ae950e658..9751d89e0 100644
--- a/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/Scm.java
+++ b/archiva-modules/metadata/metadata-model/src/main/java/org/apache/archiva/metadata/model/Scm.java
@@ -19,7 +19,6 @@ package org.apache.archiva.metadata.model;
* under the License.
*/
-import javax.persistence.Entity;
import javax.xml.bind.annotation.XmlRootElement;
import java.io.Serializable;
@@ -33,6 +32,18 @@ public class Scm
private String url;
+ public Scm()
+ {
+ // no op
+ }
+
+ public Scm( String connection, String developerConnection, String url )
+ {
+ this.connection = connection;
+ this.developerConnection = developerConnection;
+ this.url = url;
+ }
+
public String getUrl()
{
return url;
diff --git a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java
index 5a5747058..d7ba7b117 100644
--- a/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java
+++ b/archiva-modules/plugins/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/cassandra/CassandraMetadataRepository.java
@@ -65,7 +65,6 @@ import org.slf4j.LoggerFactory;
import javax.persistence.PersistenceException;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
@@ -981,10 +980,7 @@ public class CassandraMetadataRepository
if ( StringUtils.isNotEmpty( ciSystem ) || StringUtils.isNotEmpty( ciUrl ) )
{
- CiManagement ci = new CiManagement();
- ci.setSystem( ciSystem );
- ci.setUrl( ciUrl );
- projectVersionMetadata.setCiManagement( ci );
+ projectVersionMetadata.setCiManagement( new CiManagement( ciSystem, ciUrl ) );
}
}
{
@@ -992,10 +988,7 @@ public class CassandraMetadataRepository
String issueSystem = columnFamilyResult.getString( "issueManagement.system" );
if ( StringUtils.isNotEmpty( issueSystem ) || StringUtils.isNotEmpty( issueUrl ) )
{
- IssueManagement issueManagement = new IssueManagement();
- issueManagement.setSystem( issueSystem );
- issueManagement.setUrl( issueUrl );
- projectVersionMetadata.setIssueManagement( issueManagement );
+ projectVersionMetadata.setIssueManagement( new IssueManagement( issueSystem, issueUrl ) );
}
}
{
@@ -1003,23 +996,16 @@ public class CassandraMetadataRepository
String organizationName = columnFamilyResult.getString( "organization.name" );
if ( StringUtils.isNotEmpty( organizationUrl ) || StringUtils.isNotEmpty( organizationName ) )
{
- Organization organization = new Organization();
- organization.setName( organizationName );
- organization.setUrl( organizationUrl );
- projectVersionMetadata.setOrganization( organization );
+ projectVersionMetadata.setOrganization( new Organization( organizationName, organizationUrl ) );
}
}
{
String devConn = columnFamilyResult.getString( "scm.developerConnection" );
String conn = columnFamilyResult.getString( "scm.connection" );
String url = columnFamilyResult.getString( "scm.url" );
- if (StringUtils.isNotEmpty( devConn ) || StringUtils.isNotEmpty( conn ) || StringUtils.isNotEmpty( url ))
+ if ( StringUtils.isNotEmpty( devConn ) || StringUtils.isNotEmpty( conn ) || StringUtils.isNotEmpty( url ) )
{
- Scm scm = new Scm();
- scm.setUrl( url );
- scm.setConnection( conn );
- scm.setDeveloperConnection( devConn );
- projectVersionMetadata.setScm( scm );
+ projectVersionMetadata.setScm( new Scm( conn, devConn, url ) );
}
}
// FIXME complete collections !!