mirror of https://github.com/apache/archiva.git
Correcting primary-key handling of compound keys in jpox by flatting out sub-objects in primary-key.
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches/archiva-jpox-database-refactor@525672 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
48185a913b
commit
7e5d667be3
|
@ -78,8 +78,10 @@
|
||||||
<goal>xsd</goal>
|
<goal>xsd</goal>
|
||||||
<goal>jpox-jdo-mapping</goal>
|
<goal>jpox-jdo-mapping</goal>
|
||||||
<goal>jpox-metadata-class</goal>
|
<goal>jpox-metadata-class</goal>
|
||||||
|
<!--
|
||||||
<goal>xpp3-writer</goal>
|
<goal>xpp3-writer</goal>
|
||||||
<goal>xpp3-reader</goal>
|
<goal>xpp3-reader</goal>
|
||||||
|
-->
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
|
|
|
@ -0,0 +1,236 @@
|
||||||
|
package org.apache.maven.archiva.model;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* AbstractArtifactKey - a artifact reference to a versioned project.
|
||||||
|
* This refers to all artifacts of a specific version of a project.
|
||||||
|
* This type of reference is typically used by {@link ArchivaProjectModel} objects.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* If you don't require things like "Version" or "Type", consider the other keys below.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <table border="1" cellpadding="3">
|
||||||
|
* <tr>
|
||||||
|
* <th>Key Type</th>
|
||||||
|
* <th>Group ID</th>
|
||||||
|
* <th>Artifact ID</th>
|
||||||
|
* <th>Version</th>
|
||||||
|
* <th>Classifier</th>
|
||||||
|
* <th>Type</th>
|
||||||
|
* </tr>
|
||||||
|
* <tr>
|
||||||
|
* <td>{@link AbstractProjectKey}</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* <td> </td>
|
||||||
|
* <td> </td>
|
||||||
|
* <td> </td>
|
||||||
|
* </tr>
|
||||||
|
* <tr>
|
||||||
|
* <td>{@link AbstractVersionedKey}</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* <td> </td>
|
||||||
|
* <td> </td>
|
||||||
|
* </tr>
|
||||||
|
* <tr>
|
||||||
|
* <td>{@link AbstractArtifactKey}</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* </tr>
|
||||||
|
* </table>
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* NOTE: This is a jpox required compound key handler class.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class AbstractArtifactKey implements Serializable
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The Group ID. (JPOX Requires this remain public)
|
||||||
|
*/
|
||||||
|
public String groupId = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Artifact ID. (JPOX Requires this remain public)
|
||||||
|
*/
|
||||||
|
public String artifactId = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Version. (JPOX Requires this remain public)
|
||||||
|
*/
|
||||||
|
public String version = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Classifier. (JPOX Requires this remain public)
|
||||||
|
*/
|
||||||
|
public String classifier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Type. (JPOX Requires this remain public)
|
||||||
|
*/
|
||||||
|
public String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default Constructor. Required by JPOX.
|
||||||
|
*/
|
||||||
|
public AbstractArtifactKey()
|
||||||
|
{
|
||||||
|
/* do nothing */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Key Based Constructor. Required by JPOX.
|
||||||
|
*
|
||||||
|
* @param key the String representing this object's values.
|
||||||
|
*/
|
||||||
|
public AbstractArtifactKey( String key )
|
||||||
|
{
|
||||||
|
String parts[] = StringUtils.splitPreserveAllTokens( key, ":" );
|
||||||
|
groupId = parts[1];
|
||||||
|
artifactId = parts[2];
|
||||||
|
version = parts[3];
|
||||||
|
classifier = parts[4];
|
||||||
|
type = parts[5];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the String representation of this object. - Required by JPOX.
|
||||||
|
*/
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return StringUtils.join( new String[] { groupId, artifactId, version, classifier, type } );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the hashcode for this object's values - Required by JPOX.
|
||||||
|
*/
|
||||||
|
public int hashCode()
|
||||||
|
{
|
||||||
|
final int PRIME = 31;
|
||||||
|
int result = super.hashCode();
|
||||||
|
result = PRIME * result + ( ( groupId == null ) ? 0 : groupId.hashCode() );
|
||||||
|
result = PRIME * result + ( ( artifactId == null ) ? 0 : artifactId.hashCode() );
|
||||||
|
result = PRIME * result + ( ( version == null ) ? 0 : version.hashCode() );
|
||||||
|
result = PRIME * result + ( ( classifier == null ) ? 0 : classifier.hashCode() );
|
||||||
|
result = PRIME * result + ( ( type == null ) ? 0 : type.hashCode() );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the equals for this object's values - Required by JPOX.
|
||||||
|
*/
|
||||||
|
public boolean equals( Object obj )
|
||||||
|
{
|
||||||
|
if ( this == obj )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !super.equals( obj ) )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( getClass() != obj.getClass() )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
final AbstractArtifactKey other = (AbstractArtifactKey) obj;
|
||||||
|
|
||||||
|
if ( groupId == null )
|
||||||
|
{
|
||||||
|
if ( other.groupId != null )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( !groupId.equals( other.groupId ) )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( artifactId == null )
|
||||||
|
{
|
||||||
|
if ( other.artifactId != null )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( !artifactId.equals( other.artifactId ) )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( version == null )
|
||||||
|
{
|
||||||
|
if ( other.version != null )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( !version.equals( other.version ) )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( classifier == null )
|
||||||
|
{
|
||||||
|
if ( other.classifier != null )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( !classifier.equals( other.classifier ) )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( type == null )
|
||||||
|
{
|
||||||
|
if ( other.type != null )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( !type.equals( other.type ) )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,180 @@
|
||||||
|
package org.apache.maven.archiva.model;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* AbstractProjectKey - A versionless reference to a Project.
|
||||||
|
* This refers to all versions, and all artifacts of a project.
|
||||||
|
* This type of reference is typically used by {@link ArchivaRepositoryMetadata} objects.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* If you require things like "Version" or "Type", consider the other keys below.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <table border="1" cellpadding="3">
|
||||||
|
* <tr>
|
||||||
|
* <th>Key Type</th>
|
||||||
|
* <th>Group ID</th>
|
||||||
|
* <th>Artifact ID</th>
|
||||||
|
* <th>Version</th>
|
||||||
|
* <th>Classifier</th>
|
||||||
|
* <th>Type</th>
|
||||||
|
* </tr>
|
||||||
|
* <tr>
|
||||||
|
* <td>{@link AbstractProjectKey}</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* <td> </td>
|
||||||
|
* <td> </td>
|
||||||
|
* <td> </td>
|
||||||
|
* </tr>
|
||||||
|
* <tr>
|
||||||
|
* <td>{@link AbstractVersionedKey}</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* <td> </td>
|
||||||
|
* <td> </td>
|
||||||
|
* </tr>
|
||||||
|
* <tr>
|
||||||
|
* <td>{@link AbstractArtifactKey}</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* </tr>
|
||||||
|
* </table>
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* NOTE: This is a jpox required compound key handler class.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class AbstractProjectKey
|
||||||
|
implements Serializable
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The Group ID. (JPOX Requires this remain public)
|
||||||
|
*/
|
||||||
|
public String groupId = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Artifact ID. (JPOX Requires this remain public)
|
||||||
|
*/
|
||||||
|
public String artifactId = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default Constructor. Required by JPOX.
|
||||||
|
*/
|
||||||
|
public AbstractProjectKey()
|
||||||
|
{
|
||||||
|
/* do nothing */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Key Based Constructor. Required by JPOX.
|
||||||
|
*
|
||||||
|
* @param key the String representing this object's values.
|
||||||
|
*/
|
||||||
|
public AbstractProjectKey( String key )
|
||||||
|
{
|
||||||
|
String parts[] = StringUtils.splitPreserveAllTokens( key, ":" );
|
||||||
|
groupId = parts[1];
|
||||||
|
artifactId = parts[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the String representation of this object. - Required by JPOX.
|
||||||
|
*/
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return StringUtils.join( new String[] { groupId, artifactId } );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the hashcode for this object's values - Required by JPOX.
|
||||||
|
*/
|
||||||
|
public int hashCode()
|
||||||
|
{
|
||||||
|
final int PRIME = 31;
|
||||||
|
int result = super.hashCode();
|
||||||
|
result = PRIME * result + ( ( groupId == null ) ? 0 : groupId.hashCode() );
|
||||||
|
result = PRIME * result + ( ( artifactId == null ) ? 0 : artifactId.hashCode() );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the equals for this object's values - Required by JPOX.
|
||||||
|
*/
|
||||||
|
public boolean equals( Object obj )
|
||||||
|
{
|
||||||
|
if ( this == obj )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !super.equals( obj ) )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( getClass() != obj.getClass() )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
final AbstractProjectKey other = (AbstractProjectKey) obj;
|
||||||
|
|
||||||
|
if ( groupId == null )
|
||||||
|
{
|
||||||
|
if ( other.groupId != null )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( !groupId.equals( other.groupId ) )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( artifactId == null )
|
||||||
|
{
|
||||||
|
if ( other.artifactId != null )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( !artifactId.equals( other.artifactId ) )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
|
@ -24,18 +24,60 @@ import org.apache.commons.lang.StringUtils;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RepositoryContentKey - the jpox application key support class for all content within the repository.
|
* <p>
|
||||||
|
* AbstractVersionedKey - a versioned reference to a Project.
|
||||||
|
* This refers to all artifacts of a specific version of a project.
|
||||||
|
* This type of reference is typically used by {@link ArchivaProjectModel} objects.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* If you require things like "Version" or "Type", consider the other keys below.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* <table border="1" cellpadding="3">
|
||||||
|
* <tr>
|
||||||
|
* <th>Key Type</th>
|
||||||
|
* <th>Group ID</th>
|
||||||
|
* <th>Artifact ID</th>
|
||||||
|
* <th>Version</th>
|
||||||
|
* <th>Classifier</th>
|
||||||
|
* <th>Type</th>
|
||||||
|
* </tr>
|
||||||
|
* <tr>
|
||||||
|
* <td>{@link AbstractProjectKey}</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* <td> </td>
|
||||||
|
* <td> </td>
|
||||||
|
* <td> </td>
|
||||||
|
* </tr>
|
||||||
|
* <tr>
|
||||||
|
* <td>{@link AbstractVersionedKey}</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* <td> </td>
|
||||||
|
* <td> </td>
|
||||||
|
* </tr>
|
||||||
|
* <tr>
|
||||||
|
* <td>{@link AbstractArtifactKey}</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* <td align="center">Yes</td>
|
||||||
|
* </tr>
|
||||||
|
* </table>
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* NOTE: This is a jpox required compound key handler class.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class RepositoryContentKey implements Serializable
|
public class AbstractVersionedKey implements Serializable
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* The Repository ID. (JPOX Requires this remain public)
|
|
||||||
*/
|
|
||||||
public String repositoryId = "";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Group ID. (JPOX Requires this remain public)
|
* The Group ID. (JPOX Requires this remain public)
|
||||||
*/
|
*/
|
||||||
|
@ -50,35 +92,34 @@ public class RepositoryContentKey implements Serializable
|
||||||
* The Version. (JPOX Requires this remain public)
|
* The Version. (JPOX Requires this remain public)
|
||||||
*/
|
*/
|
||||||
public String version = "";
|
public String version = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Constructor. Required by JPOX.
|
* Default Constructor. Required by JPOX.
|
||||||
*/
|
*/
|
||||||
public RepositoryContentKey()
|
public AbstractVersionedKey()
|
||||||
{
|
{
|
||||||
|
/* do nothing */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Key Based Constructor. Required by JPOX.
|
* Key Based Constructor. Required by JPOX.
|
||||||
*
|
*
|
||||||
* @param key the String representing this object's values.
|
* @param key the String representing this object's values.
|
||||||
*/
|
*/
|
||||||
public RepositoryContentKey( String key )
|
public AbstractVersionedKey( String key )
|
||||||
{
|
{
|
||||||
String parts[] = StringUtils.splitPreserveAllTokens( key, ':' );
|
String parts[] = StringUtils.splitPreserveAllTokens( key, ":" );
|
||||||
repositoryId = parts[0];
|
|
||||||
groupId = parts[1];
|
groupId = parts[1];
|
||||||
artifactId = parts[2];
|
artifactId = parts[2];
|
||||||
version = parts[3];
|
version = parts[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the String representation of this object. - Required by JPOX.
|
* Get the String representation of this object. - Required by JPOX.
|
||||||
*/
|
*/
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return StringUtils.join( new String[] { repositoryId, groupId, artifactId, version } );
|
return StringUtils.join( new String[] { groupId, artifactId, version } );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -87,8 +128,7 @@ public class RepositoryContentKey implements Serializable
|
||||||
public int hashCode()
|
public int hashCode()
|
||||||
{
|
{
|
||||||
final int PRIME = 31;
|
final int PRIME = 31;
|
||||||
int result = 1;
|
int result = super.hashCode();
|
||||||
result = PRIME * result + ( ( repositoryId == null ) ? 0 : repositoryId.hashCode() );
|
|
||||||
result = PRIME * result + ( ( groupId == null ) ? 0 : groupId.hashCode() );
|
result = PRIME * result + ( ( groupId == null ) ? 0 : groupId.hashCode() );
|
||||||
result = PRIME * result + ( ( artifactId == null ) ? 0 : artifactId.hashCode() );
|
result = PRIME * result + ( ( artifactId == null ) ? 0 : artifactId.hashCode() );
|
||||||
result = PRIME * result + ( ( version == null ) ? 0 : version.hashCode() );
|
result = PRIME * result + ( ( version == null ) ? 0 : version.hashCode() );
|
||||||
|
@ -104,31 +144,19 @@ public class RepositoryContentKey implements Serializable
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( obj == null )
|
if ( !super.equals( obj ) )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( getClass() != obj.getClass() )
|
if ( getClass() != obj.getClass() )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final RepositoryContentKey other = (RepositoryContentKey) obj;
|
final AbstractVersionedKey other = (AbstractVersionedKey) obj;
|
||||||
|
|
||||||
if ( repositoryId == null )
|
|
||||||
{
|
|
||||||
if ( other.repositoryId != null )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ( !repositoryId.equals( other.repositoryId ) )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( groupId == null )
|
if ( groupId == null )
|
||||||
{
|
{
|
||||||
if ( other.groupId != null )
|
if ( other.groupId != null )
|
||||||
|
@ -140,7 +168,7 @@ public class RepositoryContentKey implements Serializable
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( artifactId == null )
|
if ( artifactId == null )
|
||||||
{
|
{
|
||||||
if ( other.artifactId != null )
|
if ( other.artifactId != null )
|
||||||
|
@ -152,7 +180,7 @@ public class RepositoryContentKey implements Serializable
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( version == null )
|
if ( version == null )
|
||||||
{
|
{
|
||||||
if ( other.version != null )
|
if ( other.version != null )
|
||||||
|
@ -164,7 +192,7 @@ public class RepositoryContentKey implements Serializable
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -19,8 +19,8 @@ package org.apache.maven.archiva.model;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.maven.archiva.common.utils.VersionUtil;
|
import org.apache.maven.archiva.common.utils.VersionUtil;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ArchivaArtifact - Mutable artifact object.
|
* ArchivaArtifact - Mutable artifact object.
|
||||||
|
@ -31,7 +31,7 @@ import org.codehaus.plexus.util.StringUtils;
|
||||||
public class ArchivaArtifact
|
public class ArchivaArtifact
|
||||||
{
|
{
|
||||||
private ArchivaArtifactModel model;
|
private ArchivaArtifactModel model;
|
||||||
|
|
||||||
private ArchivaArtifactPlatformDetails platformDetails;
|
private ArchivaArtifactPlatformDetails platformDetails;
|
||||||
|
|
||||||
private String baseVersion;
|
private String baseVersion;
|
||||||
|
@ -68,14 +68,10 @@ public class ArchivaArtifact
|
||||||
|
|
||||||
model = new ArchivaArtifactModel();
|
model = new ArchivaArtifactModel();
|
||||||
|
|
||||||
if ( repository == null )
|
model.setGroupId( groupId );
|
||||||
{
|
model.setArtifactId( artifactId );
|
||||||
model.setContentKey( new RepositoryContent( groupId, artifactId, version ) );
|
model.setVersion( version );
|
||||||
}
|
model.setRepositoryId( repository.getId() );
|
||||||
else
|
|
||||||
{
|
|
||||||
model.setContentKey( new RepositoryContent( repository.getModel(), groupId, artifactId, version ) );
|
|
||||||
}
|
|
||||||
model.setClassifier( StringUtils.defaultString( classifier ) );
|
model.setClassifier( StringUtils.defaultString( classifier ) );
|
||||||
model.setType( type );
|
model.setType( type );
|
||||||
|
|
||||||
|
@ -90,17 +86,17 @@ public class ArchivaArtifact
|
||||||
|
|
||||||
public String getGroupId()
|
public String getGroupId()
|
||||||
{
|
{
|
||||||
return model.getContentKey().getGroupId();
|
return model.getGroupId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getArtifactId()
|
public String getArtifactId()
|
||||||
{
|
{
|
||||||
return model.getContentKey().getArtifactId();
|
return model.getArtifactId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getVersion()
|
public String getVersion()
|
||||||
{
|
{
|
||||||
return model.getContentKey().getVersion();
|
return model.getVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getBaseVersion()
|
public String getBaseVersion()
|
||||||
|
@ -134,15 +130,11 @@ public class ArchivaArtifact
|
||||||
int result = 1;
|
int result = 1;
|
||||||
if ( model != null )
|
if ( model != null )
|
||||||
{
|
{
|
||||||
RepositoryContent key = model.getContentKey();
|
result = PRIME * result + ( ( model.getGroupId() == null ) ? 0 : model.getGroupId().hashCode() );
|
||||||
if ( key != null )
|
result = PRIME * result + ( ( model.getArtifactId() == null ) ? 0 : model.getArtifactId().hashCode() );
|
||||||
{
|
result = PRIME * result + ( ( model.getVersion() == null ) ? 0 : model.getVersion().hashCode() );
|
||||||
result = PRIME * result + ( ( key.getGroupId() == null ) ? 0 : key.getGroupId().hashCode() );
|
result = PRIME * result + ( ( model.getClassifier() == null ) ? 0 : model.getClassifier().hashCode() );
|
||||||
result = PRIME * result + ( ( key.getArtifactId() == null ) ? 0 : key.getArtifactId().hashCode() );
|
result = PRIME * result + ( ( model.getType() == null ) ? 0 : model.getType().hashCode() );
|
||||||
result = PRIME * result + ( ( key.getVersion() == null ) ? 0 : key.getVersion().hashCode() );
|
|
||||||
result = PRIME * result + ( ( model.getClassifier() == null ) ? 0 : model.getClassifier().hashCode() );
|
|
||||||
result = PRIME * result + ( ( model.getType() == null ) ? 0 : model.getType().hashCode() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -173,63 +165,27 @@ public class ArchivaArtifact
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
if ( !model.equals( other.model ) )
|
||||||
{
|
|
||||||
RepositoryContent key = model.getContentKey();
|
|
||||||
RepositoryContent otherkey = other.model.getContentKey();
|
|
||||||
|
|
||||||
if ( key == null )
|
|
||||||
{
|
|
||||||
if ( otherkey != null )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( !equals( key.getGroupId(), otherkey.getGroupId() )
|
|
||||||
|| !equals( key.getArtifactId(), otherkey.getArtifactId() )
|
|
||||||
|| !equals( key.getVersion(), otherkey.getVersion() )
|
|
||||||
|| !equals( model.getClassifier(), other.model.getClassifier() )
|
|
||||||
|| !equals( model.getType(), other.model.getType() ) )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean equals( String left, String right )
|
|
||||||
{
|
|
||||||
if ( left == null )
|
|
||||||
{
|
|
||||||
if ( right != null )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ( !left.equals( right ) )
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
StringBuffer sb = new StringBuffer();
|
StringBuffer sb = new StringBuffer();
|
||||||
if ( model.getContentKey().getGroupId() != null )
|
if ( model.getGroupId() != null )
|
||||||
{
|
{
|
||||||
sb.append( model.getContentKey().getGroupId() );
|
sb.append( model.getGroupId() );
|
||||||
sb.append( ":" );
|
sb.append( ":" );
|
||||||
}
|
}
|
||||||
appendArtifactTypeClassifierString( sb );
|
appendArtifactTypeClassifierString( sb );
|
||||||
sb.append( ":" );
|
sb.append( ":" );
|
||||||
if ( model.getContentKey().getVersion() != null )
|
if ( model.getVersion() != null )
|
||||||
{
|
{
|
||||||
sb.append( model.getContentKey().getVersion() );
|
sb.append( model.getVersion() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
|
@ -237,7 +193,7 @@ public class ArchivaArtifact
|
||||||
|
|
||||||
private void appendArtifactTypeClassifierString( StringBuffer sb )
|
private void appendArtifactTypeClassifierString( StringBuffer sb )
|
||||||
{
|
{
|
||||||
sb.append( model.getContentKey().getArtifactId() );
|
sb.append( model.getArtifactId() );
|
||||||
sb.append( ":" );
|
sb.append( ":" );
|
||||||
sb.append( getType() );
|
sb.append( getType() );
|
||||||
if ( hasClassifier() )
|
if ( hasClassifier() )
|
||||||
|
|
|
@ -0,0 +1,380 @@
|
||||||
|
package org.apache.maven.archiva.model;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility methods for cloning various Archiva Model objects.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class ArchivaModelCloner
|
||||||
|
{
|
||||||
|
public static ArchivaProjectModel clone( ArchivaProjectModel model )
|
||||||
|
{
|
||||||
|
if ( model == null )
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
ArchivaProjectModel cloned = new ArchivaProjectModel();
|
||||||
|
|
||||||
|
cloned.setGroupId( model.getGroupId() );
|
||||||
|
cloned.setArtifactId( model.getArtifactId() );
|
||||||
|
cloned.setVersion( model.getVersion() );
|
||||||
|
|
||||||
|
cloned.setParentProject( clone( model.getParentProject() ) );
|
||||||
|
|
||||||
|
cloned.setName( model.getName() );
|
||||||
|
cloned.setDescription( model.getDescription() );
|
||||||
|
cloned.setUrl( model.getUrl() );
|
||||||
|
cloned.setPackaging( model.getPackaging() );
|
||||||
|
cloned.setOrigin( model.getOrigin() );
|
||||||
|
|
||||||
|
cloned.setCiManagement( clone( model.getCiManagement() ) );
|
||||||
|
cloned.setIndividuals( cloneIndividuals( model.getIndividuals() ) );
|
||||||
|
cloned.setIssueManagement( clone( model.getIssueManagement() ) );
|
||||||
|
cloned.setLicenses( cloneLicenses( model.getLicenses() ) );
|
||||||
|
cloned.setOrganization( clone( model.getOrganization() ) );
|
||||||
|
cloned.setScm( clone( model.getScm() ) );
|
||||||
|
cloned.setRepositories( cloneRepositories( model.getRepositories() ) );
|
||||||
|
cloned.setDependencies( cloneDependencies( model.getDependencies() ) );
|
||||||
|
cloned.setPlugins( clonePlugins( model.getPlugins() ) );
|
||||||
|
cloned.setReports( cloneReports( model.getReports() ) );
|
||||||
|
cloned.setDependencyManagement( cloneDependencies( model.getDependencyManagement() ) );
|
||||||
|
|
||||||
|
return cloned;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ArtifactReference clone( ArtifactReference artifactReference )
|
||||||
|
{
|
||||||
|
if ( artifactReference == null )
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
ArtifactReference cloned = new ArtifactReference();
|
||||||
|
|
||||||
|
cloned.setGroupId( artifactReference.getGroupId() );
|
||||||
|
cloned.setArtifactId( artifactReference.getArtifactId() );
|
||||||
|
cloned.setVersion( artifactReference.getVersion() );
|
||||||
|
cloned.setClassifier( artifactReference.getClassifier() );
|
||||||
|
cloned.setType( artifactReference.getType() );
|
||||||
|
|
||||||
|
return cloned;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CiManagement clone( CiManagement ciManagement )
|
||||||
|
{
|
||||||
|
if ( ciManagement == null )
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
CiManagement cloned = new CiManagement();
|
||||||
|
|
||||||
|
cloned.setSystem( ciManagement.getSystem() );
|
||||||
|
cloned.setUrl( ciManagement.getUrl() );
|
||||||
|
|
||||||
|
return cloned;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IssueManagement clone( IssueManagement issueManagement )
|
||||||
|
{
|
||||||
|
if ( issueManagement == null )
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
IssueManagement cloned = new IssueManagement();
|
||||||
|
|
||||||
|
cloned.setSystem( issueManagement.getSystem() );
|
||||||
|
cloned.setUrl( issueManagement.getUrl() );
|
||||||
|
|
||||||
|
return cloned;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Organization clone( Organization organization )
|
||||||
|
{
|
||||||
|
if ( organization == null )
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Organization cloned = new Organization();
|
||||||
|
|
||||||
|
cloned.setFavicon( organization.getFavicon() );
|
||||||
|
cloned.setName( organization.getName() );
|
||||||
|
cloned.setUrl( organization.getUrl() );
|
||||||
|
|
||||||
|
return cloned;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Properties clone( Properties properties )
|
||||||
|
{
|
||||||
|
if ( properties == null )
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Properties cloned = new Properties();
|
||||||
|
|
||||||
|
Enumeration keys = properties.propertyNames();
|
||||||
|
while ( keys.hasMoreElements() )
|
||||||
|
{
|
||||||
|
String key = (String) keys.nextElement();
|
||||||
|
String value = properties.getProperty( key );
|
||||||
|
cloned.setProperty( key, value );
|
||||||
|
}
|
||||||
|
|
||||||
|
return cloned;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Scm clone( Scm scm )
|
||||||
|
{
|
||||||
|
if ( scm == null )
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Scm cloned = new Scm();
|
||||||
|
|
||||||
|
cloned.setConnection( scm.getConnection() );
|
||||||
|
cloned.setDeveloperConnection( scm.getDeveloperConnection() );
|
||||||
|
cloned.setUrl( scm.getUrl() );
|
||||||
|
|
||||||
|
return cloned;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static VersionedReference clone( VersionedReference versionedReference )
|
||||||
|
{
|
||||||
|
if ( versionedReference == null )
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
VersionedReference cloned = new VersionedReference();
|
||||||
|
|
||||||
|
cloned.setGroupId( versionedReference.getGroupId() );
|
||||||
|
cloned.setArtifactId( versionedReference.getArtifactId() );
|
||||||
|
cloned.setVersion( versionedReference.getVersion() );
|
||||||
|
|
||||||
|
return cloned;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List cloneArtifactReferences( List artifactReferenceList )
|
||||||
|
{
|
||||||
|
if ( artifactReferenceList == null )
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
List ret = new ArrayList();
|
||||||
|
|
||||||
|
Iterator it = artifactReferenceList.iterator();
|
||||||
|
while ( it.hasNext() )
|
||||||
|
{
|
||||||
|
ArtifactReference artifactReference = (ArtifactReference) it.next();
|
||||||
|
ret.add( clone( artifactReference ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List cloneDependencies( List dependencies )
|
||||||
|
{
|
||||||
|
if ( dependencies == null )
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
List ret = new ArrayList();
|
||||||
|
|
||||||
|
Iterator it = dependencies.iterator();
|
||||||
|
while ( it.hasNext() )
|
||||||
|
{
|
||||||
|
Dependency dep = (Dependency) it.next();
|
||||||
|
Dependency cloned = new Dependency();
|
||||||
|
|
||||||
|
cloned.setGroupId( dep.getGroupId() );
|
||||||
|
cloned.setArtifactId( dep.getArtifactId() );
|
||||||
|
cloned.setVersion( dep.getVersion() );
|
||||||
|
|
||||||
|
cloned.setClassifier( dep.getClassifier() );
|
||||||
|
cloned.setType( dep.getType() );
|
||||||
|
cloned.setScope( dep.getScope() );
|
||||||
|
cloned.setOptional( dep.isOptional() );
|
||||||
|
cloned.setSystemPath( dep.getSystemPath() );
|
||||||
|
cloned.setUrl( dep.getUrl() );
|
||||||
|
cloned.setExclusions( cloneExclusions( dep.getExclusions() ) );
|
||||||
|
|
||||||
|
ret.add( cloned );
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List cloneExclusions( List exclusions )
|
||||||
|
{
|
||||||
|
if ( exclusions == null )
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
List ret = new ArrayList();
|
||||||
|
|
||||||
|
Iterator it = exclusions.iterator();
|
||||||
|
while ( it.hasNext() )
|
||||||
|
{
|
||||||
|
Exclusion exclusion = (Exclusion) it.next();
|
||||||
|
Exclusion cloned = new Exclusion();
|
||||||
|
|
||||||
|
cloned.setGroupId( exclusion.getGroupId() );
|
||||||
|
cloned.setArtifactId( exclusion.getArtifactId() );
|
||||||
|
|
||||||
|
ret.add( cloned );
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List cloneIndividuals( List individuals )
|
||||||
|
{
|
||||||
|
if ( individuals == null )
|
||||||
|
{
|
||||||
|
return individuals;
|
||||||
|
}
|
||||||
|
|
||||||
|
List ret = new ArrayList();
|
||||||
|
|
||||||
|
Iterator it = individuals.iterator();
|
||||||
|
while ( it.hasNext() )
|
||||||
|
{
|
||||||
|
Individual individual = (Individual) it.next();
|
||||||
|
Individual cloned = new Individual();
|
||||||
|
|
||||||
|
cloned.setPrincipal( individual.getPrincipal() );
|
||||||
|
|
||||||
|
cloned.setEmail( individual.getEmail() );
|
||||||
|
cloned.setName( individual.getName() );
|
||||||
|
cloned.setOrganization( individual.getOrganization() );
|
||||||
|
cloned.setOrganizationUrl( individual.getOrganizationUrl() );
|
||||||
|
cloned.setUrl( individual.getUrl() );
|
||||||
|
cloned.setTimezone( individual.getTimezone() );
|
||||||
|
|
||||||
|
cloned.setRoles( cloneRoles( individual.getRoles() ) );
|
||||||
|
cloned.setProperties( clone( individual.getProperties() ) );
|
||||||
|
|
||||||
|
ret.add( cloned );
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List cloneLicenses( List licenses )
|
||||||
|
{
|
||||||
|
if ( licenses == null )
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
List ret = new ArrayList();
|
||||||
|
|
||||||
|
Iterator it = licenses.iterator();
|
||||||
|
while ( it.hasNext() )
|
||||||
|
{
|
||||||
|
License license = (License) it.next();
|
||||||
|
License cloned = new License();
|
||||||
|
|
||||||
|
cloned.setId( license.getId() );
|
||||||
|
cloned.setName( license.getName() );
|
||||||
|
cloned.setUrl( license.getUrl() );
|
||||||
|
cloned.setComments( license.getComments() );
|
||||||
|
|
||||||
|
ret.add( cloned );
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List clonePlugins( List plugins )
|
||||||
|
{
|
||||||
|
return cloneArtifactReferences( plugins );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List cloneReports( List reports )
|
||||||
|
{
|
||||||
|
return cloneArtifactReferences( reports );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List cloneRepositories( List repositories )
|
||||||
|
{
|
||||||
|
if ( repositories == null )
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
List ret = new ArrayList();
|
||||||
|
|
||||||
|
Iterator it = repositories.iterator();
|
||||||
|
while ( it.hasNext() )
|
||||||
|
{
|
||||||
|
ProjectRepository repository = (ProjectRepository) it.next();
|
||||||
|
ProjectRepository cloned = new ProjectRepository();
|
||||||
|
|
||||||
|
cloned.setId( repository.getId() );
|
||||||
|
cloned.setName( repository.getName() );
|
||||||
|
cloned.setUrl( repository.getUrl() );
|
||||||
|
cloned.setLayout( repository.getLayout() );
|
||||||
|
cloned.setPlugins( repository.isPlugins() );
|
||||||
|
cloned.setReleases( repository.isReleases() );
|
||||||
|
cloned.setSnapshots( repository.isSnapshots() );
|
||||||
|
|
||||||
|
ret.add( cloned );
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List cloneRoles( List roles )
|
||||||
|
{
|
||||||
|
if ( roles == null )
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
List ret = new ArrayList();
|
||||||
|
|
||||||
|
Iterator it = roles.iterator();
|
||||||
|
while ( it.hasNext() )
|
||||||
|
{
|
||||||
|
String roleName = (String) it.next();
|
||||||
|
ret.add( roleName );
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package org.apache.maven.archiva.model.jpox;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.archiva.model.AbstractArtifactKey;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ArchivaArtifactJavaDetailsKey - unique classid-key for JPOX.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class ArchivaArtifactJavaDetailsKey
|
||||||
|
extends AbstractArtifactKey
|
||||||
|
implements Serializable
|
||||||
|
{
|
||||||
|
|
||||||
|
public ArchivaArtifactJavaDetailsKey()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArchivaArtifactJavaDetailsKey( String key )
|
||||||
|
{
|
||||||
|
super( key );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
package org.apache.maven.archiva.model.jpox;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.archiva.model.AbstractArtifactKey;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ArchivaArtifactModelKey - unique classid-key for JPOX.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class ArchivaArtifactModelKey
|
||||||
|
extends AbstractArtifactKey
|
||||||
|
implements Serializable
|
||||||
|
{
|
||||||
|
public ArchivaArtifactModelKey()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArchivaArtifactModelKey( String key )
|
||||||
|
{
|
||||||
|
super( key );
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package org.apache.maven.archiva.model.jpox;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.archiva.model.AbstractVersionedKey;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ArchivaProjectModelKey - unique classid-key for JPOX.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class ArchivaProjectModelKey
|
||||||
|
extends AbstractVersionedKey
|
||||||
|
implements Serializable
|
||||||
|
{
|
||||||
|
|
||||||
|
public ArchivaProjectModelKey()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArchivaProjectModelKey( String key )
|
||||||
|
{
|
||||||
|
super( key );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package org.apache.maven.archiva.model.jpox;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.archiva.model.AbstractProjectKey;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ArchivaRepositoryMetadataKey - unique classid-key for JPOX.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class ArchivaRepositoryMetadataKey
|
||||||
|
extends AbstractProjectKey
|
||||||
|
implements Serializable
|
||||||
|
{
|
||||||
|
|
||||||
|
public ArchivaRepositoryMetadataKey()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArchivaRepositoryMetadataKey( String key )
|
||||||
|
{
|
||||||
|
super( key );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,46 @@
|
||||||
|
package org.apache.maven.archiva.model.jpox;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.archiva.model.AbstractArtifactKey;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ArtifactReferenceKey - unique classid-key for JPOX.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class ArtifactReferenceKey
|
||||||
|
extends AbstractArtifactKey
|
||||||
|
implements Serializable
|
||||||
|
{
|
||||||
|
|
||||||
|
public ArtifactReferenceKey()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArtifactReferenceKey( String key )
|
||||||
|
{
|
||||||
|
super( key );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
package org.apache.maven.archiva.model.jpox;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.archiva.model.AbstractArtifactKey;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DependencyKey - unique classid-key for JPOX.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class DependencyKey
|
||||||
|
extends AbstractArtifactKey
|
||||||
|
implements Serializable
|
||||||
|
{
|
||||||
|
|
||||||
|
public DependencyKey()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public DependencyKey( String key )
|
||||||
|
{
|
||||||
|
super( key );
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package org.apache.maven.archiva.model.jpox;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
* distributed with this work for additional information
|
||||||
|
* regarding copyright ownership. The ASF licenses this file
|
||||||
|
* to you under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance
|
||||||
|
* with the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.archiva.model.AbstractVersionedKey;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* VersionedReferenceKey - unique classid-key for JPOX.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class VersionedReferenceKey
|
||||||
|
extends AbstractVersionedKey
|
||||||
|
implements Serializable
|
||||||
|
{
|
||||||
|
|
||||||
|
public VersionedReferenceKey()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public VersionedReferenceKey( String key )
|
||||||
|
{
|
||||||
|
super( key );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue