]> source.dussan.org Git - archiva.git/commitdiff
Correcting primary-key handling of compound keys in jpox by flatting out sub-objects...
authorJoakim Erdfelt <joakime@apache.org>
Thu, 5 Apr 2007 01:10:45 +0000 (01:10 +0000)
committerJoakim Erdfelt <joakime@apache.org>
Thu, 5 Apr 2007 01:10:45 +0000 (01:10 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches/archiva-jpox-database-refactor@525672 13f79535-47bb-0310-9956-ffa450edef68

15 files changed:
archiva-base/archiva-model/pom.xml
archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/AbstractArtifactKey.java [new file with mode: 0644]
archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/AbstractProjectKey.java [new file with mode: 0644]
archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/AbstractVersionedKey.java [new file with mode: 0644]
archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaArtifact.java
archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java [new file with mode: 0644]
archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/RepositoryContentKey.java [deleted file]
archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArchivaArtifactJavaDetailsKey.java [new file with mode: 0644]
archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArchivaArtifactModelKey.java [new file with mode: 0644]
archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArchivaProjectModelKey.java [new file with mode: 0644]
archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArchivaRepositoryMetadataKey.java [new file with mode: 0644]
archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArtifactReferenceKey.java [new file with mode: 0644]
archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/DependencyKey.java [new file with mode: 0644]
archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/VersionedReferenceKey.java [new file with mode: 0644]
archiva-base/archiva-model/src/main/mdo/archiva-base.xml

index f0a4acd2a8367e8300e18bc3ad21333c849e92f1..52c185ea706a5855acec976d039618057c7db7f9 100755 (executable)
               <goal>xsd</goal>
               <goal>jpox-jdo-mapping</goal>
               <goal>jpox-metadata-class</goal>
+              <!--
               <goal>xpp3-writer</goal>
               <goal>xpp3-reader</goal>
+                -->
             </goals>
           </execution>
         </executions>
diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/AbstractArtifactKey.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/AbstractArtifactKey.java
new file mode 100644 (file)
index 0000000..2c4f987
--- /dev/null
@@ -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>&nbsp;</td>
+ *     <td>&nbsp;</td>
+ *     <td>&nbsp;</td>
+ *   </tr>
+ *   <tr>
+ *     <td>{@link AbstractVersionedKey}</td>
+ *     <td align="center">Yes</td>
+ *     <td align="center">Yes</td>
+ *     <td align="center">Yes</td>
+ *     <td>&nbsp;</td>
+ *     <td>&nbsp;</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;
+    }
+}
diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/AbstractProjectKey.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/AbstractProjectKey.java
new file mode 100644 (file)
index 0000000..23f628c
--- /dev/null
@@ -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>&nbsp;</td>
+ *     <td>&nbsp;</td>
+ *     <td>&nbsp;</td>
+ *   </tr>
+ *   <tr>
+ *     <td>{@link AbstractVersionedKey}</td>
+ *     <td align="center">Yes</td>
+ *     <td align="center">Yes</td>
+ *     <td align="center">Yes</td>
+ *     <td>&nbsp;</td>
+ *     <td>&nbsp;</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;
+    }
+}
diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/AbstractVersionedKey.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/AbstractVersionedKey.java
new file mode 100644 (file)
index 0000000..c173a35
--- /dev/null
@@ -0,0 +1,198 @@
+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>
+ * 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>&nbsp;</td>
+ *     <td>&nbsp;</td>
+ *     <td>&nbsp;</td>
+ *   </tr>
+ *   <tr>
+ *     <td>{@link AbstractVersionedKey}</td>
+ *     <td align="center">Yes</td>
+ *     <td align="center">Yes</td>
+ *     <td align="center">Yes</td>
+ *     <td>&nbsp;</td>
+ *     <td>&nbsp;</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 AbstractVersionedKey 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 = "";
+    
+    /**
+     * Default Constructor.  Required by JPOX.
+     */
+    public AbstractVersionedKey()
+    {
+        /* do nothing */
+    }
+    
+    /**
+     * Key Based Constructor.  Required by JPOX.
+     * 
+     * @param key the String representing this object's values.
+     */
+    public AbstractVersionedKey( String key )
+    {
+        String parts[] = StringUtils.splitPreserveAllTokens( key, ":" );
+        groupId = parts[1];
+        artifactId = parts[2];
+        version = parts[3];
+    }
+    
+    /**
+     * Get the String representation of this object. - Required by JPOX.
+     */
+    public String toString()
+    {
+        return StringUtils.join( new String[] { groupId, artifactId, version } );
+    }
+
+    /**
+     * 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() );
+        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 AbstractVersionedKey other = (AbstractVersionedKey) 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;
+        }
+        
+        return true;
+    }
+}
index 8e4f2c4ac270eab7f160fc5f61a59d3f797ed7db..e3920f45c9fc0d9b9b61eaad3fb1353caa99d90a 100644 (file)
@@ -19,8 +19,8 @@ package org.apache.maven.archiva.model;
  * under the License.
  */
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.maven.archiva.common.utils.VersionUtil;
-import org.codehaus.plexus.util.StringUtils;
 
 /**
  * ArchivaArtifact - Mutable artifact object.
@@ -31,7 +31,7 @@ import org.codehaus.plexus.util.StringUtils;
 public class ArchivaArtifact
 {
     private ArchivaArtifactModel model;
-    
+
     private ArchivaArtifactPlatformDetails platformDetails;
 
     private String baseVersion;
@@ -68,14 +68,10 @@ public class ArchivaArtifact
 
         model = new ArchivaArtifactModel();
 
-        if ( repository == null )
-        {
-            model.setContentKey( new RepositoryContent( groupId, artifactId, version ) );
-        }
-        else
-        {
-            model.setContentKey( new RepositoryContent( repository.getModel(), groupId, artifactId, version ) );
-        }
+        model.setGroupId( groupId );
+        model.setArtifactId( artifactId );
+        model.setVersion( version );
+        model.setRepositoryId( repository.getId() );
         model.setClassifier( StringUtils.defaultString( classifier ) );
         model.setType( type );
 
@@ -90,17 +86,17 @@ public class ArchivaArtifact
 
     public String getGroupId()
     {
-        return model.getContentKey().getGroupId();
+        return model.getGroupId();
     }
 
     public String getArtifactId()
     {
-        return model.getContentKey().getArtifactId();
+        return model.getArtifactId();
     }
 
     public String getVersion()
     {
-        return model.getContentKey().getVersion();
+        return model.getVersion();
     }
 
     public String getBaseVersion()
@@ -134,15 +130,11 @@ public class ArchivaArtifact
         int result = 1;
         if ( model != null )
         {
-            RepositoryContent key = model.getContentKey();
-            if ( key != null )
-            {
-                result = PRIME * result + ( ( key.getGroupId() == null ) ? 0 : key.getGroupId().hashCode() );
-                result = PRIME * result + ( ( key.getArtifactId() == null ) ? 0 : key.getArtifactId().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() );
-            }
+            result = PRIME * result + ( ( model.getGroupId() == null ) ? 0 : model.getGroupId().hashCode() );
+            result = PRIME * result + ( ( model.getArtifactId() == null ) ? 0 : model.getArtifactId().hashCode() );
+            result = PRIME * result + ( ( model.getVersion() == null ) ? 0 : model.getVersion().hashCode() );
+            result = PRIME * result + ( ( model.getClassifier() == null ) ? 0 : model.getClassifier().hashCode() );
+            result = PRIME * result + ( ( model.getType() == null ) ? 0 : model.getType().hashCode() );
         }
         return result;
     }
@@ -173,63 +165,27 @@ public class ArchivaArtifact
                 return false;
             }
         }
-        else
-        {
-            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 ) )
+        if ( !model.equals( other.model ) )
         {
             return false;
         }
+
         return true;
     }
 
     public String toString()
     {
         StringBuffer sb = new StringBuffer();
-        if ( model.getContentKey().getGroupId() != null )
+        if ( model.getGroupId() != null )
         {
-            sb.append( model.getContentKey().getGroupId() );
+            sb.append( model.getGroupId() );
             sb.append( ":" );
         }
         appendArtifactTypeClassifierString( sb );
         sb.append( ":" );
-        if ( model.getContentKey().getVersion() != null )
+        if ( model.getVersion() != null )
         {
-            sb.append( model.getContentKey().getVersion() );
+            sb.append( model.getVersion() );
         }
 
         return sb.toString();
@@ -237,7 +193,7 @@ public class ArchivaArtifact
 
     private void appendArtifactTypeClassifierString( StringBuffer sb )
     {
-        sb.append( model.getContentKey().getArtifactId() );
+        sb.append( model.getArtifactId() );
         sb.append( ":" );
         sb.append( getType() );
         if ( hasClassifier() )
diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java
new file mode 100644 (file)
index 0000000..8b50de8
--- /dev/null
@@ -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;
+    }
+}
diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/RepositoryContentKey.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/RepositoryContentKey.java
deleted file mode 100644 (file)
index a198eae..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-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;
-
-/**
- * RepositoryContentKey - the jpox application key support class for all content within the repository.
- *
- * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- * @version $Id$
- */
-public class RepositoryContentKey implements Serializable
-{
-    /**
-     * The Repository ID. (JPOX Requires this remain public)
-     */
-    public String repositoryId = "";
-
-    /**
-     * 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 = "";
-
-    /**
-     * Default Constructor.  Required by JPOX.
-     */
-    public RepositoryContentKey()
-    {
-
-    }
-
-    /**
-     * Key Based Constructor.  Required by JPOX.
-     * 
-     * @param key the String representing this object's values.
-     */
-    public RepositoryContentKey( String key )
-    {
-        String parts[] = StringUtils.splitPreserveAllTokens( key, ':' );
-        repositoryId = parts[0];
-        groupId = parts[1];
-        artifactId = parts[2];
-        version = parts[3];
-    }
-
-    /**
-     * Get the String representation of this object. - Required by JPOX.
-     */
-    public String toString()
-    {
-        return StringUtils.join( new String[] { repositoryId, groupId, artifactId, version } );
-    }
-
-    /**
-     * Get the hashcode for this object's values - Required by JPOX.
-     */
-    public int hashCode()
-    {
-        final int PRIME = 31;
-        int result = 1;
-        result = PRIME * result + ( ( repositoryId == null ) ? 0 : repositoryId.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() );
-        return result;
-    }
-
-    /**
-     * Get the equals for this object's values - Required by JPOX.
-     */
-    public boolean equals( Object obj )
-    {
-        if ( this == obj )
-        {
-            return true;
-        }
-
-        if ( obj == null )
-        {
-            return false;
-        }
-
-        if ( getClass() != obj.getClass() )
-        {
-            return false;
-        }
-
-        final RepositoryContentKey other = (RepositoryContentKey) obj;
-
-        if ( repositoryId == null )
-        {
-            if ( other.repositoryId != null )
-            {
-                return false;
-            }
-        }
-        else if ( !repositoryId.equals( other.repositoryId ) )
-        {
-            return false;
-        }
-
-        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;
-        }
-
-        return true;
-    }
-}
diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArchivaArtifactJavaDetailsKey.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArchivaArtifactJavaDetailsKey.java
new file mode 100644 (file)
index 0000000..59fbc6b
--- /dev/null
@@ -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 );
+    }
+
+}
diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArchivaArtifactModelKey.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArchivaArtifactModelKey.java
new file mode 100644 (file)
index 0000000..4fdf974
--- /dev/null
@@ -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 );
+    }
+}
diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArchivaProjectModelKey.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArchivaProjectModelKey.java
new file mode 100644 (file)
index 0000000..cdda128
--- /dev/null
@@ -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 );
+    }
+
+}
diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArchivaRepositoryMetadataKey.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArchivaRepositoryMetadataKey.java
new file mode 100644 (file)
index 0000000..d4274cb
--- /dev/null
@@ -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 );
+    }
+
+}
diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArtifactReferenceKey.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/ArtifactReferenceKey.java
new file mode 100644 (file)
index 0000000..41110b1
--- /dev/null
@@ -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 );
+    }
+
+}
diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/DependencyKey.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/DependencyKey.java
new file mode 100644 (file)
index 0000000..929f2f1
--- /dev/null
@@ -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 );
+    }
+}
diff --git a/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/VersionedReferenceKey.java b/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/jpox/VersionedReferenceKey.java
new file mode 100644 (file)
index 0000000..094307c
--- /dev/null
@@ -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 );
+    }
+
+}
index 101fde635397b84af6da671f609f13b11a68a73b..06a07f732f651811864dd4672e7eb0d987113311 100644 (file)
           </association>
         </field>
         <field>
-          <name>artifactHealth</name>
+          <name>repositoryProblems</name>
           <version>1.0.0+</version>
           <association>
-            <type>ArchivaArtifactHealth</type>
-            <multiplicity>*</multiplicity>
-          </association>
-        </field>
-        <field>
-          <name>repositoryMetadataHealth</name>
-          <version>1.0.0+</version>
-          <association>
-            <type>ArchivaRepositoryMetadataHealth</type>
+            <type>RepositoryProblem</type>
             <multiplicity>*</multiplicity>
           </association>
         </field>
         <field jpox.primary-key="true"
                jpox.value-strategy="off">
           <name>id</name>
-          <identity>true</identity>
+          <identifier>true</identifier>
           <version>1.0.0+</version>
           <type>String</type>
           <required>true</required>
         </field>
         <field>
           <name>name</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <type>String</type>
           <required>true</required>
         </field>
         <field>
           <name>url</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <type>String</type>
           <required>true</required>
         </field>
         <field>
           <name>creationSource</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <type>String</type>
           <required>true</required>
         </field>
         <field>
           <name>layoutName</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <type>String</type>
           <required>true</required>
         </field>
         <field>
           <name>releasePolicy</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <type>boolean</type>
           <required>true</required>
         </field>
         <field>
           <name>snapshotPolicy</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <type>boolean</type>
           <required>true</required>
         </field>
       </fields>
     </class>
+
+    <!-- _______________________________________________________________
+           _         _   _  __            _
+          / \   _ __| |_(_)/ _| __ _  ___| |_
+         / _ \ | '__| __| | |_ / _` |/ __| __|
+        / ___ \| |  | |_| |  _| (_| | (__| |_
+       /_/   \_\_|   \__|_|_|  \__,_|\___|\__|
+
+      -->
+
     <class stash.storable="true"
-           jpox.table="REPOSITORY_CONTENT_KEYS"
-           jpox.use-identifiers-as-primary-key="true"
+           jpox.table="ARTIFACT"
+           jpox.use-identifiers-as-primary-key="false"
            jpox.identity-type="application"
-           jpox.identity-class="RepositoryContentKey">
-      <name>RepositoryContent</name>
+           jpox.identity-class="org.apache.maven.archiva.model.jpox.ArchivaArtifactModelKey">
+      <name>ArchivaArtifactModel</name>
       <version>1.0.0+</version>
-      <description>
-        Repository Content Identifier.
-      </description>
       <fields>
+        <!-- 
+           NOTE TO ARCHIVA DEVELOPERS....
+           
+           The ArchivaArtifact object should contain no platform specifics!!
+           Put Java specifics in the ArchivaArtifactJavaDetails object.
+           Put .Net specifics in the ArchivaArtifactDotNetDetails object.
+         -->
         <field jpox.primary-key="true"
                jpox.value-strategy="off"
                jpox.persistence-modifier="persistent">
           <name>groupId</name>
-          <identity>true</identity>
+          <identifier>true</identifier>
           <version>1.0.0+</version>
           <type>String</type>
           <required>true</required>
                jpox.value-strategy="off"
                jpox.persistence-modifier="persistent">
           <name>artifactId</name>
-          <identity>true</identity>
+          <identifier>true</identifier>
           <version>1.0.0+</version>
           <type>String</type>
           <required>true</required>
                jpox.value-strategy="off"
                jpox.persistence-modifier="persistent">
           <name>version</name>
-          <identity>true</identity>
+          <identifier>true</identifier>
           <version>1.0.0+</version>
           <type>String</type>
           <required>false</required>
         <field jpox.primary-key="true"
                jpox.value-strategy="off"
                jpox.persistence-modifier="persistent">
-          <name>repositoryId</name>
-          <identity>true</identity>
+          <name>classifier</name>
+          <identifier>true</identifier>
           <version>1.0.0+</version>
-          <required>true</required>
           <type>String</type>
+          <required>true</required>
           <description>
-            The repository associated with this content.
+            The classifier for this artifact.
           </description>
         </field>
-      </fields>
-      <codeSegments>
-        <codeSegment>
-          <version>1.0.0+</version>
-          <code>
-          <![CDATA[
-    /**
-     * Default Constructor.
-     * NOTE: The RepositoryContent object is invalid, and cannot be persisted to
-     *       the database until you set the {@link #setGroupId(String)}, 
-     *       {@link #setArtifactId(String)}, and {@link #setVersion(String)} values
-     *       first.
-     */ 
-    public RepositoryContent()
-    {
-        /* Do nothing */
-    }
-
-    public RepositoryContent( String groupId, String artifactId, String version )
-    {
-        this.setGroupId( groupId );
-        this.setArtifactId( artifactId );
-        this.setVersion( version );
-    }
-
-    public RepositoryContent( String repositoryId, String groupId, String artifactId, String version )
-    {
-        this.setRepositoryId( repositoryId );
-        this.setGroupId( groupId );
-        this.setArtifactId( artifactId );
-        this.setVersion( version );
-    }
-
-    public RepositoryContent( ArchivaRepositoryModel repository, String groupId, String artifactId, String version )
-    {
-        this.setRepositoryId( repository.getId() );
-        this.setGroupId( groupId );
-        this.setArtifactId( artifactId );
-        this.setVersion( version );
-    }
-          ]]></code>
-        </codeSegment>
-      </codeSegments>
-    </class>
-
-    <!-- _______________________________________________________________
-           _         _   _  __            _
-          / \   _ __| |_(_)/ _| __ _  ___| |_
-         / _ \ | '__| __| | |_ / _` |/ __| __|
-        / ___ \| |  | |_| |  _| (_| | (__| |_
-       /_/   \_\_|   \__|_|_|  \__,_|\___|\__|
-
-      -->
-
-    <class stash.storable="true"
-           jpox.table="ARTIFACT">
-      <name>ArchivaArtifactModel</name>
-      <version>1.0.0+</version>
-      <fields>
-        <!-- 
-           NOTE TO ARCHIVA DEVELOPERS....
-           
-           The ArchivaArtifact object should contain no platform specifics!!
-           Put Java specifics in the ArchivaArtifactJavaDetails object.
-           Put .Net specifics in the ArchivaArtifactDotNetDetails object.
-         -->
-        <field>
-          <name>contentKey</name>
-          <identity>true</identity>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent"
+               jpox.column="FILE_TYPE">
+          <name>type</name>
+          <identifier>true</identifier>
           <version>1.0.0+</version>
+          <type>String</type>
           <required>true</required>
-          <association>
-            <type>RepositoryContent</type>
-            <multiplicity>1</multiplicity>
-          </association>
           <description>
-            The content key for this artifact.
+            The type of artifact.
           </description>
         </field>
         <field>
-          <name>classifier</name>
-          <identity>false</identity>
+          <name>repositoryId</name>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
-          <type>String</type>
           <required>false</required>
-          <description>
-            The classifier for this artifact.
-          </description>
-        </field>
-        <field jpox.column="FILE_TYPE">
-          <name>type</name>
-          <identity>true</identity>
-          <version>1.0.0+</version>
           <type>String</type>
-          <required>true</required>
           <description>
-            The type of artifact.
+            The repository associated with this content.
           </description>
         </field>
         <field>
           <name>checksumMD5</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <type>String</type>
           <required>false</required>
         </field>
         <field>
           <name>checksumSHA1</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <type>String</type>
           <required>false</required>
         </field>
         <field>
           <name>lastModified</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <type>Date</type>
           <required>true</required>
         </field>
         <field jpox.column="FILE_SIZE">
           <name>size</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <type>long</type>
           <required>true</required>
         </field>
         <field>
           <name>platform</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <type>String</type>
           <required>true</required>
         </field>
         <field>
           <name>whenIndexed</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <type>Date</type>
           <required>false</required>
         </field>
         <field>
           <name>origin</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <type>String</type>
           <required>false</required>
       </fields>
     </class>
     <class stash.storable="true"
-           jpox.table="JAVA_ARTIFACT">
+           jpox.table="JAVA_ARTIFACT"
+           jpox.use-identifiers-as-primary-key="false"
+           jpox.identity-type="application"
+           jpox.identity-class="org.apache.maven.archiva.model.jpox.ArchivaArtifactJavaDetailsKey">
       <name>ArchivaArtifactJavaDetails</name>
       <interfaces>
         <interface>org.apache.maven.archiva.model.ArchivaArtifactPlatformDetails</interface>
       </interfaces>
       <version>1.0.0+</version>
       <fields>
-        <field>
-          <name>contentKey</name>
-          <identity>true</identity>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>groupId</name>
+          <identifier>true</identifier>
           <version>1.0.0+</version>
+          <type>String</type>
+          <required>true</required>
+          <description>
+            The Group ID of the repository content.
+          </description>
+        </field>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>artifactId</name>
+          <identifier>true</identifier>
+          <version>1.0.0+</version>
+          <type>String</type>
           <required>true</required>
-          <association>
-            <type>RepositoryContent</type>
-            <multiplicity>1</multiplicity>
-          </association>
           <description>
-            The content key for this java artifact details.
+            The Artifact ID of the repository content.
+          </description>
+        </field>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>version</name>
+          <identifier>true</identifier>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <required>false</required>
+          <description>
+            The version of the repository content.
+          </description>
+        </field>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>classifier</name>
+          <identifier>true</identifier>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <required>true</required>
+          <description>
+            The classifier for this artifact.
+          </description>
+        </field>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent"
+               jpox.column="FILE_TYPE">
+          <name>type</name>
+          <identifier>true</identifier>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <required>true</required>
+          <description>
+            The type of artifact.
           </description>
         </field>
         <field>
           <name>checksumBytecode</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <type>String</type>
           <required>false</required>
         </field>
         <field>
           <name>jdk</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <type>String</type>
           <required>false</required>
       </codeSegments>
     </class>
     <class stash.storable="true"
+           jpox.use-identifiers-as-primary-key="false"
+           jpox.identity-type="application"
+           jpox.identity-class="org.apache.maven.archiva.model.jpox.ArchivaRepositoryMetadataKey"
            jpox.table="REPOSITORY_METADATA">
       <name>ArchivaRepositoryMetadata</name>
       <version>1.0.0+</version>
       <fields>
-        <field>
-          <name>contentKey</name>
-          <identity>true</identity>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>groupId</name>
+          <identifier>true</identifier>
           <version>1.0.0+</version>
+          <type>String</type>
           <required>true</required>
-          <association>
-            <type>RepositoryContent</type>
-            <multiplicity>1</multiplicity>
-          </association>
           <description>
-            The content key for this repository metadata.
+            The Group ID of the repository content.
+          </description>
+        </field>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>artifactId</name>
+          <identifier>true</identifier>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <required>true</required>
+          <description>
+            The Artifact ID of the repository content.
           </description>
         </field>
         <field>
           <name>releasedVersion</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <required>false</required>
           <type>String</type>
         </field>
         <field>
           <name>availableVersions</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <required>false</required>
           <association>
         </field>
         <field>
           <name>lastModified</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <type>Date</type>
           <required>true</required>
         </field>
         <field jpox.column="FILE_SIZE">
           <name>size</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <type>long</type>
           <required>true</required>
         </field>
         <field>
           <name>whenIndexed</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <type>Date</type>
           <required>false</required>
         </field>
         <field>
           <name>origin</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <type>String</type>
           <required>false</required>
      -->
 
     <class stash.storable="true"
-           jpox.table="PROJECT">
+           jpox.table="PROJECT"
+           jpox.use-identifiers-as-primary-key="false"
+           jpox.identity-type="application"
+           jpox.identity-class="org.apache.maven.archiva.model.jpox.ArchivaProjectModelKey">
       <name>ArchivaProjectModel</name>
       <version>1.0.0+</version>
       <fields>
-        <field>
-          <name>contentKey</name>
-          <identity>true</identity>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>groupId</name>
+          <identifier>true</identifier>
           <version>1.0.0+</version>
+          <type>String</type>
           <required>true</required>
-          <association>
-            <type>RepositoryContent</type>
-            <multiplicity>1</multiplicity>
-          </association>
           <description>
-            The content key for this artifact.
+            The Group ID of the repository content.
+          </description>
+        </field>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>artifactId</name>
+          <identifier>true</identifier>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <required>true</required>
+          <description>
+            The Artifact ID of the repository content.
+          </description>
+        </field>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>version</name>
+          <identifier>true</identifier>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <required>false</required>
+          <description>
+            The version of the repository content.
           </description>
         </field>
         <field>
-          <name>parentContentKey</name>
-          <identity>false</identity>
+          <name>parentProject</name>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <required>false</required>
           <association>
-            <type>RepositoryContent</type>
+            <type>VersionedReference</type>
             <multiplicity>1</multiplicity>
           </association>
           <description>
         </field>
         <field>
           <name>packaging</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <required>true</required>
           <type>String</type>
         </field>
         <field>
           <name>name</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <required>false</required>
           <type>String</type>
         </field>
         <field>
           <name>description</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <required>false</required>
           <type>String</type>
         </field>
         <field>
           <name>origin</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <required>true</required>
           <type>String</type>
         </field>
         <field>
           <name>whenIndexed</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <required>true</required>
           <type>Date</type>
         </field>
         <field>
           <name>url</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <required>false</required>
           <type>String</type>
         </field>
         <field>
           <name>organization</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <required>false</required>
           <association>
         </field>
         <field>
           <name>licenses</name>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <required>false</required>
           <association>
             <multiplicity>*</multiplicity>
           </association>
         </field>
+        <field>
+          <name>dependencyManagement</name>
+          <version>1.0.0+</version>
+          <description>
+            The list of dependency management settings.
+          </description>
+          <association>
+            <type>Dependency</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
         <field>
           <name>repositories</name>
           <version>1.0.0+</version>
             The list of plugins that this project uses.
           </description>
           <association>
-            <type>RepositoryContent</type>
+            <type>ArtifactReference</type>
             <multiplicity>*</multiplicity>
           </association>
         </field>
             The list of reports that this project uses.
           </description>
           <association>
-            <type>RepositoryContent</type>
+            <type>ArtifactReference</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+        <field>
+          <name>buildExtensions</name>
+          <version>1.0.0+</version>
+          <description>
+            The list of build extensions that this project uses.
+          </description>
+          <association>
+            <type>ArtifactReference</type>
+            <multiplicity>*</multiplicity>
+          </association>
+        </field>
+        <field>
+          <name>properties</name>
+          <version>1.0.0+</version>
+          <description><![CDATA[
+            Properties on the project.  Only really used to resolve
+            variables inside of the project during an effective project
+            model resolution.
+          ]]></description>
+          <type>Properties</type>
+          <association xml.mapStyle="inline">
+            <type>String</type>
             <multiplicity>*</multiplicity>
           </association>
         </field>
       </fields>
     </class>
+    
+    <class stash.storable="true"
+           jpox.table="VERSIONED_REFERENCE"
+           jpox.use-identifiers-as-primary-key="false"
+           jpox.identity-type="application"
+           jpox.identity-class="org.apache.maven.archiva.model.jpox.VersionedReferenceKey">
+      <name>VersionedReference</name>
+      <description>A reference to another Versioned Project</description>
+      <version>1.0.0+</version>
+      <fields>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>groupId</name>
+          <identifier>true</identifier>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <required>true</required>
+          <description>
+            The Group ID of the repository content.
+          </description>
+        </field>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>artifactId</name>
+          <identifier>true</identifier>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <required>true</required>
+          <description>
+            The Artifact ID of the repository content.
+          </description>
+        </field>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>version</name>
+          <identifier>true</identifier>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <required>false</required>
+          <description>
+            The version of the repository content.
+          </description>
+        </field>
+      </fields>
+    </class>
+    
+    <class stash.storable="true"
+           jpox.table="ArtifactReference"
+           jpox.use-identifiers-as-primary-key="false"
+           jpox.identity-type="application"
+           jpox.identity-class="org.apache.maven.archiva.model.jpox.ArtifactReferenceKey">
+      <name>ArtifactReference</name>
+      <version>1.0.0+</version>
+      <fields>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>groupId</name>
+          <identifier>true</identifier>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <required>true</required>
+          <description>
+            The Group ID of the repository content.
+          </description>
+        </field>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>artifactId</name>
+          <identifier>true</identifier>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <required>true</required>
+          <description>
+            The Artifact ID of the repository content.
+          </description>
+        </field>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>version</name>
+          <identifier>true</identifier>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <required>false</required>
+          <description>
+            The version of the repository content.
+          </description>
+        </field>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>classifier</name>
+          <identifier>true</identifier>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <required>true</required>
+          <description>
+            The classifier for this artifact.
+          </description>
+        </field>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent"
+               jpox.column="FILE_TYPE">
+          <name>type</name>
+          <identifier>true</identifier>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <required>true</required>
+          <description>
+            The type of artifact.
+          </description>
+        </field>
+      </fields>
+    </class>
+    
     <class stash.storable="true"
            jpox.table="ORGANIZATION">
       <name>Organization</name>
       <fields>
         <field>
           <name>name</name>
+          <identifier>true</identifier>
           <version>1.0.0+</version>
           <description><![CDATA[The full name of the organization.]]></description>
           <type>String</type>
       <fields>
         <field jpox.column="LICENSE_ID">
           <name>id</name>
+          <identifier>true</identifier>
           <version>1.0.0+</version>
           <type>int</type>
           <description>
       </description>
       <version>1.0.0+</version>
       <fields>
-        <field jpox.column="SYSTEM_NAME">
-          <name>system</name>
-          <version>1.0.0+</version>
-          <description><![CDATA[The name of the issue management system, e.g. Bugzilla]]></description>
-          <type>String</type>
-        </field>
         <field>
           <name>url</name>
+          <identifier>true</identifier>
           <version>1.0.0+</version>
           <description><![CDATA[URL for the issue management system used by the project.]]></description>
           <type>String</type>
         </field>
+        <field jpox.column="SYSTEM_NAME">
+          <name>system</name>
+          <version>1.0.0+</version>
+          <description><![CDATA[The name of the issue management system, e.g. Bugzilla]]></description>
+          <type>String</type>
+        </field>
       </fields>
     </class>
     <class>
       <name>CiManagement</name>
       <version>1.0.0+</version>
       <fields>
-        <field jpox.column="SYSTEM_NAME">
-          <name>system</name>
+        <field>
+          <name>url</name>
+          <identifier>true</identifier>
           <version>1.0.0+</version>
           <description>
-            <![CDATA[The name of the continuous integration system, e.g. <code>continuum</code>.]]></description>
+            <![CDATA[URL for the continuous integration system used by the project if it has a web interface.]]></description>
           <type>String</type>
         </field>
-        <field>
-          <name>url</name>
+        <field jpox.column="SYSTEM_NAME">
+          <name>system</name>
           <version>1.0.0+</version>
           <description>
-            <![CDATA[URL for the continuous integration system used by the project if it has a web interface.]]></description>
+            <![CDATA[The name of the continuous integration system, e.g. <code>continuum</code>.]]></description>
           <type>String</type>
         </field>
       </fields>
     </class>
-    <class>
+    <class stash.storable="true">
       <name>Individual</name>
       <description>
         Description of a person who has contributed to the project.
       <version>1.0.0+</version>
       <fields>
         <field>
-          <name>name</name>
+          <name>email</name>
+          <identifier>true</identifier>
           <version>1.0.0+</version>
-          <description><![CDATA[The full name of the individual.]]></description>
+          <description><![CDATA[The email address of the individual.]]></description>
           <type>String</type>
         </field>
         <field>
-          <name>email</name>
+          <name>name</name>
           <version>1.0.0+</version>
-          <description><![CDATA[The email address of the individual.]]></description>
+          <description><![CDATA[The full name of the individual.]]></description>
           <type>String</type>
         </field>
         <field>
         </field>
       </fields>
     </class>
+
     <class stash.storable="true"
-           jpox.table="DEPENDENCY">
+           jpox.table="DEPENDENCY"
+           jpox.use-identifiers-as-primary-key="false"
+           jpox.identity-type="application"
+           jpox.identity-class="org.apache.maven.archiva.model.jpox.DependencyKey">
       <name>Dependency</name>
       <version>1.0.0+</version>
       <fields>
-        <field>
-          <name>contentKey</name>
-          <identity>true</identity>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>groupId</name>
+          <identifier>true</identifier>
           <version>1.0.0+</version>
+          <type>String</type>
           <required>true</required>
-          <association>
-            <type>RepositoryContent</type>
-            <multiplicity>1</multiplicity>
-          </association>
           <description>
-            The content key for this dependency.
+            The Group ID of the repository content.
           </description>
         </field>
-        <field>
-          <name>url</name>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>artifactId</name>
+          <identifier>true</identifier>
           <version>1.0.0+</version>
+          <type>String</type>
+          <required>true</required>
+          <description>
+            The Artifact ID of the repository content.
+          </description>
+        </field>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>version</name>
+          <identifier>true</identifier>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <required>false</required>
+          <description>
+            The version of the repository content.
+          </description>
+        </field>
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent">
+          <name>classifier</name>
+          <identifier>true</identifier>
+          <version>1.0.0+</version>
+          <type>String</type>
+          <required>true</required>
           <description><![CDATA[
-            This url will be provided to the user if the jar file cannot be downloaded
-            from the central repository.
+            The classifier of the dependency. This allows distinguishing two artifacts that belong to the same POM but
+            were built differently, and is appended to the filename after the version. For example,
+            <code>jdk14</code> and <code>jdk15</code>.
           ]]></description>
-          <type>String</type>
         </field>
-        <field jpox.column="DEPENDENCY_TYPE">
+        <field jpox.primary-key="true"
+               jpox.value-strategy="off"
+               jpox.persistence-modifier="persistent"
+               jpox.column="DEPENDENCY_TYPE">
           <name>type</name>
+          <identifier>true</identifier>
           <version>1.0.0+</version>
+          <type>String</type>
+          <required>true</required>
           <description><![CDATA[
             The type of dependency. This defaults to <code>jar</code>. While it usually represents the extension on
             the filename of the dependency, that is not always the case. A type can be mapped to a different
             New types can be defined by plugins that set
             <code>extensions</code> to <code>true</code>, so this is not a complete list.
           ]]></description>
-          <type>String</type>
           <defaultValue>jar</defaultValue>
         </field>
         <field>
-          <name>classifier</name>
+          <name>url</name>
           <version>1.0.0+</version>
           <description><![CDATA[
-            The classifier of the dependency. This allows distinguishing two artifacts that belong to the same POM but
-            were built differently, and is appended to the filename after the version. For example,
-            <code>jdk14</code> and <code>jdk15</code>.
+            This url will be provided to the user if the jar file cannot be downloaded
+            from the central repository.
           ]]></description>
           <type>String</type>
-          <required>false</required>
         </field>
         <field jpox.column="DEPENDENCY_SCOPE">
           <name>scope</name>
       -->
 
     <class stash.storable="true"
-           jpox.table="HEALTH_PROBLEMS">
-      <name>HealthProblem</name>
+           jpox.table="REPOSITORY_PROBLEMS">
+      <name>RepositoryProblem</name>
       <version>1.0.0+</version>
       <fields>
-        <field jpox.column="PROBLEM_TYPE">
-          <name>type</name>
-          <identity>false</identity>
+        <field>
+          <name>repositoryId</name>
           <version>1.0.0+</version>
           <required>true</required>
           <type>String</type>
           <description>
-            The type of health problem.
+            The repository associated with this path and problem.
           </description>
         </field>
-        <field jpox.column="PROBLEM_ORIGIN">
-          <name>origin</name>
-          <identity>false</identity>
+        <field jpox.column="REPO_PATH">
+          <name>path</name>
           <version>1.0.0+</version>
-          <required>true</required>
           <type>String</type>
+          <required>true</required>
           <description>
-            The origin of the health problem.
+            The path into the repository for the problem.
           </description>
         </field>
         <field>
-          <name>message</name>
-          <identity>false</identity>
+          <name>groupId</name>
           <version>1.0.0+</version>
-          <required>true</required>
           <type>String</type>
+          <required>false</required>
           <description>
-            The origin of the health problem.
+            The Group ID of the repository content with the problem.
           </description>
         </field>
-      </fields>
-    </class>
-    <class stash.storable="true"
-           jpox.table="HEALTH_ARTIFACTS">
-      <name>ArchivaArtifactHealth</name>
-      <version>1.0.0+</version>
-      <fields>
         <field>
-          <name>artifact</name>
-          <identity>true</identity>
+          <name>artifactId</name>
           <version>1.0.0+</version>
-          <required>true</required>
-          <association>
-            <type>ArchivaArtifactModel</type>
-            <multiplicity>1</multiplicity>
-          </association>
+          <type>String</type>
+          <required>false</required>
           <description>
-            The Artifact to report on.
+            The Artifact ID of the repository content with the problem.
           </description>
         </field>
         <field>
-          <name>problems</name>
-          <identity>false</identity>
+          <name>version</name>
           <version>1.0.0+</version>
+          <type>String</type>
           <required>false</required>
-          <association>
-            <type>HealthProblem</type>
-            <multiplicity>*</multiplicity>
-          </association>
           <description>
-            The list of problems associated with this artifact.
+            The version of the repository content with the problem.
           </description>
         </field>
-      </fields>
-    </class>
-    <class stash.storable="true"
-           jpox.table="HEALTH_REPOSITORY_METADATAS">
-      <name>ArchivaRepositoryMetadataHealth</name>
-      <version>1.0.0+</version>
-      <fields>
-        <field>
-          <name>repositoryMetadata</name>
-          <identity>true</identity>
+        <field jpox.column="PROBLEM_TYPE">
+          <name>type</name>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
           <required>true</required>
-          <association>
-            <type>ArchivaRepositoryMetadata</type>
-            <multiplicity>1</multiplicity>
-          </association>
+          <type>String</type>
+          <description>
+            The type of health problem.
+          </description>
+        </field>
+        <field jpox.column="PROBLEM_ORIGIN">
+          <name>origin</name>
+          <identifier>false</identifier>
+          <version>1.0.0+</version>
+          <required>true</required>
+          <type>String</type>
           <description>
-            The ArchivaRepositoryMetadata to report on.
+            The origin of the health problem.
           </description>
         </field>
         <field>
-          <name>problems</name>
-          <identity>false</identity>
+          <name>message</name>
+          <identifier>false</identifier>
           <version>1.0.0+</version>
-          <required>false</required>
-          <association>
-            <type>HealthProblem</type>
-            <multiplicity>*</multiplicity>
-          </association>
+          <required>true</required>
+          <type>String</type>
           <description>
-            The list of problems associated with this repository metadata.
+            The origin of the health problem.
           </description>
         </field>
       </fields>
         <field>
           <name>repositoryId</name>
           <version>1.0.0+</version>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <required>true</required>
           <type>String</type>
           <description>
         <field>
           <name>whenGathered</name>
           <version>1.0.0+</version>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <required>true</required>
           <type>Date</type>
           <description>
         <field>
           <name>duration</name>
           <version>1.0.0+</version>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <required>true</required>
           <type>long</type>
           <description>
         <field>
           <name>totalFileCount</name>
           <version>1.0.0+</version>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <required>true</required>
           <type>long</type>
           <description>
         <field>
           <name>newFileCount</name>
           <version>1.0.0+</version>
-          <identity>false</identity>
+          <identifier>false</identifier>
           <required>true</required>
           <type>long</type>
           <description>